Raspberry Pi Safe Reboot and Shutdown Button
Pulling the plug on your Raspberry Pi before it safely shuts down... is a bad idea! This can result in a corrupt microSD card and file system. Normally, we can use the menu bar from the GUI or type a command in the terminal window to safely shutdown the Pi. If you are looking for a quicker solution (especially if you are using a headless setup), have no fear! You can safely reboot or shut down your Raspberry Pi using a general purpose button and a Python script!
To follow along with this tutorial, you will need the following materials. You may not need everything though depending on what you have and your setup. Add it to your cart, read through the guide, and adjust the cart as necessary.
Raspberry Pi LCD - 7" TouchscreenLCD-13733
Multimedia Wireless KeyboardWIG-14271
SparkFun Raspberry Pi 4 Basic Kit - 4GBKIT-16384
We would also recommend taking a look at the following tutorials if you aren't familiar with them.