Funny stuff, electricity. It’s all about the volts and the amps, and controlling these two factors. Most of the time, the electricity coming into your device is at a higher voltage than you need, so you have to convert it down to something more usable. The easiest way to do this is with a transformer.
The transformer in your power supply takes a high voltage from the mains and converts it down into a lower voltage to power your gadgets. You’ll find one in all power supplies, from the miniature USB version that powers your cell phone to the big ones hanging on a telephone pole that drive your home’s mains electricity. Although these transformers are different sizes, they share the same fundamental design.
The basic transformer is two coils of wire wrapped around a metal core. An alternating current is applied to one of these coils (called the primary), which creates a magnetic field in the metal core. This magnetic field, in turn, creates a current in the second coil, called the secondary. The relationship of these two currents is the important thing, and that is defined by the ratio of the length of each of the coils, usually defined as the number of turns that each coil makes. If the two coils have the same number of turns, the current going into the primary and out of the secondary coil will be almost identical. If the secondary coil has twice as many turns, the voltage will be almost doubled. If the secondary coil has half as many turns, the voltage will be almost halved. This helps to explain the naming used by transformers: step up and step down. The step up type creates a higher voltage (such as the one used in this Jacobs ladder), while the step down type reduces the voltage.
For a transformer to function, alternating current (AC) must be used. AC produces a changing magnetic field (called the flux) which induces a current in the secondary coil. If there is no changing magnetic field, there will be no induced current. If you need a DC output, the sequence in a power supply will start with a transformer to step down the AC from the wall socket to a lower level, then this lower voltage AC will be converted into the DC that is output by the power supply.
There are lots of factors that affect how transformers work. These include what the core is made of: the metal affects how the magnetic field flows. Some of the energy in the magnetic field also inevitably gets lost before it creates the current in the secondary coil, called an eddy current loss.
All of these affect how the transformer performs, so most transformers are custom designed for the specific purpose in mind. Transformer design is a complicated art that requires a lot of factors to be taken into consideration. A good start is a design guide like this one from Wurth, who make transformer components and kits.
There are also several different types of transformers, including flyback types used in high-voltage designs, like Cathode Ray Tubes (CRT), toroidal types that contain the magnetic field, autotransformers that can handle different input voltages while still producing a fixed output voltage, aircore transformers, which have no metal core and are smaller, and pizeo transformers, which use a pizeoelectric element to detect physical force.
You don’t need a kit to experiment with transformers, though. A transformer can be as simple as a couple of bits of wire wrapped around a few pieces of steel, or two pieces of wire wrapped around a metal ring, so it is easy to experiment on your own.