Thursday, 19 February 2015

Fixing bent GPIO pins on a Raspberry Pi

At my CodeClub last week, one of the Pis was dropped on the floor and unfortunately landed right on the GPIO pins, bending four of them.

Back in the distant past I had to frequently straighten out pins on a similar connector (used on a cryostat if you're interested) and became quite adept at it So I brought the Pi home and managed, quite easily to straighten out the GPIO damage. I thought I'd summarise the method I used in case it is useful to others. I imagine dropped Pis are not an unusual occurrence and it would be a shame to
leave a Pi in an unusable (for GPIO fun) state when it could easily be repaired. The GPIO pins are quite robust and will survive some fairly severe distortion. But reducing the amount of flexing to and fro when attempting a repair will improve the chances of the PI continuing to be usage into its old age.

Tips for fixing bent GPIO pins.

None of this is rocket science, but there a few things you can do to avoid further damage to your Pi.

0. First things first: Power down your Pi and disconnect from the power supply. Don't be tempted to try to repair even a small bend while the Pi is up and running.

1. Don't rush it. If the pins get damaged during a class, club session or CodeDojo, only try and bend them back if you have sufficient time and space to do it away from other distractions.

2. Use the right tools. Don't try and use your fingernails or a pen. A short, thin flat screwdriver is best. I'd also suggest avoiding the use of pliers, even radio pliers: it is all too easy to apply too much force and sheer off the pin, or squash it in the jaws.

3. If the bent pin is not touching an adjacent pin, slide the screwdriver blade down from the top and gently apply some force to push the pin back.

4. If the tip of a bent pin is in contact with an adjacent pin, slide the blade in and upwards from the side and bottom.

5. Apply gentle force to the blade while maintaining a form grip on the Pi. I've found it is much easier to do this with the Pi housed in the bottom part of its case, but this may not be possible depending on the type of enclosure that you have.

6.. If more than one row of pins have been bent, move inwards from the end of the header, un-bending each pair in turn. Don't try to make the pins perfectly straight again at this stage. Just try to separate them and get them as upright as possible.

6. Once you've got them reasonably upright, you can use a female header to try to get them as straight as possible. I had a spare separate header to hand but you could use one attached to an add-on board (e.g. a Pibrella) or a ribbon cable.

7. Slide the header down over just one row of pins and then gently push it down so that the bottom lies parallel to the Pi board. Don't push it too far and bend the pins the opposite way. Once the first pair is done, remove the header, move on and slide it along so that it covers the next row too.

8. Repeat this process, moving the header along until you've dealt with all the damaged pins.

9. Eventually you'll reach the point where you can push the header down over the entire set of GPIO pins on the Pi.

10. That should be job done. The pins may still look a little wonky under close visual inspection, but as long as a header slides down relatively smoothly, it should be good enough for government work!