How to Turn Raspberry Pi on and Off


    A Raspberry Pi 4 B Computer
    Ferter/Shutterstock.com

    If you’ve just got your Raspberry Pi, you probably noticed it lacks a power button. This might leave you wondering how to turn the miniature computer on and off. Let’s walk through it all, step by step.

    How to Turn on the Raspberry Pi

    To start up your Raspberry Pi, all you have to do is plug it in. Beginning with the Raspberry Pi Model 4, you simply need a USB-C cable and any 5V power source. Older models of the Raspberry Pi still require a 5V power source, but use a micro USB connector.

    RELATED: USB Explained: All the Different Types (and What They’re Used for)

    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
    Omar Shekho/Shutterstock.com

    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.





    Source link

    Previous articleFidelity Investments Exec Says Bitcoin Is Not “A Bubble That’s About To Burst”
    Next articleDoes Apple Cider Vinegar Really Work for Weight Loss, Blood Pressure, and More?