Maker Pro
Maker Pro

Voltage offset shifting

bokica1991

Aug 27, 2012
5
Joined
Aug 27, 2012
Messages
5
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
 

Gryd3

Jun 25, 2014
4,098
Joined
Jun 25, 2014
Messages
4,098
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
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.
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
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
 

duke37

Jan 9, 2011
5,364
Joined
Jan 9, 2011
Messages
5,364
Show us your circuit.

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.
 

bokica1991

Aug 27, 2012
5
Joined
Aug 27, 2012
Messages
5
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
 

Attachments

  • Screenshot_1.png
    Screenshot_1.png
    22.7 KB · Views: 133

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
I understand what i should do, but i can't find proper OP Amp.
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
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
Harald,

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

offset.JPG
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
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.
 

BobK

Jan 5, 2010
7,682
Joined
Jan 5, 2010
Messages
7,682
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.)

offsetnoninvert.JPG

Bob
 

Harald Kapp

Moderator
Moderator
Nov 17, 2011
13,700
Joined
Nov 17, 2011
Messages
13,700
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!
 
Top