Giter VIP home page Giter VIP logo

arduino-watchdog-circuit's Introduction

Donate to this project using Patreon Donate to this project using Gratipay

Arduino-Watchdog-Circuit

The current Arduino library has bugs in the freelist implementation, which can lead to difficult to debug system hangs. For maximum reliability of my home automation projects, I built an external hardware watchdog.

The purpose of a watchdog is to decide when things have gone wrong by listening for a heartbeat signal which is only sent under good conditions. If something goes so wrong that the program cannot recover from it, or cannot recover in time, the watchdog timer's job is to reset things to a known good state. In embedded systems, this often happens by simply resetting to the initial state.

Usage

Connect +5V and GND from the Arduino to the watchdog circuit's +5V and GND pins. Connect the watchdog circuit's output line to the Arduino's reset pin, and watchdog circuit's input line to one of the digital I/O pins for the Arduino.

Configure the digital I/O pin to be normally high-Z ("INPUT"). Periodically connect it to GND ("OUTPUT", "LOW") and hold for a few hundred milliseconds to send the heartbeat signal.

If the heartbeat signal is not sent within approximately 120 seconds of the last heartbeat signal (with documented R and C values; changing values will change timing), the Arduino's reset line will be held low, causing system reset.

Circuit diagram

Theory of operation

See also:

The Arduino's reset pin is active low; therefore, in order to trigger a reset we will hold the pin low for a period of time. The 555's output pin will be used for this purpose; it is connected to the Arduino's reset pin through a diode to ensure that no stray signals on the Arduino's reset line can cause unexpected interference in the 555.

Under normal operation, charge builds up in C1 while the 555's output pin is set high. When C1's charge is sufficient to reach the 555's threshold (approximately 2/3 of VCC), the 555 output will flip low. Since the 555's output is tied to the Arduino's reset line, this will reset the system.

When the Arduino sends a heartbeat to the watchdog circuit, the heartbeat line is set to a low output, aka GND. This drains charge from C1 through R3, which in turn means that C1 is further away from the 555's threshold voltage.

The main components of this circuit are the 555 timer, C1, R1, and R2. Changing the values of C1, R1, and R2 will change the charging/discharging times, and can be useful if you want a circuit with a different time profile. D1, C2 and R3 are mostly about guarding against voltage fluctuations and current surges that can damage your equipment and cause transient resets or failures.

Photos

arduino-watchdog-circuit's People

Contributors

mattbornski avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.