Proposed Solution:
The proposed solution requires hardware and software - including configuration changes to the system. Everything in this proposed solution has been verified on an RPi 3B+ running the Lite version of RPi OS buster
.
Hardware
The following circuit seems to meet the objectives given in the OP. It adds three (3) components that weren't needed in the original schematic: the Real-Time Clock (RTC) at U1
, a monostable multivibrator at U2
- a.k.a. "one-shot" and a 3.3V regulator to power U1
& U2
.
For the RTC, I used Adafruit's DS3231 Precision RTC Breakout. The DS3231 is accurate, stable over temperature and has a feature set that includes an alarm function. N.B. "Counterfeit" DS3231 chips are widely distributed in the el-cheapo retail channels for much lower prices than the Adafruit unit.
The one-shot at U2
provides two functions needed to integrate the RTC: It converts the RTC's alarm interrupt (#INT
) from a state change to a fixed-duration pulse, and it inverts the signal polarity to drive the NPN transistor at Q1
. The SN74AHC123 (available from TI) was chosen, but other one-shots may work equally well. Note that this is a CMOS part, and unused logic inputs must not be allowed to "float" - see the schematic for details.
A 3.3V regulator is added to power the circuitry which must function when power is disconnected from the RPi. The RTC and one-shot draw very little power, and this simple Zener diode regulator is adequate.
RPi Power Management Schematic:

System Configuration
In addition to the hardware, there are some configuration changes to the device tree that will need to be made for the RTC. Setup and verification of the RTC should be done as a first step. The procedure I followed is documented on this GitHub page: Add a Real-Time Clock to Raspberry Pi.
To summarize this procedure, the following entries should be in the /boot/config.txt
file:
dtparam=i2c_arm=on
dtoverlay=i2c-rtc,ds3231,wakeup-source
dtoverlay=gpio-poweroff
Software
The "software" component of this proposed answer is intentionally austere. Its function is to automatically power the RPi ON & OFF on a 20 minute cycle - 10 minutes ON, then 10 minutes OFF. This cycle will repeat itself indefinitely.
The following crontab
entries and bash
script set the ON-OFF schedule, and write the alarm time to the RTC register via sysfs
. Please note the root crontab
must be used:
root crontab entries:
# shutdown & power off schedule
*/20 * * * * /home/pi/setalarm.sh >> /home/pi/setalarm.log 2>&1
clear the current alarm @reboot
@reboot sleep 10; /bin/echo "0" | tee /sys/class/rtc/rtc0/wakealarm; /bin/echo "boot time: $(/bin/date '+%D %X' -d '- 10 seconds') set wakealarm to 0" >> home/pi/setalarm.log 2>&1
setalarm.sh
#!/usr/bin/env bash
clear the current alarm
echo "0" | tee /sys/class/rtc/rtc0/wakealarm
echo "THE TIME IS: $(date '+%D %X')"
calculate the next wakeup and then halt:
/bin/date '+%s' -d '+ 10 minutes' | tee /sys/class/rtc/rtc0/wakealarm
/bin/sleep 5
/sbin/halt
Some Background on 'Zero Power' vs 'Low Power':
As of today, there is no RPi capable of reaching a Zero Power state without external hardware. As long as a 5V power source is connected to the RPi, the RPi will consume power. The RPi's rate of power consumption is reduced during halt
, but all models will continue to consume power as long as a power source is connected. It may be fairly stated that all of the energy consumed by a RPi after receiving a halt
command is wasted energy - unless your objective is to build a Raspberry Pi handwarmer. Obviously, this lack of power management disqualifies the RPi for a large class of otherwise potential applications; e.g. off-grid, battery-powered.
The RPi 4B is the first RPi model to provide what might be called a Low Power mode. However, as of Feb, 2022, a RPi 4B in LPM still burns 150-200 milliwatts after a halt
, and also requires external hardware for re-start. While this is a significant improvement from when the RPi 4B was introduced, this level of power consumption is still too high for many off-grid and battery-powered applications - which is a shame.
Summary of Operation:
Referring to the Power Management Schematic:
Two signals and the K1 relay form the core of this design. INT#
and GPIO-POWEROFF
act through the support circuitry and the K1
relay to either apply or remove power from the RPi. Relay K1
differs from traditional relays in that it is a bi-stable, or latching relay; one of its two coils sets the relay, the other coil resets it. This bi-stable nature is what enables the Zero Power state: Once K1
's contacts are set, they require no power to maintain this state. The contact positions will not change unless the reset coil is energized.
Edit: Do not use an RTC without a backup battery
By RTC backup battery, I mean the small coin-cell type battery that is fitted to the underside of the RTC module. The purpose of this battery is to keep the clock running while disconnected from the normal power source. Without an RTC backup battery, if 3V3 power is removed, the RTC will lose the alarm time that has been set, and when power is re-applied it will not know the correct time unless and until the RPi updates it. The RTC backup battery will last a very long time (years) based on mfr-published specs.