Building a 5-volt power supply for a Raspberry Pi

Operation Theory

AC power flows in a sine wave (Figure 8). Ground is located in the middle of the waveform. Waves above the ground line are positive voltage, and waves below are negative. The wave frequency is the number of times the waveform rises and descends relative to the ground line in one second. American mains power runs at a frequency of 60Hz, and the peak of the waves is 110V.

Figure 8: Voltage waveforms pre- and post-rectifier. Note that the rectifier output is still in waves, but they are now all in the positive direction.

The bridge rectifier is designed to "flip" the negative portion of an AC waveform to positive. The voltage coming out of a bridge rectifier is still oscillating between 0V (ground) and peak, but it never goes into the negative. A bridge is four diodes in a diamond configuration. A diode will only allow current to pass in a single direction and has an associated drop voltage. A diode fed 12V with a 1V drop will have 11V on its opposite side. The four-diode configuration is like a set of routing gates. Positive voltage is sent around one side of the diamond, and negative voltage is sent around the other side. When voltage passes through a bridge, it goes through two diodes, so it drops 2V.

If you're using a battery or other DC source to power the supply, then all of the voltage follows the same path across the bridge and emerges on the + and - leads 2V lower than it started. Because the bridge rectifier "routes" all of the voltage to be positive or negative, it doesn't matter which lead is on which input side.

The regulator does all of the heavy work. As long as the input voltage is above its minimum requirement, it will output its rated voltage. The minimum voltage for the 1934 is 8V. Because the bridge rectifier will drop 2V, the input voltage for the entire power supply needs to be at least 10V to function. For this article, I'm using a 5V regulator, but you can also get them for 12V or adjustable for custom voltages. Excess voltage gets burned up as heat, so be careful, the regulator can get hot!

Capacitors are electronic buckets. The two in this power supply serve the same purpose, but for different reasons. The first capacitor is connected to the output of the bridge rectifier. Remember that the output oscillates from zero to the peak voltage. The capacitor will smooth out the waves and provide a constant input voltage to the regulator.

On the output side of the regulator, the capacitor protects against sudden heavy loads. A capacitor can respond to changes in electrical load much faster than the regulator itself. A sudden load without a capacitor will drop the regulator voltage until it can compensate and ramp it back up. This dip is enough to cause the Pi to reboot if it's severe enough. You might have experienced this if you plug a USB device into your Pi and it suddenly reboots.


One of the advantages of this power supply is its ease of assembly. Additionally, it's possible to power your project without being tethered to an electrical outlet, or you can use an existing battery system. If your project involves mains power (or any high voltage), always take extra safety precautions.

Now that your Pi is set free, go out and create wherever strikes your fancy.

The Author

Scott is Producer and Educator at the Mayborn Science Theater on the campus of Central Texas College in Killeen, Texas. When he's not creating the next great tale of the universe or flying through the stars, he can be found playing with Lionel trains or Linux computers.

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