# Voltage offset shifting

Discussion in 'General Electronics Discussion' started by bokica1991, Mar 11, 2015.

1. ### bokica1991

5
0
Aug 27, 2012
Hallo everyone,

I have question, for my project I need square wave oscillator (-2.5,2.5V), I generated pwm signal (0.5V) from Arduino Uno, but I can't shift it. I tried to make sumator with PWM signal and -2.5V, but it didn't worked out. Can somebody help.

Thank you

2. ### Gryd3

4,098
875
Jun 25, 2014
Only thing I can think of is using a capacitor to decouple a 5V pwm signal from the Arduino... The problem here is that if the PWM value is anything other than 50% the center point of the PWM signal will drift, in theory you could end up with a -1v to 4v PWM signal.
What are you trying to do? Can you provide example code or schematics for what you tried? You may need additional circuitry to push-pull the values.

3. ### Harald KappModeratorModerator

11,986
2,808
Nov 17, 2011
Show us your summing circuit. And tell us what exactly didn't work. Which signal did you expect, which signal did you see instead?

With some assumptions from my side:
A typical OpAmp based summer has a transfer function that creates:
Vout = -Rf/Rin*(Vin1+Vin2+...)​

Therefore with Vin2=-2.5V you will see Vout = -Rf/Rin*(Vin1-2.5V) Assuming for simplicity Rf=Rin this simplifies to Vout=-(Vin1+2.5V), therefore for
Vin1 = 0V -> Vout = -2.5V
Vin1 = 5V -> Vout = -7.5V

I think you expect
Vin1 = 0V -> Vout = -2.5V
Vin1 = 5V -> Vout = 2.5V
The respective transfer function is Vout= Vin1-2.5V.
You can create this function by inverting the output from the arduino:
Vin1 = -Varduino -> Vout = -(Vin+2.5V) = -(-Varduino+2.5V) = Varduino-2.5V

Regards,
Harald

4. ### duke37

5,364
772
Jan 9, 2011

If all you wish to do is to make the waveform symmetrical about zero, then feed it through a capacitor with a high resistor to ground.

5. ### bokica1991

5
0
Aug 27, 2012
here is my circuit

I understand what i should do, but i can't find proper OP Amp.

yes, I want to make from 0 -> -2.5V and from 5V-2.5V

File size:
22.7 KB
Views:
133
6. ### Harald KappModeratorModerator

11,986
2,808
Nov 17, 2011
Sorry, you don't understand fully. Almost any OpAmp will do, but yo will need two of them:
• OpAmp 1 inverts the output of the arduino
• OpAmp2 will perform as summer

Harald

7. ### BobK

7,682
1,688
Jan 5, 2010
Harald,

I disagree. That circuit will work just fine. Here is a simulation:

8. ### Harald KappModeratorModerator

11,986
2,808
Nov 17, 2011
Bob, please compare the phase of the +-2.5V output with the 0...5V input. If I'm not mistaken, this circuit introduces 180° phase shift (inverts). If that is no issue for the OP, you're right.

9. ### BobK

7,682
1,688
Jan 5, 2010
Yes, it does shift the phase, but this circuit will do the same without shifting the phase. And I eliminated the extra supply by using a voltage divider to bias the + input. The same mod can be done to the previous circuit with the same value resistors.

Any linear transformation of one range of voltages to another can be done by a single op amp (as long as the input and output voltages are within its range.)

Bob

Harald Kapp likes this.
10. ### Harald KappModeratorModerator

11,986
2,808
Nov 17, 2011
O.K., the trick here is the resistive divider from V3 to -5V.
The OpAmp in this circuit works not as summer, but as buffer and amplifier *2.

Nice and simple!