CC Blog Newsletter Product News Tech News

Witty Pi 4 HAT adds Real Time Clock and Power Management to Raspberry Pi

Written by Stephen Vicinanza

Witty Pi 4 HAT adds real-time clock and power management to Raspberry Pi. The Witty Pi 4 is an add-on board that adds power management and a real-time clock (RTC) to the Raspberry Pi.

One of the main benefits of the Hardware Attached on Top (HAT) board from Witty is it can turn your Raspberry Pi on and off at preset times, to save energy. This is a fourth-generation Witty Pi and has a number of resources onboard.

  • AVR 8-bit Microcontroller (MCU) with 8KB programmable flash
  • Dedicated temperature sensor with a 0.125℃ resolution
  • Factory-calibrated and temperature-compensated real-time clock with ±2 ppm accuracy
  • On-Board DC-DC converter that accepts 30V DC


The Witty Pi’s software is designed to be used with the Raspberry Pi OS (formerly Raspbian). There may be error occurrences in using the Witty Pi with other Linux distributions. This is mainly due to other distributions having a wide range of packages and user defaults. In order to take care of the errors you may need to change the script or even the software. For a software re-code knowledge of the programming language BASH is necessary.

Real-Time Clock

The real-time clock in the Witty Pi 4 is calibrated in the factory and the HAT makes use of temperature compensation in the firmware for the crystal. The combination of factory calibration and temperature compensation makes the RTC in the Witty Pi 4 extremely accurate. The actual error gradient is ±2 ppm.

At the boot-up of the Raspberry Pi, the time stored in the RTC overwrites the system time. Because of this, the Raspberry Pi knows the correct time, without the need for an internet connection. The main benefit of this type of clock is automatic on/off scheduling. The Raspberry Pi can come online at a preset time and shut down at a certain time. This makes it a time-controlled device and can even be programmed for multiple on/off sequences.

The real-time clock is a popular feature of the Witty Pi 4 and the scheduling feature makes it even more desirable. This is especially true for battery-powered systems. By controlling when the system comes on and shuts down, it can be programmed to be running only when necessary. This extends the battery life much further than it would normally run.

Temperature controls

The temperature sensor on the Witty Pi 4 has a 0.125℃ resolution. This resolution temperature is used in compensating the crystal and making the RTC extremely accurate.

The Witty Pi 4 can also be set to come on or turn off at certain temperatures, above or below preset thresholds. This means the device is temperature-controlled also.

Single I2C device

The MCU in the Witty Pi 4 can emulate a single I2C device with a default address of 0x08 and can map all I2C registers in real-time clock and temperature sensors as virtual I2C registers in the same device. This also allows access to all the I2C registers within the real-time clock and the temperature sensor.

The advantage of this new design is that the HAT hides other I2C devices and becomes a proxy of them, to talk to the Raspberry Pi. There is the added advantage that any value can be used for the I2C address, and therefore conflicts between I2C addresses can always be avoided.

To find out more about the Witty Pi 4 and access all the data on the HAT, see the product page on the Adafruit Website here.

Adafruit |

Keep up-to-date with our FREE Weekly Newsletter!

Don't miss out on upcoming issues of Circuit Cellar.

Note: We’ve made the Dec 2022 issue of Circuit Cellar available as a free sample issue. In it, you’ll find a rich variety of the kinds of articles and information that exemplify a typical issue of the current magazine.

Would you like to write for Circuit Cellar? We are always accepting articles/posts from the technical community. Get in touch with us and let's discuss your ideas.

Sponsor this Article
+ posts

For the past 8 years, I have been writing about embedded technologies, added to my technical, academic, and medical editorial experience, with companies like Elsevier and Cambridge University Press. I tell people to read what I write, not try to pronounce my last name. I am always available for comments and suggestions you can reach me at and I promise I will take the time to reach back out to you. I live in the North East with my wonderful family.

Supporting Companies

Upcoming Events

Copyright © KCK Media Corp.
All Rights Reserved

Copyright © 2024 KCK Media Corp.

Witty Pi 4 HAT adds Real Time Clock and Power Management to Raspb…

by Stephen Vicinanza time to read: 2 min