Add a Serial/UART breakout to your Raspberry Pi

Before we begin

We're about to permenantly modify your Pi and its case, before diving into this make sure you're prepared to take each step slowly and carefully. This is not the sort of hack you want to rush!

Clear your work area, and make sure you've got all the necessary items to hand:

  • A Rev 2 B, A+ or B+ Raspberry Pi
  • A 4-pin male length of strip header
  • A good soldering iron
  • Some solder

To make this easier, you're going to need a few extra supplies:

  • Micro cutting pliers - these will cut through a PiBow layer if you're determined enough
  • A craft knife - ideal for marking where you'll cut the PiBow
  • Blue-tac - absolutely essential for holding the strip-header in place while you solder

The idea

Flip your Pi over ( you have it to hand, right? If not, GOTO 0! ) and take a look at the underside of the header pins. With the header on the top left, you should locate the second pin down on the outermost row. This is the second 5v pin on the Pi, right below it there's a conveniently placed Ground, and then serial TX and RX pins ( also known as GPIO 14 and 15 ). These pins are conveniently placed in a row, and rife for a hack.

Model A+ PiBow Header

These are the pins we want to solder the 4 pin strip header to. If you pick that header up you should be able to place it alongside these pins, so it sits cozily next to them ( with the strip header pins above the Pi pins ) and the black plastic holding all the pins together just overhangs the edge of your Pi. It just so happens that a header placed carefully in this spot will perfectly line up with Layer 2 of a Model A+ or B+ PiBow.

This is great for two reasons;

  • It's really easy to cut a hole in this one layer and plug a UART cable right in through the case
  • The two layers sandwich the black plastic of the header and keep it from wiggling too much and damaging the Pi

The one downside of cutting layer 2 here is that it leaves a small portion of the layer completely unconnected in the A+ and B+ Coupe/PiBow. This isn't as bad as it sounds, since the edge of the Raspberry Pi serves to keep this loose, right-angled piece in place, and it has a nylon bolt through it too!

Step 1: Solder on the header

With your Pi removed from its case, soldering tools at the ready, and a 4-pin male header in hand let's get started.

The first thing you should do is secure your Pi to your work area. You can use helping hands here, but I find them a little awkward to pose accurately enough to get the header in the right position. I recommend sticking the Pi to your bench with blue-tack.

Once you've done this, it's time for the tricky part. Build a litte mound of blue-tack up next to your Pi where the 4-pin header is going to go. You basically want it to be tall enough to support the header and align it perfectly, butted up against the top edge of the underside of the Pi GPIO pins, and with the black plastic shroud hanging over the edge of the board. Take your time with positioning and get it lined up perfectly.

Model A+ PiBow Header

Once you're happy with the placement, you need to solder just one pin of the header. Pick a pin at either end, and place your iron right on top of the strip header pin, making sure it also touches the Pi header. After a couple of seconds, touch it gently with the end of your solder and it should melt and flow between the two pins. Continue to heat for another second or so until the new solder blobs seemlessly into the solder already on the Pi. You're going for a cone-shaped joint if you can manage it, but don't worry too much if you just end up with an untidy blob- it'll still be electrically sound.

Put your iron back in its holder, pick up your Pi ( taking care with the blue-tack ) and make sure the header is still perfectly aligned. If it's not, then heat with the soldering iron and carefully move it into position. With the Pi on your workbench you should have one hand free to position the header, and another to heat the joint. We couldn't do this in the first place, since you'd need a third hand to feed in the solder.

With the header perfectly aligned, and flush with the edge of your Pi, solder the remaining joints the same way as the first one, sit back and admire your handywork!

Step 2: Cutting layer 2 of your PiBow

When it comes to cutting holes in a brand new PiBow, you could be forgiven for hesitating. Don't worry, it's easy enough to accomplish with a pair of cutting pliers, a craft-knife and some careful measuring. The best way to make sure you cut in the right place ( and I actually failed slightly at this part ) is to assemble the bottom half of your PiBow up to layer 2 and drop your Pi, with its new side-header, into position. The Pi obviously won't fit, but the position of the header will show you where you need to cut.

Take a knife and carefully mark each side, using the black plastic shroud as a guide. Once marked, grab your cutting pliers and start to cut the layer. You'll find it puts up a fair bit of resistance, so squeeze firmly and consistently but don't get carried away. The plastic will fracture and snip eventually without too much force. Once you've clipped the section out, immediately try the layer to see how well it fits, and trim carefully with the knife if you need to.

Step 3: Put it all together

Put your PiBow back together around your freshly modded Raspberry Pi, the 4 UART pins should poke out with enough clearance around them to attach the UART cable. Thanks to the 5V marking on top of the PiBow Coupé, you should be able to identify which UART connection goes where quite quickly. On my cable, which has a red, black, white and green wire, it connects up in that order- red = 5V, black = Ground, white = TX and green = RX. Always be careful when connecting up, since reversing the 5V and Ground could easily damage your Pi!

Tips And Tricks

Once you've got a UART/Serial cable connected to your Pi, debugging and WiFi configuration will always be one USB plug-n-play away. However there are some handy tricks worth knowing to get the best out of the cable.

First, you can either connect your Pi to another power supply through its main Micro USB port, or even unplug it from power, while using the Serial cable. This is great if you start using your Pi on the go, and want to plug it in and disconnect your laptop. It's also great if your Pi is tied to a wall socket; you can plug in the Serial cable, unplug the mains power supply, and go mobile in an instant.

Second, there's no limit to the USB devices you can use as a power supply, or indeed any stable supply of 5V applied to these pins will run the Pi. If you want to build a battery compartment, and use a decent 5v regulator, you can use the Power/Ground pins you've just hacked onto your Pi. This means you can get that power to the right place without having to hack a USB cable or tie up your precious header, which would normally stop you from installing a HAT.

Again, on battery you can still use the main Micro USB port to supply power- plug it in and remove your battery supply to switch seemlessly from mobile to fixed and vice versa!

Taking it one step further

It's possible to break out all of the Raspberry Pi's header by soldering an extended header underneath. I've done this with a 26-pin female header attached to the underside of my Model A+ and it's handy for tinkering with components or debugging hats. If you hack your Pi, be sure to let us know on the Pimoroni Forums.

Shopping basket

Need something for this project? You can use the links below to add products to your Pimoroni Shop basket for easy checkout.

Raspberry Pi 3 with Pibow Case
Rainbow £44.00
Raspberry Pi 3 with Pibow Case
Ninja £44.00
Raspberry Pi 3 with Pibow Case
Ninja Coupé £40.00
Raspberry Pi 3 with Pibow Case
Coupé £40.00
USB to UART serial console cable
Want to checkout or change something? Click here to view your cart.

Raspberry Pi, Serial / UART, Hacking

Phil Howard
Phil is Pimoroni's software guru, instantly recognisable by his somewhat pirate-themed moustache growing attempts. Usually found buried neck deep in Python libraries, he's also been known to escape on occasion and turn out crazy new products. If you need a helping hand, he's a prolific Twitter user and rampages around the forums like a T-Rex. Ask him if you need help with Pimoroni's software libraries, or Propeller HAT.