There are more efficient and complex power supplies in the world. There are easier ways to get a simple power supply like this one (re-using a wall-wart, for instance). But if you make a power supply like this at least once in your life, you will have a much better understanding of how alternating current becomes regulated DC power. There will be many other power supplies like it, but this one will be yours.
A power supply, as we'll be referring to it here, converts alternating current from the outlet on the wall into direct current. There are several ways to do this. We are going to look at one of the simplest, but also most illustrative.
Electricity passes through several stages in a voltage regulator type power supply like this one, or like the common wall-wart. The ways in which it is altered by each stage are explained below. The next time you use a wall-wart to power one of your projects, you will understand what is happening inside.
AC Input: Coming from the wall, the AC alternates from a minimum to a maximum voltage at a frequency of 60Hz (in the US and other 60Hz countries). That is what powers all of the AC appliances in your house and shop, and it looks like the following graph. After the transformer, the graph is similar, except the sine wave has a smaller amplitude.
Rectification: The first stage of this power supply is a rectifier. The rectifier is an arrangement of diodes that only allows current to flow in one direction. Think of a one way check valve for water. Because of the arrangement of diodes in the full wave rectifier used in this design, the positive part of the AC signal passes unimpeded and the negative part of the AC signal is actually inverted and added back into the output signal from the rectifier. Now our signal looks like this:
Smoothing: Now we have at least consistently positive voltage levels, but they still dip down to zero 120 times per second. A large capacitor, which can be thought of like a battery over very short time periods, is installed across the circuit to even out these rapid fluctuations in power. The capacitor charges when the voltage is high and discharges as the voltage is low. With the help of the capacitor, the voltage curve looks like this:
Regulation: At this point, we use an integrated circuit to consistently regulate the voltage to exactly the desired level. It is important in sizing the components for all of the previous stages to drive this IC with a voltage level sufficiently higher than the regulated voltage such that the remaining dips 120 times per second will not drop below the required minimum input value. However, you do not want to drive it with too high a voltage, as that excess power will be dissipated as heat. The voltage curve at this point is (ideally) a DC signal at the desired voltage; a horizontal line.
To build this specific power supply, you will need the following.
The construction of the power supply is quite simple. I built this power supply many years ago and used point to point wiring on a perf board to build it. There are many cleaner ways to build it than this, and I encourage you to pursue one of them. However, this works just fine as is. In building this power supply, it would be wise to attach a heat sink of some kind to the 78xx voltage regulators. This design can quite easily be modified to provide an adjustable voltage output by using a LM317 voltage regulator in place of or in addition to the voltage regulators specified. By grounding the center tap of the transformer secondary (assuming you have a transformer with a center tap), taking positive and negative leads from the bridge rectifier, and using the LM79xx and/or LM337 series of negative voltage regulators, your power supply can supply regulated negative voltages as well.
The finished product looks like this: