A controlled shutdown button

The Raspberry Pi should always be shut down correctly to avoid the SD card being corrupted (by losing power while performing a write operation to the card). This can pose a problem if you don't have a keyboard or screen connected (if you are running an automated program or controlling it remotely over a network and forget to turn it off) as you can't type the command or see what you are doing. By adding our own buttons and LED indicator, we can easily command a shutdown, reset, and startup again to indicate when the system is active.

Getting ready

You will need the following equipment:

  • 3 x Dupont female to male patch wires
  • Mini breadboard (170 tie points) or a larger one
  • Push button switch (momentary close)
  • General purpose ...

Get Raspberry Pi for Python Programmers Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.