Firstly, and it is with great sadness that I have to tell you this, but in electronics terms the transformer is not a robot in disguise. -probably would be a lot more popular hobby if it were!!
The transformer is a device the takes alternating current electricity and transforms it, usually either increasing, or decreasing the voltage (and current), but transistors may also be used for impedance matching, (where the primary coil may have one impedance, and the secondary coil has a different impedance, but otherwise the electrical signal is largly unchanged.)
Transformers are basically large coils of wire wrapped around a piece of iron.
As the alternating current enters the primary coil the iron core is magnetised, when the AC current changes direction the electronic field collapses and a new field is created with an opposite polarity inside the iron core.
Move over to the secondary coil and we see a coil of wire wrapped around a piece of iron that has a moving magnetic field, it's kind of like a little generator that contains no moving parts.
(no electricity is generated, you can't get free energy from this thing!)
The creating, collapse and creation and colapse of magnetic fields induced a voltage and current in the secondary coil...
Probably the most useful aspect of transformers is their ability to change the voltage.
If you look at the voltage coming into your house it's likely to be 240 volts, or 110 volts. but your average electronics project needs say 12 volts.
to get this ten volts the voltage needs to be stepped down.
To do this we use a step down transformer, in this case we have 240volts and we want 12 volts
In this situation we need a step down transformer with 1 winding on the secondary core for every 20 windings on the primary.
The transformer needs to be 20:1
In the same way as we can step down voltage we can also step up voltage using a transformer.
We use wire the transformer backwards.
if we generate 240 volts and have a 200:1 transformer we end up with 480,000
Power stays the same
We can get more power out of a transformer than we put into a transformer.
We do get slightly less power out of a transformer than we put into it, (due to the creation of eddy currents in the iron core of the transistor that work to heat it up slightly)
We know that power = voltage x current
So if we have 10 watts going into a transformer we have 10 watts coming out
This means that as voltage is stepped down, current is stepped up, and as voltage is stepped up, current is stepped down. -current causes heating in the wires so stepping up the voltage to tens or hundreds of thousands of volts allows the current to be as small as possible, and in long power lines that also means that the power lost due to the heating of wires is also as small as possible.
Our 10 watts of power is made up like this
10Watts @ 240Volts is 0.041Amps
When we step that 240 volts down to 12 volts we decrease the voltage by a factor of 20, so the current increases by a factor of 20 also
10Watts @ 12Volts is 0.83 Amps
The circuit symbol for a transformer is indicitive of it's construction.
there is a picture of a coil of wire, some straight lines representing the iron core, then some more coils for the secondary coil, there will usually be a legend next to the circuit symbol indicating the winding configuration e.g 20:1