Easiest way to measure PWM width

Thread Starter

praondevou

Joined Jul 9, 2011
2,942
I need to transform PWM to DC. I don't want to use a uC or RC filter and it needs to be fast. Is there an easier way than to use a sample and hold circuit?

Fast I mean like instantly adjusting the DC voltage according to the PWM width within one or two cycles.

f = 1kHz fixed
Duty cycle can range from 0 to 100%

Thanks
 

Wendy

Joined Mar 24, 2008
23,429
In one fell swoop you eliminated the two best ways, one uses the natural analog feature inherent in PWM and the other uses the computational method (that is faster overall) but overkill for the job. Analog and Digital both eliminated in one brush. LC filter perhaps?
 

ramancini8

Joined Jul 18, 2012
473
Let the leading edge of the PWM signal gate an oscillator. Have each oscillator cycle step up a DC supply. Alas, instant DC, but you have to set the steps to zero sometime. This becomes more complicated than the S/H.
 

THE_RB

Joined Feb 11, 2008
5,438
If you use much faster PWM you can reduce the filter time lag, also if you use an op-amp (active) filter with a very sharp curve you can filter the PWM freq but still get a fast response.

Personally I'd use a micro with intelligent PWM, and if needing a fast change in output could use a trick like forcing the output ON or OFF for a short fixed time, to bump up the response speed of the filtered DC voltage. You could use a lookup table or a calc to determine that "forced" time. I've done a similar thing on a heating application, not quite a PID system but still capable of a fast response and a quick stop at the new PWM.
 

crutschow

Joined Mar 14, 2008
34,464
The simplest way I can think of to get a fast linear DC output from a PWM signal without using a micro, is a gated (boxcar) integrator with a S/H on the output. The integrator charges during the PWM period and its output transferred to the S/H at the end of the period. This represents the PWM average value. The integrator is then reset to zero and the integrate cycle restarts. That will give you a DC output for each PWM cycle which is linear with respect to duty-cycle.

Edit: Just ran into another thread with this link which shows a circuit (pg. 92).
 
Last edited:

Thread Starter

praondevou

Joined Jul 9, 2011
2,942
The simplest way I can think of to get a fast linear DC output from a PWM signal without using a micro, is a gated (boxcar) integrator with a S/H on the output. The integrator charges during the PWM period and its output transferred to the S/H at the end of the period. This represents the PWM average value. The integrator is then reset to zero and the integrate cycle restarts. That will give you a DC output for each PWM cycle which is linear with respect to duty-cycle.

Edit: Just ran into another thread with this link which shows a circuit (pg. 92).
This is what I had in mind. There doesn't seem to be any simpler then, apart from uCs.

Thanks all.
 

THE_RB

Joined Feb 11, 2008
5,438
But won't a gated sample and hold still have the same lag as the integrator slope?

It seems we're just swapping a 1mS ramp between voltages for a 1mS delay followed by a fast transition?

It would have helped to know WHY a fast change between DC voltages is needed. :)
 

crutschow

Joined Mar 14, 2008
34,464
But won't a gated sample and hold still have the same lag as the integrator slope?

It seems we're just swapping a 1mS ramp between voltages for a 1mS delay followed by a fast transition?
The gated integrator will give the correct output at the end of the first pulse, even before the end of the period. You can't be any faster than that. ;)
 

THE_RB

Joined Feb 11, 2008
5,438
Thanks for spelling that out, I missed it in your earlier post and thought you were suggesting using a sample and hold to store the output while a (long term) integrator was stabilising at the new DC voltage. My mistake. :)
 
Top