PowerBlock – a Raspberry Pi Power Switch
Overview
The PowerBlock is a Raspberry Pi Power Switch. It is an extension board for your Raspberry Pi™. It allows you to conveniently turn on and off the power to the Raspberry Pi with a toggle switch. Instead of just cutting the supply voltage with the risk of data loss the PowerBlock it communicates with the Pi and ensures a clean shutdown when the switch is turned to off.

Feature Overview
- Micro USB connector for power supply
- 2×6 pin header for mounting on the Pi
- Pin header for arbitrary toggle switches
- Pin header for optional status LED
- USB-A break out pins for optional USB-A power out connector
- Software daemon for clean shutdowns
- Optional pin outs for arbitrary 5V power supply
- Optional DC Barrel Jack
- No soldering required
Technical Specs
- Input Voltage: 5V
- Output Voltage: 5V
- Continuous Current @ 25°C: maximum 3.7 A
- MOSFET Static On-Resistance: 0.065 Ω
Any toggle switch can be connected to the PowerBlock. The power status of the Raspberry Pi can be indicated via an optional status LED.
The PowerBlock comes fully assembled with open-source drivers that are easy to install. If you are interested in getting the PowerBlock for your project, it can be ordered here.
Raspberry Pi Power Switch “PowerBlock” – Feature Details
The PowerBlock provides a Raspberry Pi power switch functionality. Why is it useful? The Raspberry Pi comes without a power switch. As soon as you plug the micro USB cable into the RPi, it turns on. If you want to shutdown the Raspberry Pi, you need to call a shutdown command to bring the system into a state in which you can safely remove the USB cable again. If you just pull out the micro USB cable the file system of the RPi might become corrupted and you risk loosing data.
Here, the PowerBlock comes into play. It is stacked onto the GPIO header of the Raspberry Pi and provides a micro USB connector itself, a connector for a toggle switch to control the power supply of the Raspberry Pi, and a connector for an LED to indicate whether the Raspberry Pi is off, booting, running, or shutting down. A micro controller on the PowerBlock board manages the power supply and monitors the button state as well as the state of the Raspberry Pi. The driver ensures that a safe shutdown is initiated when you switch to “off”. This also means that you do not need to plug and unplug the USB cable from the Raspberry anymore if you want to completely and safely turn it off.
Hardware Interface of the Raspberry Pi Power Switch “PowerBlock”
Here are a top and bottom view of the PowerBlock PCB:
The hardware interfaces of the PowerBlock are described in the following:
Compatible with Raspberry Pi Models A, B, and Zero
Compatible with Raspberry Pi Models A, B, and Zero
The dimensions of the PowerBlock PCB are chosen such that it exactly matches the two mounting holes on the opposite of the USB sockets of the Raspberry Pi models A+ and B+. The PowerBlock PCB comes with the same round corners as the Raspberry itself and give it a neat look. Regarding the GPIO usage the PowerBlock is attached to the first 2×6 pins of the Raspberry Pi GPIO header.This addition makes it possible to not only mount the PowerBlock to the Raspberry Pi model A and B, but also to the Raspberry Pi Zero. Here are some exemplary images for the various models:
2x6 pin female header as connector to the Raspberry Pi
2x6 pin female header as connector to the Raspberry Pi

The PowerBlock PCB is attached to the Raspberry with a 2×6 pin female header. This header makes use of pins 1 to 12 of the J8 header. This header is used for connecting the voltage and ground pins as well as the status pins between the RPi and the PowerBlock. The PCB is kept as small as possible so that you can easily access all other pins that are not used by the PowerBlock.
Micro USB Connector for the power supply
Micro USB Connector for the power supply
Pin Out for a Toggle Switch
Pin Out for a Toggle Switch
Pin Out for Status LED
Pin Out for Status LED

The current power state of the Raspberry Pi can be indicated with a 5V status LED that can be attached to the two pins that are provided by the PowerBlock. A 220 Ohms resistor limits the current of the status LED. You will find a load variety of possible LEDs that fit these values. You can find one here.
These possible states can be “off”, “booting”, “on”, and “shutdown”. The different states are indicated with easy-to-distinguish static and pulsing patterns.
Side note: The maximum allowed output current of the status LED pin is 40 mA.
Signal breakouts for input voltage, output voltage, and control signals
Signal breakouts for input voltage, output voltage, and control signals

The PowerBlock can also be used without directly attaching it to the GPIO header of the RPi: There are individual pin outs for the 5V input voltage, the 5V output voltage, as well as for the control signals S1, and S2. This gives you a maximum of freedom for your project. The connection between these pin outs and the Raspberry Pi need to be as follows:
S1: pin 12 S2: pin 11 5V OUT +: pin 2 or pin 4 5V OUT -: pin 6 or pin 9
In-Service Programmer (ISP) pin-out for ATtiny
In-Service Programmer (ISP) pin-out for ATtiny

The Power Switch logic is implemented with the help of an Atmel ATtiny85 microcontroller. If you want to you have the possibility to access the microcontroller with the ISP header. In this way you could reprogram the microcontroller with whatever functionality you like.
Optional DC Barrel Jack Adapter
Optional DC Barrel Jack Adapter

The PowerBlock is also prepared for connecting a DC barrel jack adapter. The hole dimensions for the barrel jack adapter are chosen such that most of DC barrel jack adapters should fit. The exact footprint of looks like this:

One DC Barrel Jack that matches these dimensions can be found here.
Optional USB A Connector for switched power out
Optional USB A Connector for switched power out
GPIO Pins used by the PowerBlock
GPIO Pins used by the PowerBlock
S1: pin 12 S2: pin 11 5V OUT +: pin 2 and pin 4 5V OUT -: pin 6 and pin 9
Getting Started with the Raspberry Pi Power Switch “PowerBlock” – Hardware Setup
Attaching a Power Supply
Attaching a Power Supply
Attaching a Power Switch
Attaching a Power Switch

To turn the Raspberry Pi on and off with the PowerBlock you need to attach a toggle switch to the two button pins on the PowerBlock. How does the PowerBlock work then? Technically speaking, the microcontroller on the PowerBlock looks, if the two pins of the switch are connected or not. If they are connected, a GPIO pin of the microcontroller on the PowerBlock is pulled to GND and interpreted accordingly.
- It is important that you use a toggle switch and not a momentary button with the PowerBlock. Otherwise the Raspberry Pi will be turned off again right after booting.
- If you do not want to use the power switch functionality you can disable this in the configuration file /etc/PowerBlockconfig.cfg by setting “powerswitch”: false.
- The power switch circuitry of the PowerBlock leads to a tiny voltage drop and we made the experience that a good quality power supply and a good quality USB cable are mandatory for a working setup. If unsure, we can recommend the official Raspberry Pi Power Supply.
Attaching a Status LED
Attaching a Status LED

The PowerBlock has pin outs for an optional status LED that indicates the power state of the Raspberry Pi. You can directly attach an LED to the pins that are marked with “LED”. You need to pay attention to the polarity of the LED: The LED pins are marked with “+” and “-” for that.
The LED will blink in four different patterns that depend on the power state of the Raspberry Pi:
- Off: The LED is simply off.
- Booting: The LED slowly fades in and out.
- On: The LED constantly stays on.
- Shutting down: The LED fades in and out twice as fast as during boot up.
Getting Started with the Raspberry Pi Power Switch “PowerBlock” – Software Installation
You need to install the PowerBlock driver to enable the power switch functions. You find detailed instructions for the driver installation here.
Links
Videos
Installation of the PowerBlock driver
Posts about the PowerBlock







