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://files.waveshare.com/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://files.waveshare.com/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

Update RTC Time to System Time

Note: Network should be disabled during this process.
Modify the time in the code:

cd X3PI_RTC_WatchDog_HAT/RTC/python/examples/
sudo apt-get install nano
sudo nano rtc.py   

Add boot-up:

sudo cp -r /home/sunrise/X3PI_RTC_WatchDog_HAT/ /root/X3
sudo chmod -R 777 /root/X3/RTC/python/examples/rtc.py
sudo nano /etc/rc.local
At the end of the line, add python3 /root/X3/RTC/python/examples/rtc.py
Save and exit

Enter date to view the time.



Demo codes


Technical Support

If you need technical support or have any feedback/review, please click the Submit Now button to submit a ticket, Our support team will check and reply to you within 1 to 2 working days. Please be patient as we make every effort to help you to resolve the issue.
Working Time: 9 AM - 6 PM GMT+8 (Monday to Friday)