# Need help - convert pulse width to DC level

Discussion in 'The Projects Forum' started by ak360, Jan 18, 2009.

1. ### ak360 Thread Starter Member

Jan 18, 2009
10
0
I need a circuit which converts the pulse width of a DC square wave into a DC level.

I.e. if the pulse width is 5ms the DC output is 5 volt, if the pulse width is 10ms the DC output is 10 Volt, and so on.

I have read that I need to put the square wave through a low pass filter to accomplish this - but no luck so far

2. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
There's more to it than that; it's the PW (pulsewidth) in relationship to the PRF (pulse repetition frequency) or PRT (pulse repetition time).
What is your PRF or PRT?

What is the amplitude (voltage) of your pulse? Is the non-pulse period at 0V or some other level?

3. ### ak360 Thread Starter Member

Jan 18, 2009
10
0
sorry, the amplitude is 5V, and yes it pulses from 0V to 5V

4. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
What is your PRF or PRT? (Sorry, I'd edited my post while you were replying)

5. ### ak360 Thread Starter Member

Jan 18, 2009
10
0
I'm not sure what they are - lets just assume that i have a 50% duty cycle and 60Hz square wave.

6. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
OK, well this isn't precisely what you asked for, but I threw something together that was quick.

On the left is a pulse generator; it's putting out a 10mS 5V pulse, once every 100mS.

R1 and C1 constitute a lowpass filter. However, note that the output (green trace) is pretty jagged. R2 and C2 are the same values of R1 and C1, but notice how much smoother (blue trace) the output is - that's because it's already been filtered by the previous stage (R1/C1).

Since the duty cycle is 10/100 = 1/10, you'd expect to get exactly 0.5v out. Note that the output at the junction of R2/C2 is approaching 500mV (0.5v) after 50 pulses have occurred.

If the duty cycle were doubled, the output voltage would roughly double; if halved, the output voltage would be halved.

File size:
58.9 KB
Views:
153
7. ### ak360 Thread Starter Member

Jan 18, 2009
10
0
That's GREAT! Yup that is exactly what i've been looking for thanks a lot (Y)

8. ### SgtWookie Expert

Jul 17, 2007
22,182
1,728
Here's another version with three caps/resistors - 50% duty cycle at 50Hz, which is roughly what you asked for.

Notice how much more quickly the voltage settles down at the junction of R3/C3 (red trace) than the previous filter. There's about 3mV noise on the output, but that's not too bad. Increasing R1 thru R3 and/or C1 thru C3 will quiet the output down, at a cost of longer time for the output to stabilize.

File size:
56.3 KB
Views:
138
9. ### ak360 Thread Starter Member

Jan 18, 2009
10
0
awesome! i tried it today at work and it works perfectly - this is a big help for my final project

thanks a lot!