Need help - convert pulse width to DC level

Thread Starter

ak360

Joined Jan 18, 2009
10
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 :(
 

SgtWookie

Joined Jul 17, 2007
22,230
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?
 

SgtWookie

Joined Jul 17, 2007
22,230
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.
 

Attachments

SgtWookie

Joined Jul 17, 2007
22,230
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.
 

Attachments

Thread Starter

ak360

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

thanks a lot!
 
Top