PWM duty cycle detector

Discussion in 'General Electronics Chat' started by Martino Chiro, May 1, 2015.

  1. Martino Chiro

    Thread Starter Member

    May 1, 2015
    56
    0
    A PWM signal has a minimum duty cycle of 5% and a max d.c. of 95%. I need to switch on a LED when the d.c. is above or equal to 10%. And switch when d.c. il less then 10%.
    Thank You for any suggestion.
     
  2. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Low pass filter it to average it.

    Assuming that it is a fixed maximum amplitude PWM signal, voltage compare to 10% of peak amplitude.

    To design a circuit I would need the frequency and amplitude of the PWM signal.
     
  3. jpanhalt

    AAC Fanatic!

    Jan 18, 2008
    5,692
    901
    Do you want an analog solution or do you prefer a digital (microcontroller) solution?

    For an analog solution, you could use a low-pass filter which will give a voltage proportional to the duty cycle. Then a comparator could assess that voltage for your LED's.

    John
     
  4. Martino Chiro

    Thread Starter Member

    May 1, 2015
    56
    0
    Thank You MikeML,
    f=5KHz and V=5V
     
  5. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    This sounds like the PWM is already coming out of a microcontroller. Can you just use a new port pin and do the comparison in code?
     
  6. Martino Chiro

    Thread Starter Member

    May 1, 2015
    56
    0
    Unfortunately no, the controller is out of my control. I can only manage the PWM signal.
     
  7. wayneh

    Expert

    Sep 9, 2010
    12,120
    3,044
    I don't usually say this, but wouldn't the digital solution be a lot easier here, assuming the TS is savvy with a micro?
     
  8. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,535
    1,251
    The trip point is exactly twice the pulse width, so you don't need a reference. One-half of an LM393 is pretty simple. (OK, I frequently say that.)

    ak
     
  9. Martino Chiro

    Thread Starter Member

    May 1, 2015
    56
    0
    Please could tou better explain "The trip point is twice the pulse widh " ?
     
  10. crutschow

    Expert

    Mar 14, 2008
    13,007
    3,233
    Come again? :confused:
     
  11. Martino Chiro

    Thread Starter Member

    May 1, 2015
    56
    0
    Please could tou better explain "The trip point is twice the pulse widh " ?
     
  12. AnalogKid

    Distinguished Member

    Aug 1, 2013
    4,535
    1,251
    oops. never mind.
     
    cmartinez likes this.
  13. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Green is 9% duty cycle, Red is 10% duty cycle, and Blue is 11% duty cycle. Note how the LED goes from full off to full on as the voltage from the LPF decays below the trip-point voltage of 528mV. Note that with R2 and R3 as shown, the trip point is ratiometric with the 5V supply, so if it is not exactly 5.00V, you will have to tweak R2/R3... 202.gif
     
  14. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,038
    3,804
    Nice, any chance of helping him with the 90% duty cycle also?
     
  15. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    Where does 90% come from?
     
  16. GopherT

    AAC Fanatic!

    Nov 23, 2012
    6,038
    3,804
    You're right, I misread his first post. I thought he wanted within 10% of each limit.
     
  17. Martino Chiro

    Thread Starter Member

    May 1, 2015
    56
    0
    I haven't a programmer background experience, so i use only analog or digital solution, but without micro and software.
    Thank You
     
  18. Martino Chiro

    Thread Starter Member

    May 1, 2015
    56
    0
    Very good solution.
    From the Linear Technology datasheet of the LT1018, it seems that it can be used as Op Amp also. It may be of some advantage, use the second half of the LT1018 as an active low pass filter ? For all i know, a comparator is not a good choice for an op amp, but in this case, LT seems to propose that.
    Thank You MikeML.
     
  19. MikeML

    AAC Fanatic!

    Oct 2, 2009
    5,450
    1,066
    You can use any comparitor. I used the LT1018 because I knew it works on a single , low voltage supply....

    The only advantage an active filter over the single pole RC filter I used is that the LED would turn on more abruptly, and follow changes in duty cycle a bit faster.
     
  20. Martino Chiro

    Thread Starter Member

    May 1, 2015
    56
    0
    Do you suggest a single or double pole active filter for this application ?
     
Loading...