Turn Raspberry Pi on and Off - WindowsTips.net - Windows Tips and Tricks with Geek

Sunday, October 17, 2021

Turn Raspberry Pi on and Off

 

How to Turn on the Raspberry Pi

First, make sure you have your HDMI cable connected to your TV or monitor, along with your keyboard and mouse of choice. USB keyboards and mice work fine on first boot, as do most wireless combos with their own USB receiver. Later, you can connect any Bluetooth keyboard or mouse to your Raspberry Pi.

Plug the power adapter into an outlet, connect the USB-C cable to it, then plug the other end into your Raspberry Pi.

Connect the USB cord to the power port on your Raspberry Pi
Location of the USB-C power port on a Pi 4. Yours will look different if you’re using an older model with a micro USB port. trickyaamir/Shutterstock.com

A red LED will turn on, and you’ll see a rainbow screen followed by the Raspberry Pi OS desktop. From this point, if it’s your first boot into Raspberry Pi OS, you’ll go through some setup menus.

How to Turn a Raspberry Pi Off the Right Way

Since all you have to do to start up the Raspberry Pi is plug it in, you just unplug it to power down, right? Absolutely not, actually. Abruptly removing power before shutting the operating system down can cause your SD card to get corrupted. This danger is worse for some operating systems than others, but it is definitely still a threat to Linux, the most common OS used on Raspberry Pi. Do that enough times, and your Raspberry Pi won’t boot up all the way until you reinstall.

Instead, you need to do a proper shutdown. There are a couple of ways to do this. In Raspberry Pi OS, you can do this by clicking the Raspberry icon in the top left corner of your screen and choosing Log Out.

On the next menu, you can choose to log out, shut down, or reboot. If you’re done for the day, choose Shut Down. After a few minutes, your screen should go completely black and you’ll notice the red LED on the Pi go out.

Finally, choose either Shutdown or Reboot.

The second way to shut down your Raspberry Pi is from the terminal. Simply open a terminal, type in this command, and hit Enter:

sudo shutdown -h now

Again, you’ll soon see the screen go black and the red power LED turn off. After that, you can safely remove the power cord. When you’re ready to start your Raspberry Pi again, reconnect the power cord.

Add a Power Button to Your Raspberry Pi

Of course, you can also add a power button to your Raspberry Pi. There are cases that have include a power button, such as Argon40’s Argon ONE M.2 case. Also, CanaKit makes a power button attachment for the USB-C power cable. The drawback to CanaKit’s solution is that it simply kills power to the USB-C plug; there’s no way to signal a graceful shutdown to the OS.

Power buttons for a Raspberry Pi

One thing to be mindful of is that your Raspberry Pi will not automatically know to do a proper shutdown when you press the power button. For a power button to trigger the shutdown command, it needs to be wired into the GPIO header. You’ll also have to program your Pi to trigger the shutdown command when you push the button.

Of course, you may not want to dive into a project like that right now. In that case, you’ll probably want to stick with an external, prebuilt power button.

No comments:

Post a Comment