A suitable ready-built mains power supply unit, such as those used to control model trains, will include a transformer. I wouldn't recommend building your own due to the safety considerations when dealing with mains voltages. If such a unit does not incorporate smoothing, rectification, and regulation, then you will need to build these blocks as described in part 1 of this series.
If the unit does not have a fuse or a cut-out on the output of the transformer, you will also need to add a fuse of an appropriate rating. This fuse is in addition to the mains fuse in the unit's plug and is needed to protect the low voltage winding of the transformer and any circuits you connect to it.
Although we won't be building the transformer block of our 5V regulated power supply, it is interesting to know how it works.
How Transformers Work
A transformer consists of two coils (often called 'windings') linked by an iron core, as shown in figure 1. There is no electrical connection between the coils, instead they are linked by a magnetic field created in the core.
Transformers are used to convert electricity from one voltage to another with minimal loss of power. They only work with AC (alternating current) because they require a changing magnetic field to be created in their core. Transformers can increase voltage (step-up) as well as reduce voltage (step-down).
Alternating current flowing in the primary (input) coil creates a continually changing magnetic field in the iron core. This field also passes through the secondary (output) coil and the changing strength of the magnetic field induces an alternating voltage in the secondary coil. If the secondary coil is connected to a load the induced voltage will make an induced current flow. The correct term for the induced voltage is 'induced electromotive force' which is usually abbreviated to induced e.m.f.
The iron core is laminated to prevent 'eddy currents' flowing in the core. These are currents produced by the alternating magnetic field inducing a small voltage in the core, just like that induced in the secondary coil. Eddy currents waste power by needlessly heating up the core but they are reduced to a negligible amount by laminating the iron because this increases the electrical resistance of the core without affecting its magnetic properties.
Transformers have two great advantages over other methods of changing voltage:
To learn more about the different types of transformer and how they are designed, please read the article on transformers in the Components Explained section.