I have built many circuits in my life, but this is actually the first time I’ve built a power supply circuit from scratch.
The final project I want to build is a wall adapter with a USB socket to charge my iPhone. But first I wanted to start by creating a simple circuit that converts from the main power voltage, 220V or 110V, to 5V.
As I’m in Australia while writing this, and the voltage here is 220V, I built this with 220V in mind. But it’s very easy to convert to 110V instead by switching one connection (or one component).
Caution: Do NOT connect anything you make yourself to the power mains if you are not 100% sure about what you are doing. Doing it wrong can cause serious damage, even death. Use the information provided here at your own risk.
I want to base the power supply around the LM7805 voltage regulator because it’s an easy-to-find chip that is simple to use. This component will give a stable output voltage of 5V up to 1.5 A.
I can easily figure out how to use the LM7805 by looking in its datasheet.
From the datasheet I found this little circuit:
The above image shows the voltage regulator with a 0.33 µF capacitor on the input and a 0.1 µF on the output. It’s hard to find a good source of info on these capacitor values, but according to this Q&A there’s nothing magically about these values.
There are a lot of opinions on the web around these capacitors. Some suggest 0.1 µF capacitors, others suggest 100 µF capacitors. And some suggest using both a 0.1 µF and a 100 µF in parallel.
The values you should use depends on a lot of factors. For example how long the wires are going to be. But this article is about how to build a simple power supply circuit, so let’s not complicate things. Probably, almost any capacitor value will work. It will probably even work without capacitors.
For the sake of making the output voltage “a little bit stable”, I’m going to use a 1 µF capacitor on the output. I’ll skip the input capacitor, because there will be a capacitor in this position anyway – just keep reading.
The datasheet also says that it needs between 7V and 25V to work correctly. So, I only need to add a few components that convert 220V (or 110V) AC to a DC voltage that stays between 7V and 25V.
This is relatively easy. I’ll just add a transformer that transforms the voltage down to for example around 12V. Then I’ll feed this AC voltage into a bridge rectifier to rectify it.
And I’ll use a large capacitor on the output to keep the voltage above the necessary 7V at all times. This capacitor value isn’t critical. I’ve seen many designs that use 470 or 1000 µF, so I’ll try with 470 µF for now.
So, the final circuit looks like this:
|T1||220V (or 110V) to 12V||Transformer|
|DB1||Diode Bridge Rectifier|
|C1||470 µF (20V and upwards)||Capacitor|
|C2||1 µF (10V and upwards)||Capacitor|
The total cost of the components is about $12-15. The most expensive component is the transformer (about $10).
When I’m not sure how to choose components for a circuit, I usually go to online electronics stores for hobbyists and look at their options. These stores usually stock components that should work in a standard power supply without any special requirements.
In Australia, Jaycar is a nice option.
A quick search on “transformer” on Jaycar gives me several options. The input voltage needs to be around 220V and the output around 12V. After a quick scan of their options and prices, I decided on this one:
The transformer has a center tap on the output side which I can ignore.
This one is for 220V. If you live in a country with 110V the stores in your country will probably have the correct version for you.
Then I need a rectifier. We can use 4 power diodes (ex 1N4007), or a bridge rectifier (which is basically four diodes built into one component). The cheapest option that pops up when searching for a bridge rectifier on Jaycar is this one:
This is an easy circuit to solder onto a prototyping board. Here’s the prototype I built:
Reminder: Do not connect anything you build yourself to the power mains unless you are 100% sure about what you are doing. Use the information provided here at your own risk.