PWM TO DC USING OPTOCOUPLER

Hello,
im trying to convert PWM to DC signal. i succeded to do this with RC low pass filter of R=3.9k and C=30uF, But i want first of all to get the pwm into optocoupler and then convert it to DC signal. when i put the RC low pass filter after the optocoupler i get DC signal but not in the currect value.
The circuit is attached.

Thank you

PWM.pdf (9.19 KB)

maor444:
when i put the RC low pass filter after the optocoupler i get DC signal but not in the currect value.

Is that according to the o'scope or the voltmeter?
Any data?

There might be several causes why this might be happening. A bit more of info might be helpful.

  1. How much shift in DC voltage is present at the filter output than the expected value?

  2. What's the frequency of the PWM used?

Now the probable cause:

  1. Transistor base to emitter junction is probably eating a bit of voltage. It consumes some of the voltage to turn ON the transistor.

  2. You cannot expect the transistor output to mimic the exact same waveform as the input since they have tun-on and turn-off time. At lower freq, it doesn't matter. But it gets serious at higher freq. The best possible way to check this is to remove the filter and compare the input PWM wave and the waveform at the output of the transistor.

  3. The input side LED response may not be that good at the freq you have applied to the opto coupler.

The frequency of the input is 2 ms. I measured this in pspice.
The shift after the filter is about 1-2v.

Your low pass filter has a different time constant during charging and discharging its capacitor (C2). It charges C2 through R4 + R7 (4.9K) and discharges C2 through only R7 (3.9K).

You'll need to revise your circuit. I would suggest trying an opto-isolator with logic output connected to a basic RC filter.

The frequency of the input is 2 ms. I measured this in pspice.

This is the General Electronics Topic.
Frequency is not measured in mS. That unit is called PERIOD. Frequency is measured in Hz.
Do the math.