Watchdog for asterisk: implementation (Part III)
Part III: Watchdog Timer (Missing Pulse Detector)
The following circuit implements a watchdog timer, sometimes also called a missing pulse detector.
The circuit expects pulses (active low) at intervals less than its timing constant, given approximately by (see LM555 datasheet):
T = 1.1 * R4 * C8
When a pulse is present at the input to this circuit (which is the output from the tone decoder), capacitor C8 is discharged because Q1 is turned on. It will again be charged starting from 0V, while the output (pin OUT of the 555 timer) remains high. Thus, it takes time T for the capacitor to be charged to the triggering threshold voltage for the output to go low. If the next pulse comes long before this amount of time elapses, then we start the timing cycle again without changing the output.
For the values chosen (1MegOhm and 47uF), T is about 52 seconds. Thus, the host computer needs to send a tone blip to the decoder no more than every 50 seconds or so. I plan to make that 10 seconds, with pulses of slightly varying frequencies (from the low-cutoff frequency to the high-cutoff frequency of the tone decoder), so that we can accommodate some shifts in the center frequency due to temperature variations.
D3 is a flyback diode that absorbs the voltage surge when the relay is turned off; this is necessary to protect the 555 IC. The output of the relay is used to connect or disconnect a plain telephone from the phone line. SW1 is connected to the handle of the telephone, so that when it is picked up, the relay will lose its current in that event as well. Note that the relay is connected as normally closed, so that when we lose power to the relay by whatever reason (power outage, host computer crash, or handset picked up), we get the plain telephone online.
The video below demonstrates the watchdog timer in action. For the purpose of this demonstration, I have replaced R4 with a 100kOhm resistor, so that the time constant T is now about 5 seconds. Eight tone blips of 0.25s in width in 2s intervals are generated from the host computer. The tone decoder nicely lights the orange LED accordingly, and the timer turns on the green LED and make it stay on as long as the blips come in frequently enough. About 5 seconds after the last pulse, the timer turns off the green LED and, in the final circuit, the relay as well, putting the telephone online.
The following circuit implements a watchdog timer, sometimes also called a missing pulse detector.
The circuit expects pulses (active low) at intervals less than its timing constant, given approximately by (see LM555 datasheet):
T = 1.1 * R4 * C8
When a pulse is present at the input to this circuit (which is the output from the tone decoder), capacitor C8 is discharged because Q1 is turned on. It will again be charged starting from 0V, while the output (pin OUT of the 555 timer) remains high. Thus, it takes time T for the capacitor to be charged to the triggering threshold voltage for the output to go low. If the next pulse comes long before this amount of time elapses, then we start the timing cycle again without changing the output.
For the values chosen (1MegOhm and 47uF), T is about 52 seconds. Thus, the host computer needs to send a tone blip to the decoder no more than every 50 seconds or so. I plan to make that 10 seconds, with pulses of slightly varying frequencies (from the low-cutoff frequency to the high-cutoff frequency of the tone decoder), so that we can accommodate some shifts in the center frequency due to temperature variations.
D3 is a flyback diode that absorbs the voltage surge when the relay is turned off; this is necessary to protect the 555 IC. The output of the relay is used to connect or disconnect a plain telephone from the phone line. SW1 is connected to the handle of the telephone, so that when it is picked up, the relay will lose its current in that event as well. Note that the relay is connected as normally closed, so that when we lose power to the relay by whatever reason (power outage, host computer crash, or handset picked up), we get the plain telephone online.
The video below demonstrates the watchdog timer in action. For the purpose of this demonstration, I have replaced R4 with a 100kOhm resistor, so that the time constant T is now about 5 seconds. Eight tone blips of 0.25s in width in 2s intervals are generated from the host computer. The tone decoder nicely lights the orange LED accordingly, and the timer turns on the green LED and make it stay on as long as the blips come in frequently enough. About 5 seconds after the last pulse, the timer turns off the green LED and, in the final circuit, the relay as well, putting the telephone online.
Labels: Watchdog for Asterisk
0 Comments:
Post a Comment
Subscribe to Post Comments [Atom]
<< Home