Building a 5-volt power supply for a Raspberry Pi

Lead Image © Volodymyr Dmytriienko,

Batteries Not Included

Free your Raspberry Pi from the wall outlet with a mobile power supply.

The wall-wart-style power supplies that ship with Raspberry Pi starter kits are great for bench testing, development, and any application for which mains power is readily available. However, when your project needs to be portable or integrated into a project with a low-voltage design, you need to build a power supply that drives your Pi from a dedicated gel cell, an existing battery system (e.g., in a robot project), or even your car.

In this article, I show you how to build a power supply that provides 5 volts DC at up to 2 amps (see the "Materials" box). It will accept AC or DC input and easily handle 12-14V. If you want to go higher than that, you'll have to add a heat sink to the regulator. The power supply is built on an eight-position barrier strip and doesn't require any soldering.



  NTE 5319 – bridge rectifier

  NTE 1934 – 5V, 2A regulator

  33mF, 100V capacitor

  330µF, 35V capacitor

  8-position barrier strip

  6 spade lugs (10 if you are using a gel cell battery)

  3 jumper wires, at least 20 gauge




  Needle-nose pliers


The Build

To get started, break out the barrier strip and set it up horizontally (Figure 1). Fresh out of the package, the screws on the strip will be very stiff. Go ahead and use your screwdriver to loosen all of the screws now; it'll save a lot of trouble as you start to attach components.

Figure 1: Align the open barrier strip horizontally on your workbench.

Open up the two NTE parts and grab your needle-nose pliers. Start with the bridge rectifier (NTE 5319, the four-lead component) and use the pliers to bend the leads away from the center. The goal is to arrange the four leads so they line up with the first four positions on the top left of the barrier strip (Figure 2). Tighten the first three screws (left to right) but leave the fourth one loose.

Figure 2: The rectifier connects on the top left of the barrier strip. Leave the fourth screw loose, another part goes there as well in the next step.

Next, spread the leads on the regulator (NTE 1934, the three-lead component) the same way. The regulator is installed upside-down, with the left lead overlapping the last lead of the bridge rectifier in position 4 on the barrier strip and the other two leads in positions 5 and 6 (Figure 3).

Figure 3: The regulator goes on the top of the barrier strip, upside down. The left-most pin should overlap the rectifier and share position 4.

Now cut the jumper wires. I made mine about 6 inches each, but they can be shorter if you like. You need a black wire that spans five barrier strip positions, a red wire that spans five barrier strip positions, and a red wire that spans one position. Crimp spade lugs on both ends of all three wires.

Working on the bottom of the barrier strip (Figure 4), connect one end of your long red wire to position 1 (the left end). The other end of this wire goes to position 5 on the bottom of the strip, along with the positive side of the 33mF capacitor (see the box "Capacitor Safety"). The negative side of the 33mF capacitor and the black jumper wire connect to position 4. The other end of the black jumper wire and the negative side of the 330µF capacitor connect to position 8 on the barrier strip. The positive side and the short red jumper connect to position 7. The other end of the short jumper connects to position 6.

Capacitor Safety

Capacitors can be polarity sensitive and carry a large charge. Be sure to look for a strip of dashes indicating the negative side of the capacitor. These should always be connected to the ground side of your circuit.

Capacitors are very good at storing a charge for a long time – even years! The design of a capacitor lends itself to very fast delivery of its stored electricity, so they can give quite a nasty shock.

Figure 4: Adding the wires and capacitors. Be sure to look for the polarity indication!

To complete the power supply, I connected an old USB pigtail in positions 7 and 8 on top, so I have a standard socket (Figure 5). Power input is on the bottom of the strip in positions 2 and 3; you can connect AC or DC at these terminals. Clean 5V will appear at position 7 on top, with ground at position 8 on top (Figure 6).

Figure 5: The finished power supply, without a power source.
Figure 6: Connect your power source, and your power supply is complete.

Remember that this power supply cannot accept mains voltage directly. If you want to connect this power supply directly to the mains, you'll need a properly wired stepdown transformer first. Please consult an electrician if you are using the power supply in this manner.

Final Connections and Testing

If you're powering the supply with a gel cell, you'll need a set of battery leads. Cut them to whatever length you need to comfortably reach your battery, with a little extra left over, then crimp spade lugs on both ends of both wires. If you're going to power the supply from a car, cut the leads as before but only put spade lugs on one end (see the box "Special Notes for Car Installations"). Your local electronics shop will carry a cigarette lighter plug (Figure 7) that you can attach to the other end.

Special Notes for Car Installations

If this power supply is put into a car, remember that the whole chassis is "ground" (most cars use a negative ground, a few may still use positive), so it is possible to have a "short to ground" if any of the sensors or outputs connected to the Pi also connect to the chassis (either by accident or by design of the component.)

For low-voltage systems like the Pi, it's best just to run dedicated ground wires and keep everything isolated from the car frame. This may require some creative mounting of components or the power supply itself, but the lack of ground loops and spikes from the car electrical system will be well worth it!

Figure 7: Cigarette lighter power adapter (image courtesy Wikipedia CC BY-SA 3.0).

Before you connect your Raspberry Pi, it's a good idea to make sure everything is performing as you expect. Power up the supply with nothing connected to the 5V outputs. Check the output voltage with a meter to make sure you are indeed getting 5V. If the meter says -5, then the ground and power leads are reversed.

If you get 0V (or significantly greater than 5V), double-check all of the connections again. Once your meter reads 5V on the output, power down the supply, connect your Pi, and power it up again!

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content