When I build a circuit on a breadboard, the first problem I always have is to create the 5V that will power the components. Of course there are a lot of pre-made power-supplies that you fit perfectly on the power rails of the breadboard, but I wanted something that I built myself and I can use with all my circuits. In this article I will present the power supply I came up with, as well as a step by step guide to re-creating the circuit.
First of all, yes, there are easier options, like this pre-made breadboard power supply. But if like me, you like to build things from scratch, and to understand things you create, then you’ll probably want to dig deeper and assemble your own power supply. The price will be equivalent to this pre-made one, but you’ll get the satisfaction of a DIY circuit.
Note that we’ll be creating a 5V power supply. You can use this guide to create any voltage you need, only the regulator will be different, but the process is the same.
If you like this Instructable, feel free to visit The Embedded Lab for more Embedded Systems tutorials!
Step 1: List of Components
- A 9V wall adapter, with a jack barrel output. It will safely transform the high AC voltage from our wall outlet, to a 9V DC voltage that we will use. You can use an adapter that outputs a different voltage, as long as it’s between 7V and 35V. For safety reasons, I would recommend avoiding the cheap ones, as they may not protect you against short-circuits or other error of manipulation.
- One LM7805: This is a voltage regulator that takes a DC voltage from 7V to 35V, and outputs a stable DC voltage of 5V. It is a linear regulator, which basically means the voltage is dropped as a thermal loss, inducing overheating in case we work with a “high” output current. It will not be a problem if we stay under 500mA, as the energy loss will not be enough to produce excessive heat.
- One breadboard jack barrel: to connect the wall adapter to our circuit.
- 0.33uF and 0.1uF ceramic capacitors: one of each to decouple the input and output of the LM7805.
- One 500mA fuse (optional): to protect the source from short-circuits.
- A LED and a 330ohm resistor (optional): to know if the power supply is on or off.
And of course, a breadboard and some wires. I used a tiny 170 points breadboard, its size is perfect for it, and building the circuit on a separate breadboard will allow us to use it with any circuit in the future.
Step 2: The Jack Barrel
The jack barrel we use has 3 pins, and it can be tricky to find out which one is which. On the pictures, the pins are:
- Left pin: GND
- Middle pin: unused
- Right pin: 9V (or the output voltage of your wall adapter)
Step 3: Wiring the Regulator
The LM7805 is a 3-pin device, which will transform a 7V-35V DC input voltage into a stable 5V DC voltage. Having a stable supply voltage is essential for microcontrollers and other integrated circuits, as a variation can cause erratic behaviors. The LM7805 can output up to 1.5A, but it produces a lot of heat at higher currents. For this reason, it’s best to add a heat sink if you use it to output more than 500mA. We will stay way under this number in this tutorial, so we don’t have to worry about it.
As shown on the datasheet, the 3 pins are:
- Input: 7V to 35V DC
- Output: 5V DC
Take a look at the picture of the actual component to locate the pins. If you look at the regulator and can see the name of it, then you have pins 1, 2 and 3 from left to right.
Now let’s add the two capacitors. We’ll connect the 0.33uF capacitor between the Input and Ground, and the 0.1uF capacitor between the Output and Ground. The schematic attached shows this circuit.
And we’re done! This is all we need to have a power supply we can use to power a microcontroller or other components.
Step 4: Testing the Voltages
Before connecting anything to our power supply, let’s test it to make sure everything is wired properly. Plug the wall adapter in the jack barrel first, then in the wall. Now with a multimeter, on a DC caliber greater than 9V (or than the output voltage of your wall adapter), touch pin 1 (input) of the LM7805 with the positive test lead and pin 2 (ground) with the COM lead. It should read 9V, meaning your wall adapter works well.
Now keep the COM lead on pin 2 of the LM7805, and touch pin 3 (output) with the positive lead. It should now read 5V. Congratulations, your power supply is ready to be used!
Step 5: Add a LED to Show the State of the Power Supply
It’s always good to know whether our power supply is on of off. Sometimes it can remind you that you forgot to unplug it after you finish working on your circuits, and sometimes it tells you that the reason your circuit is not doing anything, is simply because your power supply is off.
Connect the anode of an LED to the 5V we just created, and its cathode to a free node on your breadboard. Then add a series resistor between this new node and ground. Depending on the LED you use, you may want to try different values for the resistor. With a 3mm green LED, I used a 150ohm resistor because a 330ohm one made it too dim. The circuit should look like the schematics above.
Now the LED will be ON whenever our power supply is ready, and OFF when it’s not.
Step 6: Protect Your Adapter From Short Circuits
Although a good wall adapter will have integrated protection, it’s never a bad idea to add a level of safety. Simply add a 500mA fuse in series between the positive pin of the jack barrel and pin 1 (input) of the LM7805. If for some reason your circuit draws more than 500mA, the fuse will blow and prevent any damage to the components and adapter. You can of course choose a different value for the fuse, depending on your needs.
The final circuit looks like the circuit shown on the schematics and on the breadboard above.
Step 7: Other Ideas
- Create another supply with a different output voltage. For example, if you made a 5V power supply, also create a 3.3V one. Be sure to read the datasheet of whatever regulator you’re using, as every component is used differently.
- Combine your two voltage sources into one. Put your 5V and 3.3V power supplies on a single breadboard, and offer the choice between them. You can use a switch or just wires. You can also plug one voltage to a power rail and the other to the other power rail of your breadboard.
As you can see, you can make it as simple or as complicated as you want. Explore different regulators, test different circuits, and be sure to post a comment to present what you created!
Step 8: What's Next?
Now that you have a functional power supply for your breadboard, check out The Embedded Lab to learn how to use microcontrollers, and for lots of other Embedded Systems tutorials!