PWM to DC - Detect if PWM is always 5V

Thread Starter

Zappa

Joined Jan 30, 2012
2
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
 

Attachments

praondevou

Joined Jul 9, 2011
2,942
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

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

THE_RB

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

Rich (BB code):
          47k
      ,----R------,
      |           |
      |           |
IN ---*----|<-----*-----*----- OUT
         diode          |
                        |
                 0.1uF  C
                        |
                        |
                       GND
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.
 

ErnieM

Joined Apr 24, 2011
8,046
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?
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
 

Thread Starter

Zappa

Joined Jan 30, 2012
2
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.

Is the output signal of your circuit supposed to be DC (5V) or should it simply pass the PWM if it is present?
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
 
Top