Basic 5V Power Supply
The first part of any electronics project is a power supply. Some projects use the USB port on your computer while others use a cheap wall adapter. Some are battery powered, and others are solar. With all these different options, how does one power their electronics project? Let us show you how to power your projects!
It’s pretty simple; first, I want to explain what a power supply does, and then I will show you how to build one.
We will start with a battery, and work our way up to a wall adapter. A power supply is responsible for providing a circuit with all the power it will need during normal operation. It provides the circuit with a certain voltage and current.
The best way to think of this would be to imagine a hose with water running through it. The pressure of the water at the end of the hose is the voltage, and the amount of water going through the hose is the current. Most electronics need a certain amount of voltage and current to function. For the sake of this tutorial, lets make that about 5V and let's save the current for later. For proper operation, we need to find a way to convert the voltage of our main supply (battery or wall adapter) down to 5V.
This is where a regulator comes in. A regulator is a device that will convert the unregulated voltage to a stable 5V that we need to power our project. It's job is to maintain a steady 5V regardless of what our battery is doing. The only caveat of a standard voltage regulator is that the main supply has to be slightly higher than what we want to achieve. So if we want 5V, we need at least 7V to maintain the steady 5V that we want. This power supply will not be able to convert from lower volts to 5V. So once our battery is dead, our project will be too.
For this tutorial, we will use a LM7805 (a linear voltage regulator) for our power supply. Before we begin, we need to quickly skim over the datasheet, and get familiar with the recommended operating conditions. You can see on page 3, that the input voltage has to be between 7V and 25V. It has an output voltage of 5V, and can supply up to 750mA at short circuit. This means that your circuit cannot draw more than 750mA, or the regulator will shutdown. Most datasheets also have a general application information. You can see on page 7 what the typical application circuit should look like.
What we are going to do is build this power supply with a couple of simple changes. This regulator needs a 0.33uF capacitor on the input side, and a 0.1uF capacitor on the output side. The capacitors help filter the input and output from noise created by the power supply, and/or the load (i.e your project). We will add larger capacitors on both sides to help keep our power supply clean and noise free. Secondly, there is no way of knowing if our power supply is working, so we will add a little LED as our power indicator.
Here is our revised circuit. We have 4 capacitors instead of 2, and have added our power indicating red LED with a current limiting resistor, which is required for the LED, so it doesn't burn up. If you are wondering where the magic 330Ω resistor value came from, it's a simple application of the V = IR equation. First we get the voltage drop and current requirements for our LED here. It has a voltage drop of about 3V, and draws 20mA at maximum brightness.
With the quick calculation above, you can see that for maximum brightness of our red LED, we need a resistor of 100Ω. Since I don't really care about maximum brightness, I'd rather have a dimmer LED and save my battery; so I decided to use a 330Ω resistor instead, which will still give me plenty of brightness and increase my battery life.
Ok, so now that we have that down, lets get to building! Here are all the parts we will use for this tutorial. In the picture you can see the LM7805 3 pin voltage regulator, two black 10uF capacitors, two blue 0.1uf capacitors, one LED (clear lens with two legs), one 330Ω resistor (the part with the orange colored rings), and a breadboard (the white board with holes). Finally we have a 9V battery, and a connector. I have soldered some headers to the end to make it easy to insert into a breadboard.
Let's start with the breadboard. A breadboard is a great tool to help you prototype a circuit before ever having to make a PCB. It has preconnected rows and columns, which allow you to push electronic components into them to create your circuit. The next image shows which of the pins are usually connected together (not all breadboards are exactly the same!).
Inside the breadboard are specially made metal bars and rails. When a component is placed on a breadboard, these bars hold the component in place and allow you to electrically connect any other component to it using the same bar. Still not sure what to do with it? Lets start by placing the battery connector and regulator on the breadboard.
Now it's time to add some wiring. We will use some of our precut jumper wires to start making the circuit on breadboard. From the datasheet, we know that the pin on the far left of the regulator is the input, and the far right is the output. The middle is the 0V of our battery (we will call it ground for this tutorial). So to connect the input of the regulator to the battery, we will place a wire between pin 1 and 5, and one between 2 and 6.
Next we will connect the rails to the output of the regulator. This will allow us to connect 5V to any part later.
The main connections are complete. Now to add the filtering capacitors. Some capacitors are polarized and some are not. The 10uf caps we are using are polarized, so we will need to be careful and place them in the circuit with the proper direction. The white stripe on our capacitors shows the negative side of the capacitors and needs to be connected to the negative parts of the circuit.
The next two pictures show both capacitors being added to the circuit. I had to trim the length of one of the pins for it to fit into the breadboard. Usually one pin is always longer than the other to show polarity. The input capacitors are on the top, and the output capacitors are on the bottom.
Here are the output capacitors again. Note the white stripe being connected to the ground line. I am using the blue rail as the negative side of my battery.
Next are two 0.1uf capacitors (tiny blue ones in the picture). These are not polarized so we can put them anyway we would like.
For clarity, here is a close up of the second one.
The regulator circuit is pretty much complete. Let's add the power LED so we know when it's turned on.
For a power light, we simply need to power the LED with the 5V being regulated by our circuit. Here we have connect pin 21 to 5V and pin 22 to ground. Now we just need to add the LED and the resistor to protect the LED. LEDs do have a polarity. The LED has an anode and cathode. The anode is connected to the + side and the cathode is connected to the - side. If the LED is placed in reverse, it will not turn on.
The picture above is of our standard 5mm red LED. You can see in the picture that one leg of the LED is longer than the other. This is our anode and should be connected to the positive side of the power supply. The short pin is the cathode and should be connected to the negative side.
Here we have connected the LED's cathode to the negative side of the battery. All that's left is the resistor from the anode to the positive 5V rail to turn the LED on.
That's it! Let's plug in the battery and see if our LED turns on.
And there you have it, it works! I know, you can hardly see the red LED. That's because of our camera flash, trust me, its on and pretty bright.
But wait a minute. Just because the LED is on that doesn't mean we are getting our desired 5V, right? It would be a wise decision to hook up a multimeter and check the output before you connect anything to this supply. How do we do that? I am glad you asked.
Let us start by checking the battery voltage.
To measure voltage with a multimeter, you need to connect the multimeter in parallel with the circuit. So what we did above is added a pair of jumper wires to the breadboard. The red one is connected to pin 1 which is the same pin as our positive side of the battery. The second one is connected to our blue rail which is connected to the negative side of the battery. Now we can connect a multimeter set to voltage mode to our jumper wires and measure the voltage of the fresh 9V battery.
And here is the multimeter reading the battery voltage. Be sure your multimeter is set to DC voltage mode and the red probe is connected to the correct terminal.
There you go, our brand new 9V battery is providing our circuit with 9.37V! This would likely go down to being closer to 9.0V once we apply some real load on the circuit.
Next lets measure the output of our regulator. We will move the red jumper wire to the red rail, which is connected to the output of the regulator.
And finally, here is the output of the circuit.
We are getting 4.96V! This is well within the specs of our regulator and our circuit is working great. Now we are ready to power our project with up to 750mA of power!
The regulator will happily power your project up to 750mA, but be careful. The metal tab of the regulator is meant to be connected to a heat sink. If you plan on using this circuit or any other voltage regulator circuit to its max current specs, be sure to use a heat sink and a fan to cool down the component.
I hope you have enjoyed this lesson.
Let us know if you have any questions on our forum or you can contact us.
This article was published by the Jaycon team. Learn more about how we can take your product design and hardware idea to the next level here.