Hacking the Official Raspberry Pi Keyboard: Build a Battery-Powered All-In-One Pi Keyboard!

Talk about compact.
Zach Zach (248)
45 minutes

I've long been fascinated with the compact simplicity of all-in-one computer/keyboards such as the Commodore 64. When the official Raspberry Pi keyboard was released, I knew what had to be done.

So I built a battery-powered all-in-one Raspberry Pi computer inside an official Raspberry Pi keyboard (well, I guess it isn't technically an all-in-one since it doesn't have a built-in monitor). In addition to a battery, I added a power LED and button so I'll know when the Pi was on and can safely turn it on and off.

The official Raspberry Pi mouse connects directly to the keyboard, giving you a super compact setup with a small footprint. Finally, the keyboard connects to the Pi externally via a small cable; this way, you can still use the keyboard with other computers as a normal keyboard!

I know there isn't much of a point in adding a battery since you still need to connect an HDMI cable -- but I still find it useful since I log into my Pi remotely all the time. Also, it's more fun this way and if you add a portable monitor... :)

In this guide, I'll show you step-by-step how to build your own. Let's get started!

Note: This project [might] involve soldering

Most of this project can be done without any soldering. The battery, power button, and status LED require soldering but are all optional. If you don't know how to solder or don't feel like busting out the ol' soldering iron, you can still put a Pi Zero in your keyboard.

If you want to pick up a soldering iron, check out our guide on the best soldering irons for different tasks.

Raspberry Pi 400

Recently (about a year after I created this project), the Raspberry Pi Foundation released their own version called the Raspberry Pi 400. The official product provides much of the same functionality as mine, but without all the work. One big difference is the Raspberry Pi 400 uses the Raspberry Pi 4, but mine uses the Raspberry Zero—both of which have their pros and cons. Let's call mine the Raspberry Pi 000. ;) Either way, it's worth checking out the official product as well. See our Raspberry Pi 400 review and teardown video to learn more:

Watch the video:

Official Raspberry Pi keyboardOfficial Raspberry Pi keyboard ×1
Official Raspberry Pi mouseOfficial Raspberry Pi mouse ×1
Raspberry Pi Zero WRaspberry Pi Zero W ×1
Adafruit Powerboost 1000CAdafruit Powerboost 1000C ×1
Adafruit Lithium-Polymer battery, 2000mAhAdafruit Lithium-Polymer battery, 2000mAh ×1
Short micro USB male to male cableShort micro USB male to male cable ×1
Soldering IronSoldering Iron ×1

Howchoo is reader-supported. As an Amazon Associate, we may earn a small affiliate commission at no cost to you when you buy through our links.

My modified official Raspberry Pi keyboard's rear ports
I chose a blue LED to make it really stand out, but you can use any color you wish.
Prying open the Pi keyboard housing

The back keyboard cover is secured using small plastic "snaps" around its perimeter.

Using a small plastic prying tool (like the type you use to open cellphones), carefully separate the housing at one of these clips.

Then, slide your tool all the way around to release the rest.

Official Raspberry Pi keyboard ribbon cable and port

There are two ribbon cables connecting the front and back of the keyboards. We'll need to remove these.

Gently flip open the two halves of the keyboard so that you can access the keyboard's innards. Remove the three small screws from the black plastic keyboard electronics cover. Then, set the cover aside.

For clear the multi-pin ribbon cable, carefully slide the ribbon cable connector retention tab using a small flathead screwdriver. This will release the ribbon cable.

The other ribbon cable is actually just a grounding strip -- for this one, simply remove the tape from the keyboard key side.

Official Raspberry Pi keyboard disassembled

Here you can see the two halves of the keyboard. The keyboard PCB can be removed by depressing two small tabs that secure it in place.

A box cutter cutting pieces from the Raspberry Pi keyboard

Use a box cutter, Dremel, or wire cutters to remove the cross-hatch support material adjacent to the PCB section. This is where all of our electronics will go.

Custom holes drilled in the Raspberry Pi keyboard

I wanted to add this blue power LED that will illuminate when the Pi is on. I also wanted to add a power button that will safely turn the Pi on and off. These are optional for your project, of course, but I think they add a lot of functionality. :)

On the left-hand side of the case (when using the keyboard), drill two small holes for the power LED and button. The size of these holes will vary based on the size of your LED and button. I drilled a 3mm hole for my 3mm LED and a 5mm hole for my tiny power button.

A Raspberry Pi Zero with foam tape

Later, we'll secure the Pi in place using foam tape. You can use hot glue if you wish, but I find foam tape is easier to remove later if need be.

Secure a piece of foam tape to the Pi but leave the backing in place.

Holes cut for the Pi Zero ports

Next, we'll need to cut some holes into the back of the keyboard for the Pi Zero ports.

If you're adding a battery to your keyboard like I am, you only need to cut holes for the mini HDMI port and micro USB data port. We won't need a hole for the micro USB power port since the power input lives on the charging circuit for the battery (more on that later).

If you aren't adding a battery, also be sure to cut a hole for the micro USB power port.

Marking the holes

To mark the holes, line the Pi up inside the back of the case and use a sharp permanent marker to mark the top and length of each port.

Cutting the holes

This can be done using a drill or Dremel. I found the easiest way to cut the holes is to drill holes at the end of each "port opening" using a super small drill bit. You can then drill additional holes along the length of the port, and then remove excess material using a Dremel or box cutter.

Cutting a hole for the PowerBoost 1000C port

The PowerBoost 1000C circuit board increases our battery's 3.3V to the 5V needed by the Pi, while also charging the battery and adding safety circuitry. If you plan on adding battery power to your keyboard to make it totally portable, this is necessary!

Add a piece of foam tape to the back of the PowerBoost, mark a hole for its USB port, and cut the hole.

If you aren't putting a battery into your keyboard, skip this step and instead cut a hole for the Pi Zero's micro USB power port.

Raspberry Pi keyboard custom power button circuit

Next, we'll need to solder the power button to the Pi's GPIO header.

Using a few lengths of wire, solder the power button circuit per the instructions in our Pi power button guide. That guide also includes instructions on a few scripts you'll need to run for the power button to work. You can add those scripts at the end.

The completed power status LED circuit

Next, we'll need to create the power LED circuit. I wrote a separate guide on adding a power LED to the Pi; use that guide to get it up and running!

The PowerBoost 1000C and LiPo battery powering the Pi and keyboard circuitry.
This photo shows the PowerBoost 1000C and Li-Po battery powering the Pi and keyboard circuitry.

Powering from the outside

If you aren't putting a battery in your keyboard, skip this step -- your Pi will be powered directly via USB from the outside (by connecting a power cable to the Pi's power port).

Powering from the inside

You can also derive power by soldering the Pi's 5V/GND pins on the Pi's GPIO header directly to the power pins of one of the keyboard's full-sized USB ports (more information on GPIO below).

Powering via battery

If you are putting a battery in your keyboard, you'll need a way to get power from the PowerBoost/battery to the Pi. Normally, the PowerBoost feeds power to the Pi via USB. However, I wanted to avoid running additional cables outside the Pi. Therefore, we'll power the Pi using its GPIO header.

It is hotly debated whether it's safe to power a Pi by connecting power to its expansion header. The header doesn't have the same protection circuitry as the Pi's power port; thus, supplying far too much current (or incorrect voltage) could theoretically damage the Pi.

Nonetheless, the Pi Zero W is only $10, so this is a calculated risk I'm willing to take. :) As long as you don't use an incorrect power supply or do anything else odd, your Pi will be fine.

Solder your connections as follows:

Pi 5V (pin 2) => PowerBoost 5V
Pi GND (pin 6) => PowerBoost G or GND

If you aren't sure which pin is which, Pinout.xyz can help you identify your pins.

Showing the keyboard's custom mounted power button and status LED
Here you can see the mounted power button, status LED, and Raspberry Pi Zero W.

We're almost done!

Remove the foam tape backing and secure the Pi and PowerBoost in place.

Then, secure your power button. My power button uses a threaded nut, but yours might need to be glued into place.

Finally, use hot or super glue to secure the LED in place.

The keyboard's internals, showing battery placement

I'm using a 2000mAh Lithium-Polymer (LiPo) battery from Adafruit. This battery should run the Pi and keyboard for at least 4 hours. When a power supply is connected to the PowerBoost, it will use that instead while it simultaneously charges the battery.

Connect the battery's JST connector to the PowerBoost. As soon as the battery is connected the Pi will boot; so be extra careful not to short anything.

I placed the battery sort of between the PowerBoost and Pi. The battery will stay in place since it's a tight fit.

Showing the optional external data cable connection
Here you can see the optional external keyboard connection; you can use a much shorter cable.

You'll need this small male-male micro USB cable to act as a jumper cable and connect the Pi's data port to the keyboard's micro USB port. I opted for this approach so that the keyboard could still be used with other Pis.

So if you wanted to use the keyboard as a normal keyboard, you could just disconnect the cable from the keyboard's micro USB port and connect another computer there instead. This is especially handy if you're working on a Pi project that needs GPIO access.

Advanced: Avoiding the external "jumper" cable

It's possible to avoid the external cable entirely by soldering directly to the keyboard's micro USB port. Since the micro USB port's pins are so small, you'll want to solder to the traces instead.

To do this, locate the data PCB traces coming from the keyboard's micro USB port, carefully scrape away a bit of the trace's protection layer, and solder small wires that connect to the Pi's data micro USB port (either with a cable or via trace soldering).

Snapping the Pi keyboard halves back together

Make sure no parts of your new circuitry are touching the top of the case; if they are, use a bit of Kapton tape to prevent them from shorting against the case.

Reattach the black plastic cover using its three screws.

Then, Reconnect the keyboard ribbon cable and grounding strap.

Finally, snap the case back together.

All-in-one Raspberry Pi keyboard printed port labels

I recommend labeling your USB ports so that you (and others) know what each port does. I used a label maker and put the labels on the bottom for extra cleanness.

Raspberry Pi all-in-one keyboard with cables connected
Here's the keyboard as I currently use it, with all cables connected.

The LED is shining, the power button turns the Pi on and off, and you can disconnect the cables for a battery-powered Pi on the go.

In the future, I'd love to create a version that has GPIO access and perhaps also add a micro SD card extension for external card accessibility.

Let me know what you think!

Questions? Ideas? Post in the comments section below. I'd love to hear from you!

New official Raspberry Pi hardware!
Ash Ash (362)

Earlier today, Eben Upton (founder and CEO of Raspberry Pi Ltd) updated the official Raspberry Pi blog to announce the new Raspberry Pi 400.