Powerberry – power switch for the Raspberry Pi

Powerberry is a prototype of a power ON/OFF switch for the Raspberry Pi or other single board computers. It uses a relay to turn ON and OFF the power source with a button or a remote controller. There is a microcontroller on board which handles all its functions.

I have cut the power adapter’s microUSB cable. One end is connected on DC IN terminal and the other end is connected on DC OUT terminal.

It’s connected with the Raspberry Pi with two wires on the GPIO header pins. The Raspberry Pi runs a script on boot which configures one pin as output (STATE) and the other as input (SIGNAL). The STATE pin delivers a HIGH pulse on Powerberry letting it know that Raspberry Pi is active. The SIGNAL pin receives a pulse from Powerberry and the script shuts down the Raspberry Pi safely. The Powerberry knows when the Raspberry Pi has shut down (from STATE pin) and turns off its power.

If we hold the button on Powerberry while powering it on, it enters “IR learning mode”. We press a button on our remote 3 times, the IR signal gets decoded and stored in the microcontroller’s EEPROM. From now on the remote acts like the onboard button and the LED blinks to verify it’s stored.
The LED is blinking while the Raspberry Pi is starting. It’s steady on if the Raspberry Pi is active and blinks twice 30″ later to show us that we can turn it off with the button or the remote.
We press the button (or the remote) to turn it off and the LED starts blinking again. When Powerberry is informed that Raspberry Pi has shut down, the LED blinks fast a few times and cuts the power through the relay.
The LED blinks twice 5″ later to inform us that we can turn on again the Raspberry Pi. During that time the button and the remote cannot be used.

There are also header pins on Powerberry to connect external button, LED and relay. That way we can hide this board in our project and use a single button to turn off the Raspberry Pi and other peripherals (like a monitor) using an external relay module.

Leave a Reply

Your email address will not be published. Required fields are marked *