We're almost at the point where we can start designing the circuit for our bench PSU. It's going to have to run off of wall power though, so we have to cover that first.
writing this was a chore. I just want to get to the fireworks factory. You are completely permitted to skip this if you already know about it
Here in the UK, the power we get out of the socket on the wall is described as 240V AC, 50Hz, with a maximum current limit of 13 Amps per device.
The AC stands for Alternating current, meaning that the electric flow is alternating - changing direction - constantly. The change happens every ten milliseconds.
That means that every 20 milliseconds it's changed directions twice. Reversed, and then reversed the reversal, facing forwards again. We call this a Cycle, and we measure the number of cycles in a second in Hertz, named after a rental car company. So 50Hz means 50 cycles a second, or 100 reversals a second.
When the electric flows towards our viewpoint, it's measured in regular numbers. When it's flowing away our viewpoint, we measure it in negative numbers.
So 240V, switching from positive to negative every 10 milliseconds. If we draw it on a graph you might totally expect it to look like this:

It doesn't. Instead it looks like this:

So "switching every 10 milliseconds" turned out to be a lie. It's not switching, it's rising and falling gradually. Even stranger, it's almost reaching 340 volts instead of 240! That's weird! What's going on?
Well, it turns out that AC Electricity is generated by moving copper wiring and magnets past each other. The easiest way we've found to do that is by spinning them.

The peaks (and negative peaks) are when the poles of the magnet are closest to the copper coils. When the voltage reads zero is when the magnets are furthest away. If the magnet is kept spinning at a constant speed we get a nice consistent rising and falling action like we see in the graph.
(Before you ask, no, you can't just leave the magnet in one position and get a constant voltage. It's not the position that makes power, but the movement. It's like you're using a spoon to scoop up magnetic field as it goes past, except not really).
That still raises the question: Why is it called 240V when it's wavering between -340 and 340?
Well, you can only use a number if you can catch one. Since the voltage is always changing, then so would the display of anything that's trying to measure it:

Maths boffins solved this problem by creating a new kind of voltage measurement just for AC power: Root Mean Square voltage.
The basic idea is that we use RMS voltage to give it a rating that's equivalent to DC. So if wall power is 240V AC, we know that it's as useful as 240V of regular direct current electricity.
The way RMS Volts are calculated is fairly complex. But the power delivered to your house is pretty standard, so we can make a bunch of assumptions and take a bunch of shortcuts. You can find the peak voltage of an AC supply using multiplication:
AC voltage * 1.414 = Peak voltage
And in reverse, we can use the peak voltage to find the RMS voltage:
Peak voltage * 0.707 = AC voltage
So 240V AC, multiplied by 0.707, peaks at 339 Volts.
For the rest of this series, unless specified otherwise, all voltages will be given as DC or peak.
Using AC
So now we know what AC is and that it's volts are lies. What do we need to know to use it?

We've all seen a wall socket. In the UK they've all got three pins, and are polarized. Polarization means that the two AC wires have been given two separate roles to play. Let's meet them in the back of a plug:

Live (or Line, or Phase ) Should be considered the one that carries the power. Live is the wire controlled by the on off switch. It also has a fuse, which will pop and disconnect if something you plug in draws an unsafe amount of current.
Live's wiring is coloured Brown, because if you touch it while it's on, you will shit your pants. You might also die.
Neutral is an interesting one. It does carry power too, and a lot of the time it can be considered interchangeable with Live. If you accidentally wired them backwards, most things would keep working.
What makes Neutral interesting is it's relationship with the Planet Earth. The electric grid that supplies your neighborhood connects the Neutral side directly into the soil with a metal rod. This makes everything sitting on the planet earth technically connected to the neutral wire already.

They do this as a safety feature. You're already Neutral. If you touch a Neutral wire's connector, that's just more Neutral. Neutral cannot flow from itself to itself, so nothing will happen to you.
(assuming that the wires in your house are wired up correctly and there are no hidden faults! Please don't try this without checking!)
Neutral's wiring is coloured an inoffensive Blue.
Earth (or CPC, Circuit Protective Conductor) Should be considered a safety feature. It connects to any metal parts of a gadget that you might be able to touch, and connects them directly to the Planet Earth.

This is a critical safety feature on appliances that are mostly made of metal. If one was damaged, it might happen in such a way that power from the Live wire contacts those parts. If you touched it in that situation, you'd get zapped.
By connecting all those parts to the Planet Earth, we provide a more attractive path for electricity. It will flow down the Earth wire into the planet, away from you, and eventually make it's way back to the power grid.

Meanwhile, a special gizmo in your house's fusebox called a Residual Current Device will go "hey what the fuck? why is Current leaving on Live but not coming back on Neutral?" and cut the power.
Earth's Wiring is coloured Yellow and Green

You will also come across stuff that only has Live and Neutral, but no Earth. This is because that thing is Double Insulated. That means that it's been designed in such a way that Live can never, ever come into contact with a metal surface that a person can touch. When that's the situation, there would be no point to having an Earth wire, so they leave it off.
The symbol for Double Insulated is a box inside another box.

There are also non-earthed, non double insulated electronics, but they're from a time before safety was invented.

This radio is a perfect example. While the outer case is wooden, the inside is built around a steel frame. To save costs, that frame is being used as the Neutral, and the plug is not polarized. It can be plugged in the wrong way around, with no way to tell from the outside, making the frame Live.
In such a situation, all it would take is for an over excited child to pull the volume knob off, and the metal shaft it was attached to would be ready and waiting to zap him.
To sum up:
- 240V AC is a lie, it reaches about 340V for a little bit, and we need to design around that.
- The Brown wire is Live, and will have the power switch and the fuse. It can zap you.
- Neutral is the wire which completes the circuit under ordinary conditions. It usually can't zap you.
- Earth is used to protect you from getting zapped.
- It's possible to design something without an earth wire, if careful precautions are taken.
- Many things without earth wires used to be designed without that protection.
I hope that this was a comprehensive and concise AC power 101. I apologize that it doesn't cover 110/120 Volt countries like the Americas. Eurasian readers should substitute 240V for 220/230V, and the plugs for their weird bad round ones.
Now onto the good stuff.
NEXT UP: Bench Power Supply Part 3: Putting AC power to use! Magnetism and transformers
If you'd like to see this series continue, and you can afford it,
please put a buck in the tip jar!
I earn only £800 a month, spend more than half of that on rent alone, and so supplies and tools are a significant expense. Your support would be greatly appreciated! Who knows, if this really takes off I might buy a freezer.
