# PWM to 0-10v

Discussion in 'General Electronics Discussion' started by PRIYADHARSHINI, May 28, 2015.

137
8
Feb 6, 2014
Hi all
I want to convert the 2-4 V pwm input to 0-10V output...How can i convert this using opamp..can any one explain the logic to design the circuit.

5,164
1,087
Dec 18, 2013
The op-amp is not classed as a logic component . What have you done yourself about this problem. Let's see some effort from you first, show us a circuit that you think might work. Look at your input range and output range, this should give you a clue.

3. ### RafPe

9
3
May 28, 2015
You could potentially use transistor as amplifier but here a frequency would also play a game. What are you trying to achieve ?

7,682
1,688
Jan 5, 2010

5. ### BobK

7,682
1,688
Jan 5, 2010
Oh, you wanted an explanation too.

You want to convert a range of 2-4V to a range of 0-10V. So, you need to come up with an equation for that. You look at the range of input voltages (2) and the range of output voltages (10) and you know that you need a gain of 5. (10 / 2). Next you look at the min input voltage (2) and the min output voltage (0) and you know that you need to subtract 2 from the input before applying the gain. So the equation is:

Vout = (Vin - 2) * 5

A differential amplifier has the transfer function:

Vout = (Vin+ - Vin-) * G

So, you simply build a differential amplifier with gain of 5 then you put 2 V on the - input (to subtract 2) and put the 2-4V signal on the + input. Voila!

Bob

5,164
1,087
Dec 18, 2013
Oh Bob, just the ticket. Nice one!

137
8
Feb 6, 2014
Thank you so much Bobk..
infront of the input shall i add the LPF like this

#### Attached Files:

• ###### pwm input.png
File size:
33.3 KB
Views:
1,513

137
8
Feb 6, 2014
k...if my input is 0.8V TO 4.5V....

then my calculation should be

4.5-0.8=3.7
then 10/3.7=2.7.my gain should be 2.7 to achieve 10V for 4.5 input
then Vin-(0.8)*2.7=0
but it gives 8.0v at the output..
what is the reason???
but it produces 9.99v for 4.5v input
here i have attached my simulation

File size:
283.7 KB
Views:
313
9. ### BobK

7,682
1,688
Jan 5, 2010
I simulated the same circuit and it works fine.

In your simulation, it looks like the + input is just connected to a label called .8V. This will not put a voltage on the input, you need to connect it to a voltage source.

Edit: Also, the LT1055 is not a good opamp to use. You need a single supply opamp for this circuit. The LM324 is a popular one. I used LT006 because that was the first single supply one that came up in LTSPICE.

Bob

137
8
Feb 6, 2014
oh...sorry..As u said i used LTI006..but it gives 0.4v for 0.8v input?????
what is the wrong with me...?

File size:
56.8 KB
Views:
255
11. ### BobK

7,682
1,688
Jan 5, 2010
No. It is giving 42mV or 0.042V, which is probably as low as the op amp can go on output. If you want to get all the way to zero, you will need to use dual supplies, which will make 0 part of the valid output range.

Edit: But effectively 4mV is probably good enough.

Bob

Last edited: May 31, 2015

137
8
Feb 6, 2014
thanks a lot Bobk..I will do it practically...

137
8
Feb 6, 2014
i have done this in breadboard.... i used lm324 opamp
for 0.8v i get 0.5v output..for 4.5v i get 9v output
when i changed my supply voltage +/-15v i get 0v for 0.8v input
and 6.6v for 4.5v output......

137
8
Feb 6, 2014
I used LM324..this circuit gives 10v for 0.8v
and 10v for 4.5v
can i eliminate the ref voltage 0.8v?????
this 0.8v continously changes while changing the pwm input voltage

#### Attached Files:

• ###### LM324.png
File size:
50.2 KB
Views:
1,889
Last edited: Jun 1, 2015
15. ### hevans1944Hop - AC8NS

4,615
2,154
Jun 21, 2012
Can we re-visit this problem? What do you mean when you say 2-4 V pwm? A pwm signal is constant amplitude pulses with a variable pulse width. If you apply this to a low-pass filter the result can be a 2-4 V DC output, depending on duty-cycle and perhaps with some ripple that depends on the pwm frequency and the LPF characteristics. The voltage range of the filtered output does not include zero unless the pulses vanish at some suitably low duty cycle.

So, yes, you need the "offset" reference voltage to set the output to zero, or nearly zero, at your minimum duty cycle. @BobK has already shown you how to do this in his post #4 and #5, but it does require bi-polar op-amp supply voltages to actually reach zero output. You can derive the reference voltage from your +15 V DC supply using a voltage divider consisting of a 10 kΩ resistor in series with a 1 kΩ potentiometer to common, the wiper arm of the pot connecting to the non-inverting op-amp input, replacing R5 and R6.

It may not be relevant to the problem, but where and how exactly are you obtaining your pwm signal? What does this signal represent, and why do you want to convert it to a zero to ten volt DC signal? Is zero output at minimum duty cycle of the pwm signal important to you? Will the output be further processed, perhaps with an analog-to-digital converter?

16. ### BobK

7,682
1,688
Jan 5, 2010
Where are you getting the 0.8V reference for the - input?

The voltage on the - pin is not 0.8V but is 0.8V * G / (G+1), so, what Hop suggested has to be modified to put that voltage, not 0.8V on the + pin. And this can be done with a voltage divider. Since you gain (G) is 2.7, you would put 0.58 V on the - pin to make this work correctly.

Bob

17. ### hevans1944Hop - AC8NS

4,615
2,154
Jun 21, 2012
@PRIYADHARSHINI I just now noticed that the you have reversed the inverting and non-inverting inputs to op-amp U1B, creating positive feedback from the output to the non-inverting input. The junction of your feedback resistor, R3, and the input resistor, R4, must connect to the U1B inverting input, pin 6, else the op-amp will behave as a bi-stable latch switching between the positive rail and ground. Also, the original circuit posted by @BobK applies the input signal, V1, to the non-inverting input of the op-amp through a voltage divider. The circuit recently posted by @PRIYADHARSHINI won't work, even with correction of the wiring to the inputs of U1B, because the positive input into R4 from the output on pin 1 of non-inverting buffer-connected U1A is a positive voltage that will try to drive the output of U1B negative. It will fail to do that without a negative power supply connected to pin 4 instead of the connection to ground.

@BobK 's original circuit in post #4 is correct. You should use it. He has even made the impedance "seen" by the inverting and non-inverting inputs the same, which is always a good idea. And he mentions that without a negative power supply rail on the op-amp, the output cannot ever be zero. Also, Bob applies the positive-going input pwm signal to the non-inverting input, assuring that the output goes positive. He applies the "offset" correction to the ground side of the feedback network through the 10 kΩ resistor, R1 in his simulation. This offset voltage is represented by V3 in Bob's circuit, but he doesn't provide a voltage value. The value depends on the minimum pulse width of your pwm signal. You should reproduce Bob's circuit exactly as shown if you don't want to provide a negative power supply rail. Otherwise, provide a negative rail and correct the input connections to U1B to use the circuit you posted. The output however will be negative, between 0 and -10 V DC, instead of between 0 and +10 VDC because of the signal inversion in U1B. Is that what you want?

All I was suggesting, before noticing the errors in @PRIYADHARSHINI latest circuit, is that you derive the offset voltage with a potentiometer voltage divider connected between the +15 V DC supply and ground so as to allow a small adjustment range for the offset. The series combination of a 10 kΩ resistor with a 1 kΩ potentiometer will produce about 1.4 V DC across the pot when connected to the +15 V DC supply. That means about 0.7 V DC offset is available when the pot wiper is centered between its two limits. Again, if this "correction" is applied to the non-inverting input through R1 in Bob's original circuit it will drive the output more negative as the filtered pwm input drives the output more positive. But it still won't be capable of adjustment to zero output without a negative supply applied to the op-amp.

Last edited: Jun 1, 2015