Electrical – Pulse width limiter Circuit

multivibratorpwm

I have a mosfet controlling power to a heater. I send pulses (akin to pwm) to tell the mosfet to turn on and send current to the heater. The pulses are coming from a Beagle Bone Black. The process on the controller takes the feedback from a thermistor and sets the output pin that's connected to the mosfet high, when necessary. If the program halts or freezes with the pin set to high for more than 10 seconds, then the equipment will catch fire. What kind of circuit can I use to limit the length of the high pulse to only 1.5 seconds? It is expected that the pin will transition from high to low in less than 1.5 seconds (henceforth reffered to as the limit time) but can make multiple transitions (low to high to high to low) many times per second. The frequency could be as high as 250hz.

Best Answer

I am a little surprised by the number of answers here recommending a WDT for this task. The WDT can guard against software faults, but implementing a good robust WDT is not trivial, and designing the code to fail to "kick the dog" when a fault occurs is fraught with peril, especially on a complicated multi-threaded system like a BeagleBone running (presumably) Linux. A watchdog timer is not a magic wand that makes software safe - it is a tool that can make software more robust, but only if implemented correctly.

If this were my project, I would implement two hardware mitigations to remove the processor from the equation entirely:

  1. A safety circuit that detects if the GPIO from the processor has latched high for more than ten seconds, and if so, kills the heater. This is your first line of defense.

  2. A one-time use thermal fuse that kills the heater in the event that the temperature rises above a critical threshold. This is your second line of defense.

Why both mitigations? Well, the first option mitigates a particular known failure mode (processor output latches high), but this won't catch all possible failure modes that cause the particular hazard (overheating). It is likely there are other failure modes that can cause this hazard - for example, the PWM output could still be transitioning faster than 0.1 Hz but with a 99% duty cycle, or maybe the relay that operates the heater latches shut.

The thermal fuse detects the hazard directly (by detecting the overheating) and blows, permanently cutting power to the heater and removing the hazard. This would actually be sufficient to catch the GPIO latched condition on its own, but in this case we probably don't want to do that since the thermal fuse is permanent and it sounds like you are dealing with debugging your code (it would be inconvenient to replace a thermal fuse every time the output stayed high during development).

As for the safety circuit, something like this should do the trick:

schematic

simulate this circuit – Schematic created using CircuitLab

The circuit works like this: R1 and C1 form an RC circuit, selected such that their time constant allows them to charge to the reference voltage created by R2 and R3 at t=10s when the GPIO voltage is high. Once this happens, the output of the comparator goes to logic low, and when ANDed with the input signal, forces the heater off.

The reverse Schottky diode across the resistor allows the capacitor to drain quickly (ideally instantly) when the GPIO goes low, resetting the time delay circuit. Since the value of C1 might be quite large depending on the value of R1 chosen, it may be prudent to put a small resistor in series with D1 to limit the discharge current to the maximum value the GPIO is allowed to sink.

No fancy timers, no 555s, no watchdog circuits - just some basic components and simple glue logic.

Related Topic