Blog

 

Powering up/down your Pi with a button

While most people let their Pi’s run 7/24h, we know that some people want to shutdown their Pi’s. Let’s have a look how to do this.

Power cycle

Most people just disconnect the power. I already hear people saying: You can’t do this, this will corrupt the file system. In reality, it’s much less problematic than you think. We disconnect the power on our systems here in the office regularly and SD card corruptions are extremely rare. In general, modern file systems are quite robust. With HiFiBerryOS, we also minimized write requests to the file system. This makes this solution quite robust.
As with any way to shutdown the Pi, you always should have a backup if you stored data on the Pi. SD card corruptions can happen all the time – even if you shutdown the Pi gracefully. Always backup your important data!

GPIO3 solution

This is something we hear regularly about. Somebody noticed that connecting GPIO3 to ground will restart a Pi that had been shut down before. This method uses some program that monitors GPIO3 and shuts the system down when pressing the button. Restarting it by pressing the button again is handled by the Pi’s hardware. While this seems to be an elegant solution, it’s not. It’s a rather problematic way for various reasons:

  • GPIO3 is uses for the Pi’s I2C bus that is used by many HiFiBerry sound cards to configure the card. Therefore, you can’t monitor GPIO3 state correctly. Also waking the system via GPIO3 can also be problematic as the GPIO is required to configure the HiFiBerry sound card early in the boot process.
  • Shutting down the Pi using a command like “shutdown” doesn’t mean it doesn’t consume power anymore. While this shuts down the Pi’s CPU and peripherals, many other parts might still consume energy. A very bad example is a system with the official Pi touchscreen. After shutting it down, the system’s current draw was still 460mA (!). Even though, the system didn’t respond to anything anymore, the power consumption was still quite high. But even a plain Pi 3B without anything connected to it still consumed 90mA.

Therefore, we do not recommend this “solution” at all.

Uninterruptible power supply (USPS)

There are some USPS boards in the market that can not only provide power to the Pi if the mains power fails, but also manage power on/off. While this usually work quite well without a HiFiBerry sound card, combining both is often problematic or impossible. As the Pi’s GPIO isn’t designed for stacking, you often can’t stack multiple cards as they don’t fit physically.
Even if they do, there might still be GPIO conflicts.

The HiFiBerry power controller


As we were not happy with the existing solutions, we have created the HiFiBerry power controller. This not only handled power on/off, but also comes with its own microcontroller that’s programmable, a rotary controller and a 3-color LED. While it can be used as a simple power controller, it can do a lot more. The software that runs on the controller is open source and you can implement additional functionality easily using the Arduino IDE.
And the best: It can even deal with input voltages as high as 30V. That means, you can not only use it with our DAC’s and Digi’s, but also with our amplifiers. The power controller is expected to be available in March 2021. You can already subscribe on the product page to get notified when it’s on stock.

January 18, 2021

Subscribe to new blog posts