Easiest way to measure PWM width

Discussion in 'General Electronics Chat' started by praondevou, Aug 17, 2012.

  1. praondevou

    Thread Starter AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    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
     
  2. Wendy

    Moderator

    Mar 24, 2008
    20,766
    2,536
    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?
     
    praondevou likes this.
  3. ramancini8

    Member

    Jul 18, 2012
    442
    118
    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.
     
    praondevou likes this.
  4. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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.
     
    praondevou likes this.
  5. crutschow

    Expert

    Mar 14, 2008
    13,036
    3,243
    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: Aug 18, 2012
    praondevou likes this.
  6. praondevou

    Thread Starter AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    I am not surprised. :rolleyes:
     
  7. praondevou

    Thread Starter AAC Fanatic!

    Jul 9, 2011
    2,936
    488
    This is what I had in mind. There doesn't seem to be any simpler then, apart from uCs.

    Thanks all.
     
  8. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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. :)
     
  9. crutschow

    Expert

    Mar 14, 2008
    13,036
    3,243
    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. ;)
     
  10. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    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. :)
     
Loading...