# PWM to DC - Detect if PWM is always 5V

#### 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

• 86.5 KB Views: 38

#### 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?

#### colinb

Joined Jun 15, 2011
351
Here's one way of doing it. Depending on your requirements, this might or might not do exactly what you need.

Sample waveforms:

#### Attachments

• 23.1 KB Views: 16

#### 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,089
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.