Graceful Shutdown & Sleep Mode for Raspberry Pi – DIY Power Management Circuit
Raspberry Pi is a powerful, versatile platform for robotics, yet it lacks a native power button. As a Linux‑based system, it must be shut down gracefully before power is removed; otherwise, the SD card’s file system can become corrupted – a problem I’ve encountered many times.
To eliminate this risk, I built a simple, low‑cost circuit that not only powers down the Pi safely but also puts the robot into a low‑power sleep state, waking automatically after a set interval. For added value, the design can measure current consumption. While commercial kits like Sleepy Pi exist, the same functionality can be achieved with readily available components.
Why a Sleep Mode Matters
In a battery‑powered robot, energy efficiency is key. When idle, the robot can conserve power by shutting itself down. An internal alarm clock then wakes it at regular intervals to check for tasks. For a robot boat, this allows long‑range travel—drifting with wind or sails—while keeping the battery alive.
Key Components
- Pololu Pushbutton Power Switch SV
Provides a reliable on/off switch without a relay. The button can be triggered electronically via theOffpin, allowing the Pi or a microcontroller to initiate shutdown. It handles up to 10 A, more than enough for the Pi and peripherals. - Pololu 5 V, 9 A Step‑Down Regulator D24V90F5
Converts 12 V to 5 V for the Pi. The regulator’sEnablepin can be pulled low to cut power. Because the pin is pulled up to 12 V, a transistor or MOSFET is required to interface it with the Pi’s 3.3 V logic.
How It Works
When the robot is idle, a microcontroller (or the Pi itself via GPIO) drives the Off pin of the Pololu switch low, triggering the regulator’s Enable pin to disable the 5 V rail. This sequence ensures the Pi receives a graceful shutdown command before power is fully cut. After a pre‑set delay, the microcontroller toggles the Enable pin back high, restoring power and resuming operation.
To monitor power usage, a shunt resistor or current‑sense IC can be added in series with the 12 V input, feeding a measurement pin back to the microcontroller.
For a full schematic and detailed instructions, see the original article: Raspberry Pi Shutdown Circuit with Sleep mode.
Manufacturing process
- Circuit With a Switch: A Practical Guide to Basic Electrical Circuits
- Constructing a Reliable Low‑Voltage AC/DC Power Supply: Bridge Rectifier & Capacitive Filter
- Understanding Single‑Phase Power Systems: Efficiency, Safety, and Design
- Calculating Power Factor in AC Circuits: Theory, Impact, and Practical Correction
- How to Read Temperature with a DS18B20 on Raspberry Pi 2
- Measuring Temperature on Raspberry Pi with Maxim 1‑Wire Sensors and DS2482 I2C Bridge
- Accurate Temperature Monitoring in a Server Closet with Raspberry Pi
- Lightning Detection with Raspberry Pi and AS3935: A Practical Guide
- Build a Headless Raspberry Pi 2 Water Alarm with Adafruit T‑Cobbler Plus
- Build a Self‑Balancing Segway with Raspberry Pi