RTC WatchDog HAT

From Waveshare Wiki
Jump to: navigation, search
RTC WatchDog HAT





RTC WatchDog HAT For Raspberry Pi, Auto Reset, High Precision RTC.


RTC WatchDog HAT

  • MAX705 monitoring circuit with auto reset function.
  • Incorporates DS3231SN high precision RTC chip, with backup battery holder.
  • Reset pin selection for switching watchdog.
  • Indicator for watchdog output warning.


  • RTC Communication Interface: I2C
  • RTC Chip: DS3231
  • WatchDog Chip: MAX705
  • Power Supply: 5V
  • Dimensions: 30.5mm x 65mm
  • Mounting Hole Diameter: 3.0mm

How to use

Working With Raspberry Pi

PS: The system of the Bullseye branch only supports Python3.


Open a terminal and run the following command to download the demos.

sudo apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/b/bd/RTC_WatchDog_HAT.zip
7z x -tzip -y RTC_WatchDog_HAT.zip -o./RTC_WatchDog_HAT
sudo chmod 777 -R RTC_WatchDog_HAT
cd RTC_WatchDog_HAT/RTC
C Example
cd ~/RTC_WatchDog_HAT/RTC/c/
make clean
sudo ./main
RTC WatchDog HAT 1.png
Python Example
cd python/examples/
sudo python main.py
RTC WatchDog HAT 2.png

Add Kernel Mode Driver

Note that with this method, you cannot use the above sample demo.
Modify /boot/config.txt and add the following commands at the end:


Hwclock is simple to use

Synchronize System Clock -> Hardware Clock.

sudo hwclock -w

Synchronize Hardware Clock -> System Clock.

sudo hwclock -s
  #Need to close the network or close the network time, otherwise, it will be changed back.

Set the hardware clock time:

sudo hwclock --set --date="9/8/2021 16:45:05"

View the hardware clock.

sudo hwclock -r

Display version information.

sudo hwclock --verbose


In the WatchDog example, it feeds the watchdog chip if the D4 pin toggle. If the watchdog doesn't be feed in T time, it will cut off the power and the voltage falls to 1.25V, in this case, the MAX705 chip will reset and restart the power. About the time T:

T = 0.7*R*C+1.6s
R is default 5.1M, and C is default 44uF.
Tge default delay time is 157.08s ±6%.

RC are set in the board:


Working With Horizon Sunrise Pi X3


Download the sample demo, extract it to a specified directory, and run the sample demo:

sudo apt-get install p7zip-full
wget https://www.waveshare.com/w/upload/f/fe/X3PI_RTC_WatchDog_HAT.zip
7z x -tzip -y X3PI_RTC_WatchDog_HAT.zip -o./X3PI_RTC_WatchDog_HAT
sudo chmod 777 -R X3PI_RTC_WatchDog_HAT
cd X3PI_RTC_WatchDog_HAT/RTC


cd c/
make clean
sudo ./main

RTC WatchDog HAT50.png


cd python/examples/
sudo python main.py

RTC WatchDog HAT51.png



Demo codes


If you require technical support, please go to the Support page and open a ticket.