Making your projects more reliable

555 Timers

The 555 timer is an integrated chip (IC) used in a variety of timer, pulse generation, and oscillator applications. The 555 can be used to provide time delays, as in a WDT, and as a flip-flop element for memory.

First made in 1971 by Signetics, the 555 is still widespread because of its ease of use, low price, and stability. It is now made by many companies in the original bipolar type, as well as a low-power CMOS type. As of 2003, it was estimated that 1 billion units are manufactured every year.

The dual WDT (Figure 2) is based on the 555 timer IC running in a stable mode. The 555 timer acts as a "continuous" pulse generator. The pulse starts on power up or any time the trigger input (JP2) is brought to ground. The setting of the TM1 potentiometer determines the length of the pulse (30-240 seconds; Figure 3).

Figure 2: Schematic of dual watchdog timer.
Figure 3: Setting Wto on the potentiometer.

When the pulse ends, the Arduino Reset output is taken to ground for approximately 200ms, and the Pulse High output goes to VDD. Then the cycle starts over again. A key to the recovery of projects that might suffer from brownouts (e.g., solar systems) is to run the reset pulse again and again until the computer responds.

If the timer input is grounded (it should normally be in a high-impedance state), then the pulse is started again. Therefore, if you pulse the timer input (WatchDog One (Dog1) and WatchDog Two (Dog2) on the schematic) low before the timer expires, the pulse never ends, so the outputs are never triggered: ArduinoReset remains in a high-impedance state, and the pulse output remains in a 0 state.

The two WDTs are independent; however, they can be used together. The Dog1 and Dog2 trigger inputs need to be wired together in this mode and triggered together. This mode allows the use of a bistable relay to turn a relay connected to the plus VDD power on a Raspberry Pi. A single timer may be used to drive a relay through a buffer transistor, or directly if 200ms is sufficient to trigger the relay and reset the device.

Calculating the Pulse Length (Wto)

To calculate Wto, you set the 1Mohm potentiometer TM1 (for Dog1) and TM2 (for Dog2). The length of pulse length is

Wto ~=1.1(RTM1 x C1 ) ~=220 sec

where: RTM1 is the value of the potentiometer (=1Mohm) and C1=200uF.

The length of the low pulse is given by

Wlow ~=0.693 x R2 x C1 ~=500ms

where R2=3.3Kohm and C1=220uF. Wto is very flexible, and you can adjust it from about 220 to 30 seconds.

The code in Listing 2 pats the dog by holding the watchdog in high impedance mode and then taking it to ground. The Python code for the Rasp Pi is shown in Listing 3.

Listing 2

Patting the Dog: Arduino

01 #define RESET_WATCHDOG1 9
02 void ResetWatchdog1()
03 {
04     pinMode(RESET_WATCHDOG1, OUTPUT);
05     delay(200);
06     pinMode(RESET_WATCHDOG1, INPUT);
07     Serial.println("Watchdog1 Reset");
08
09 }

Listing 3

Patting the Dog: Rasp Pi

01 #define RESET_WATCHDOG1 18
02 def resetwatchdog():
03
04   GPIO.setup(RESET_WATCHDOG1, GPIO.OUT)
05   GPIO.output( RESET_WATCHDOG1, False)
06   time.sleep(0.200)
07   GPIO.setup(RESET_WATCHDOG1, GPIO.IN)

Version 1 of the dual WDT was designed in Eagle [5], and the PCB was fabricated by DFRobot in China [6]. Figure 4 shows the populated board with two independent 555-based WDTs that can run on 3.3V or 5.0V.

Figure 4: Dual watchdog board, version 1.

When I first assembled and blogged about the board, people immediately asked if they could buy a complete dual watchdog board rather than build their own. I changed a couple of things on the board (screw connectors to pins headers and changed the 1Mohm resistor to a 1Mohm single-turn potentiometer) and had the board manufactured professionally. The complete, fully tested board is available now at SwitchDoc Labs [7] and on Amazon. Version 2 is shown in Figure 5, and Figures 6-8 are Fritzing diagrams for wiring your devices to the board.

Figure 5: Dual watchdog board, version 2.
Figure 6: Raspberry Pi B to dual watchdog version 2.
Figure 8: Arduino to dual watchdog version 2.

What I learned by having this board manufactured will be the subject of an upcoming SwitchDoc Labs column. To summarize: The world has changed; you can outsource and manufacture your own products.

Buy this article as PDF

Express-Checkout as PDF

Pages: 8

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

SINGLE ISSUES
 
SUBSCRIPTIONS
 
TABLET & SMARTPHONE APPS
Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content