# isolated 5v PWM to 0-10V

I'm trying to convert a 5V PWM signal to 0-10V through an optocoupler to drive a VFD. The output "0-10V" should be 0V when PWM duty cycle is 0%, and 10V when 100% (linearly !). Here is what I've come up with:

So, when OUT1 is high (5V):

• 10mA should pass through U9 and saturate the photo-transistor
• Q1 and Q2 bases are now 12V, so Q1 is opened, and Q2 closed
• C2 charges through Q1 and RV1, voltage rises

When OUT1 is low (0V):

• U9 transistor is closed
• R17 pull Q1 and Q2 base to 0V, so Q1 is closed and Q2 opened
• C2 discharge through RV1 and Q2, voltage fall

RV1 can be tuned to increase or decrease smoothing (depending on PWM frequency).

Will it works ? I would like to know if I'm heading in the right direction before ordering the parts !

• This is an isolated PWM DAC. So the input of the RC filter will see a PWM with Vpk =~ 12 V, and the filtered and buffered signal will be the mean value of it: Vo = D × Vpk, where D is the duty cycle. It can work but the PWM output may have a peak value of about 12V. This may be a bit high for your needs. You may fix it with R16 and R17. Also I'd suggest a 2nd RC filter for better ripple performance. Please note that the cutoff freq should be lower than half the PWM freq. Commented Jan 10, 2020 at 23:50
• @RohatKılıç If I use 2K for R16 and 10K for R17, will I end up with 10V max ? Commented Jan 11, 2020 at 0:06
• Probably yes. The totem pole driver is a good choice here as it has unity voltage gain and high input impedance. You could use the other opamp of the LM358, though. Anyway, if the result does not satisfy you then you can play with those resistors until you hit the target. Commented Jan 11, 2020 at 0:15
• Is there a reason you need isolation? Are you just using it as part of the level shifting circuit or do you actually need it? Commented Jan 11, 2020 at 0:15
• @ccolton Dunno If I really need it. My reasoning is that the PWM input signal comes from an expensive piece of equipement (not mine !), and the output goes to a VFD in a pretty harsh industrial environement... So hey, why not throw in a 10 cents optocoupler ? Commented Jan 11, 2020 at 0:27

No this circuit wont work. I tried it out and I did not work because of many reasons.

1. when opto is switched on 12 volts is being provided to the base of Q1 and Q2. therefore, Q1 switches on and provides 12 volts to RC Low Pass filter. But , when opto is switched Off , base of Q1 & Q2 is grounded by 20k resistor which dramatically increases the switch on time of Q2, because of which we get a triangular waveform at the RC network and not a 12volt square wave.

2. to solve this issue, I reduced r17 to 1k to reduce switching on time of Q2. this created more problems . Now when Opto is switched on , 12 volts gets divided between r16 and r17 and base of transistor now gets 6v at 100% duty cycle. and because Vbe = 0.7v , we are getting 5.3v at the emitter of Q1.

3. to solve all these issues , use two opto couplers instead of Q1 and Q2 and no need of u9 , r16 and r17. Works flawlessly.

I would have omitted the totem pole, because you don't need a low output impedance at this point: there is a 100k resistor after.

Just don't use large values for the resistor in the emitter of the optocouper to avoid slow switching.

This yields to this schematics. I did not draw the opamp at the right: don't change this part.

simulate this circuit – Schematic created using CircuitLab

[EDIT] I incresed the values of the resistors because the optocoupler has only a minimal 50% ratio.