1
\$\begingroup\$

I'm trying to design a circuit that will reset my ESP8266 when it crashes/hangs. It does this by sending a heartbeat to a 555 timer every minute which resets the 555 timer. The 555 timer is configured in an astable configuration which sends a pulse to the reset pin every one and half minute unless received heartbeat. This is the design for my circuit which is based of from here. enter image description here

However, after simulating this circuit on a breadboard, it doesn't seem to work. I'm not very familiar with 555 timers, the link provided gives a better explanation on the circuit. Any help will be much appreciated.

\$\endgroup\$
  • 1
    \$\begingroup\$ (1) Does the ESP8266 not have an internal watchdog timer? (2) Why does it crash/hang? Bad code? \$\endgroup\$ – Transistor Dec 21 '18 at 14:30
  • \$\begingroup\$ google.com/search?q=watchdog+timer+chip \$\endgroup\$ – crj11 Dec 21 '18 at 14:38
  • 2
    \$\begingroup\$ 1 minute is expecting a lot for an analog RC decay time due to limited choice to plastic caps for low leakage current much less than pull up current or equiv R. Very Poor design to copy. You want an edge sensitive retriggerable port that will never go into fibrillation or repetitive false triggers. So choose a better spec or design to copy. \$\endgroup\$ – Sunnyskyguy EE75 Dec 21 '18 at 18:10
  • 1
    \$\begingroup\$ NE555DR won't work on 3.3V use TLC555C or 7555 etc instead. \$\endgroup\$ – Jasen Dec 21 '18 at 20:26
  • 1
    \$\begingroup\$ @Transistor - an aside, but generally I prefer external watchdogs to internal ones. Too easy for misbehaving code to accidentally vector to a routine that disables the watchdog. An external watchdog (preferably a window watchdog) that can't be disabled by the processor is much more robust. \$\endgroup\$ – Peter Dec 21 '18 at 21:11
3
\$\begingroup\$

When I first saw the circuit I was a little bit dubious it would do anything at all as the thresh and trig pins do not seem to be connected to anything except themselves. Going to the source you posted, one can see that the schematic seems to claim this as well... However in the picture posted of the whole circuit built on the breadboard, one can see there's a green wire going from pin 2 to the capacitor, which is exactly what you'd need to get this circuit working. This is the most probably issue with the circuit.

Now onto some other potential issues.

I looked up the first datasheet for the 555 timer I could find which happened to be this one: http://www.ti.com/lit/ds/symlink/ne555.pdf. In this sheet it's specified that operation is only defined for supply voltages 4.5 to 15 volts, while you seem to be operating the IC at 3.3V. I would recommend operating the 555 timer at 5V unless you have a special 3.3V version of the IC. There isn't an issue with mismatching voltages on the output as the diode on the output of the 555 makes it so the 555 timer can only pull reset low, and cannot push reset high. To make this extra safe, I would add a little RC filter before the diode so that the switching speed of the 555 timer doesn't cause a momentary 5V flash if the parasitic capacitance of the diode is significant but this is probably being overly cautious. These extra components are R3 and C3.

The other 5V 3.3V interfacing issue can be seen at the pulse input. Again, you can just use a simple diode to make it so that you can discharge the capacitor by setting the pulse pin low, however this would only discharge the capacitor to around 0.7 volts every cycle. To fix this I instead used a transistor. Note that this means the pulse must be a high going pulse now instead of a low going pulse to heartbeat the circuit.

One last thing to note, the values I chose for all the resistors capacitors and other parts were mostly arbitrary ball parked numbers, since your post didn't specify any values either. Probably the main part of this you would want to change for your specific application is the values for the timing part of the circuit, R1 C1 and R2.

EDIT: Note that I also agree with what other commentators have said, due to leakage currents, timer temperature variations, and overall complexity this design is probably not the best to be using, optimally you would be using an embedded watchdog timer or just fixing your code so it doesn't crash. Other hardware solutions that may be more reliable could involve a whole other microcontroller to perform this timer control or more complicated digital chips.

schematic

simulate this circuit – Schematic created using CircuitLab

EDIT 2: Jasen suggested a series capacitor to prevent the pulse input from holding the circuit high for too long, as well as a diode to discharge the capacitor. I edited this into the diagram as well as adding in a resistor in parallel with the diode just to make sure the capacitor discharges all the way in one cycle, rather than discharging to one diode drop. This is made up of C4, D4, R7, and R8. Note that as with the other values in this schematic, these values were chosen arbitrarily as well so tweak the RC time constant for your application.

\$\endgroup\$
  • 2
    \$\begingroup\$ I suggest adding a series capacitor (and diode from ground) in the input so that a stuck "pulse" input does not sleep the watchdog forever. \$\endgroup\$ – Jasen Dec 21 '18 at 20:20
  • \$\begingroup\$ A good suggestion, I'll edit it in. \$\endgroup\$ – Kevin Brant Dec 21 '18 at 21:02
  • \$\begingroup\$ @KevinBrant Thank you so much for the help and I deeply apologise for the lack of data as I'm fairly new to 555 timers. I simulated the circuit you recommended on a breadboard without the protection components like the RC filter at the output and input(pulse) to test the proof of concept. When the pulse pin is left to float the output sends a pulse at every set interval, when pulse is pulled low output is HIGH, when pulse is pulled high output is LOW. Although I am currently looking at specific ICs to fix this problem but I would still like to troubleshoot this circuit. \$\endgroup\$ – Max Dec 22 '18 at 7:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.