PWM to DC - Detect if PWM is always 5V

Discussion in 'General Electronics Chat' started by Zappa, Jan 30, 2012.

  1. Zappa

    Thread Starter New Member

    Jan 30, 2012
    2
    0
    Hi,

    I’m trying to convert a 5V PWM output of a microcontroller to a DC signal with a simple RC net. The DC signal are then amplified with an opamp. Please see the attached schematic.

    I looking for a way to make the DC signal 0V if the PWM output is constantly 5V (in case of an error). Is there a good solution for this?


    Many thanks
     
    • sch.bmp
      File size:
      86.5 KB
      Views:
      38
  2. praondevou

    AAC Fanatic!

    Jul 9, 2011
    2,936
    488

    Is the output signal of your circuit supposed to be DC (5V) or should it simply pass the PWM if it is present?
     
  3. colinb

    Active Member

    Jun 15, 2011
    351
    35
    Here's one way of doing it. Depending on your requirements, this might or might not do exactly what you need.
    [​IMG]
    Sample waveforms:
    [​IMG]
     
  4. THE_RB

    AAC Fanatic!

    Feb 11, 2008
    5,435
    1,305
    Here's a "no parts count" watchdog using a diode, and an RC.

    Code ( (Unknown Language)):
    1.  
    2.           47k
    3.       ,----R------,
    4.       |           |
    5.       |           |
    6. IN ---*----|<-----*-----*----- OUT
    7.          diode          |
    8.                         |
    9.                  0.1uF  C
    10.                         |
    11.                         |
    12.                        GND                        
    13.  
    If there are 0v input pulses the diode discharges the cap, then if input is 5v for long enough the cap voltage will charge high enough to give a logic HI on the output.

    If you need the inversion an NPN transistor on the output will do it.
     
  5. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,388
    1,605
    Hello!

    From your description, normal operation the duty cycle will never reach 100%, so the ultimate output will never reach 10V.

    For those conditions, the PWM output is always changing. You could detect 100% (no change) with a retriggerable monostable such as something from the 74123 family. You set the mono period foe a little larger then the PWM period, and trigger it with the PWM signal. The Q output will stay high as long as the PWM < 100%.

    Should the PWM become 100% the mono does not retrigger, so it times out and you have a digital change of state you can use to switch off the analog output. That will catch the failure after the mono times out, which you've already set to slightly greater then the PWM period, and that's about the best (fastest) you can do to catch the fault.

    BTW, your basic circuit concept is fine. Don't add that cap. :D
     
  6. Zappa

    Thread Starter New Member

    Jan 30, 2012
    2
    0
    I really appreciate your help. Thanks for taking your time with the replies. There seems to be a lot of god ideas that I can try.

    The purpose with the circuit is to use a PWM output of a microcontroller to generate a variable DC signal (0-9V) that shall be compared to another signal. But if the PWM output freezes either as 0V or 5V I want the DC signal to be 0V.

    Regards
     
Loading...