This is the second part in our series for Raspberry Pi enthusiasts. To read our first part in the series, visit Raspberry Pi for Commercial Applications: Configuring Wifi.
Raspberry Pi enthusiasts have consistently come up with innovative ways to use their mini computer. What’s great about it is, “its ‘tinker-ability.’” You get the most basic resources of a computer.
It’s easy to get stuck on the simple things, however, including how you can safely power down your Raspberry Pi. We’ve compiled some tips and a list of resources to help you optimally shutdown your system.
Should I just pull the plug?
No, it’s not recommended to just pull the plug. This can cause a variety of issues including corruption of your SD card and file system. It’s important that your Raspberry Pi gets a clean shutdown. There are easy ways to do this and some fun projects that you create to ensure a shutdown without unplugging your device.
Shutting down your Raspberry Pi from the terminal
If you have a keyboard and a screen, then the easiest way to shutdown your Raspberry Pi is by using this code in the command line:
This will give you a clean shutdown. After that, you can unplug the computer.
Creating a shutdown button
Unlike your other electronic devices, Raspberry Pi doesn’t come with an “off” switch. However, you can create a switch that acts as a shutdown button for your computer. If you’re running “headless (no keyboard or display)” then adding some kind of “off” switch or button will let you shutdown without unplugging.
The coding and setup instructions can be found at the Raspberry Pi site.
How to turn off without a keyboard
If you’re not using a keyboard then you can shut it down via the menu options.
Press start → select shutdown → turn off the pi
The menu will let you safely shutdown and you can proceed to unplug your device.
Using SSH (Secure Shell)
You can access your Raspberry Pi’s command line from another device if you use an SSH on the same network. It can act as a remote device – you can connect to it from another machine. Once set up, you’ll be able to shutdown your Raspberry Pi from another computer or device if more convenient when working on different projects. The Raspberry Pi site discusses the use of SSH with your device.
SSH will also allow you to shut down from a mobile device – not just another computer. This can be useful when you are wanting to shut down a program that your Raspberry Pi is running, but you cannot access it for different reasons.
ThisDaveJ.com has a great tutorial showing how to control a Raspberry Pi from a mobile device. Check it out.
Though there are some easy methods to shutdown, you have lots of options to play around with your coding.
One fun method is by using voice commands to turn off your Pi. As techradar says, “Make your own Alexa.” This can be done with a microphone and some coding. You’ll be able to give a list of commands to your Raspberry Pi when you’re finished, not just to shut off.
Read the step-by-step instructions at techradar.
And a paperclip?
Yes, you can even shut down with a paperclip. Paperclip isn’t a euphemism for some code work, it’s literally a paperclip that you probably have on your desk. It acts as a switch that you can use to turn your device on or off.
How to turn on Raspberry Pi after shutdown
It’s simple. Just plug it in. You don’t need to write code or create a button. After you have safely shutdown your Raspberry Pi, unplug it. When you’re ready to turn it on again you can just plug it back in.
If you want to leave your computer plugged in, then you can use some of the ideas above as methods to turn it on with a few minor tweaks.
One of the best parts of having a Raspberry Pi is the endless amount of customization and applications you can create. We wanted to touch on a seemingly simple topic – how can I shut it down – but as you can see, a simple process can turn into a fun project.