element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Blog Watchdog Timer for the Raspberry Pi
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Raspberry Pi requires membership for participation - click to join
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
GPIO Pinout
Raspberry Pi Wishlist
Comparison Chart
Quiz
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: mistertee
  • Date Created: 19 Jul 2016 10:15 AM Date Created
  • Views 5847 views
  • Likes 1 like
  • Comments 19 comments
Related
Recommended
  • autostart
  • watchdog timer

Watchdog Timer for the Raspberry Pi

mistertee
mistertee
19 Jul 2016

Like all PCs the Raspberry Pi is likley to hang up during operation due to unexpected events not being catered for in the code. In an unattended application where the program automatically starts this can be a problem as there is no one around to restart the RPi. If there is no keyboard or HDMI monitor this is by power cycling. The Raspberry Pis internal watchdog timer has a poor reputaion - there are many comments about it being unreliable. This post presents a simple external watchdog timer.

 

Although there are dedicated power supply monitoring chips this solution uses components that are likley to be in most electronic hobbyists kit - based around the popular 555 timer.

 

image

 

The programme has to supply a Hi going pulse every few seconds. If there is no pulse for more than about 60 seconds the 555 output on Pin 3 will go low. This is coupled through to the on-board reset pin of the Raspberry Pi through a capacitor to issue a low going pulse which resets the Pi.

 

A capcitor is used here so that only a pulse going from Hi to Low will reset the raspberry Pi. A constant Lo voltage which is present while the raspberry Pi is starting up will have no effect.

 

If a shorter time is required then either reduce the value of R1 (1Mohm) or reduce the value of C1 (100 uF).

 

The LED pulses every time a Hi Pulse is issued to provide a visual indication to the user that everything is fine. The 555 timer does not easily provide a retriggerable monostable function that is required for a watchdog timer. Diode D1 is used to discharge the capacitor every time a pulse is received.

 

The reason the delay before a reset is set at more than 60 seconds is that the Raspberry Pi takes more than 30 seconds to start up.

 

Click here for a guide to setting the Raspberry Pi to autostart.

 

image

 

The image above shows the connection to the Reset pin of the Raspberry Pi.

 

Summary

 

Althogh the Raspberry Pi has an in-built watchdog timer, this has a poor reputaion. This watchdog timer is a reliable way of resetting the Raspberry Pi in remote applications where there is a risk of it hanging up due to the code not handling unexpected events correctly.

  • Sign in to reply

Top Comments

  • mistertee
    mistertee over 8 years ago in reply to mcb1 +1
    True - I am sure there is a much better chip out there. 555 timers are like Marmite - you either love it or hate it. I had some in stock (doesn't one always) and couldnt be bothered to order a new IC and…
Parents
  • Former Member
    Former Member over 8 years ago

    This circuit looks very good ! And the function is not obscured by too much documentation and tons of sw code.

     

    While I agree, there should be no sw-error left, ;-) : this watchdog should catch any remaining error.

     

    Good design !

     

    (One improvement would be very nice : Watchdog get's active only after the first trigger pulse. Would allow to make it's use optional.)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • Former Member
    Former Member over 8 years ago

    This circuit looks very good ! And the function is not obscured by too much documentation and tons of sw code.

     

    While I agree, there should be no sw-error left, ;-) : this watchdog should catch any remaining error.

     

    Good design !

     

    (One improvement would be very nice : Watchdog get's active only after the first trigger pulse. Would allow to make it's use optional.)

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube