Adding a Power Button to a Raspberry Pi

Here is the simplest way to add a power button to a Raspberry Pi. A physical button is useful if you need to safely shutdown but are not able to connect to the Pi.

First, connect a push button between pins 5 and ground.

Second, add this line to /boot/firmware/config.txt

dtoverlay=gpio-shutdown

Now you should be able to halt and resume your Raspberry Pi using a physical button. The pi will still consume small amounts of power while halted.

March 16, 2025

Galen Asphaug