A battery gives DC, the wall socket gives AC, and phones and Arduinos need DC. So why are there two kinds at all? And what happens inside a charger? Once you understand the difference, you'll know why one adapter destroys your project while another with the same voltage doesn't.
Direct current (DC)
The current flows in one direction and the voltage is roughly constant. Sources: batteries, solar cells, and the output of chargers and power supplies.
Almost all electronic circuits (chips, microcontrollers and LEDs) need DC, and most are polarised: reverse positive and negative and they can be destroyed.
Alternating current (AC)
The current keeps reversing direction, and the voltage varies as a sine wave.
In Egypt mains is 220 V at 50 Hz, meaning the wave completes 50 full cycles a second, and the current reverses direction 100 times a second. Other countries such as the US use about 120 V at 60 Hz, which is why some imported devices state the voltage range they accept (such as 100–240V) before you plug them in.
What exactly is the 220 V?
220 V is the RMS (effective) value, meaning the value that produces the same heat as DC of the same number: a heater on 220 V AC heats exactly as it would on 220 V DC. But the real peak of the wave is higher:
Vpeak = 220 × 1.414 ≈ 311 V
That's why capacitors and parts on mains must withstand more than 311 V, and why the filter capacitor after a 12 V transformer charges to about 15.6 V, not 12.
Why is power transmitted as AC?
Because AC makes it easy to change the voltage with a transformer. And that matters because the loss in the wires depends on the square of the current:
loss = I² × R
Example: you want to deliver 10 kW. At 220 V the current is about 45 A. At 11,000 V the current is under 1 A. So the current falls 50 times, and the loss in the same wire falls 2500 times. That's why power stations raise the voltage very high to transmit energy over long distances, and it's stepped down in stages before entering homes. There's a historical reason too: in the late nineteenth century there was a rivalry between Edison's DC system and the AC system of Westinghouse and Tesla, and AC won because the transformer solved the transmission problem. Large motors and generators have been built for AC ever since.
Today there are very high voltage DC transmission lines for very long distances and undersea links, because electronics can now convert efficiently between the two. But the grid that reaches your home is still AC.
Electricity in the home
- Live (phase): the wire carrying the voltage. That's the dangerous one.
- Neutral: the return to the transformer; its voltage is close to earth but not guaranteed to be zero.
- Earth: a protective wire connected to the ground, which carries away any leakage into the body of a metal appliance.
Large buildings and factories are fed with three-phase: three wires, each carrying a wave delayed by a third of a cycle from the next. The voltage between a phase and neutral is 220 V, and between two phases about 380 V. These systems run large motors more smoothly and efficiently. If you're going to touch anything connected to mains, read the safety rules first; ground in electronic circuits is a different thing, explained in the ground article.
AC to DC: inside a charger
A traditional power supply does three steps:
- A transformer: steps 220 V down to a lower voltage (say 12 V AC).
- A rectifier (a diode bridge): makes the current flow in one direction, but still as pulses. Details are in the rectifier and bridge article.
- A filter capacitor: smooths the pulses into DC, usually followed by a regulator to hold it steady.
Modern small chargers, however, rectify the 220 V first, then convert it with switching circuits at a very high frequency through a small transformer. That's why they're so much lighter and smaller. The higher the frequency, the smaller the transformer you need.
DC to AC: the inverter
UPS units and solar systems do the reverse: they take DC from a battery and output 220 V AC. That's called an inverter:
- Pure sine: a clean sine wave like the mains. Suitable for everything.
- Modified sine: an approximate stepped wave. Cheaper, but some devices (motors, fans and some chargers) run hot or hum on it.
Watch out: an adapter labelled AC
Not every adapter outputs DC. Some older adapters (for routers, landline phones or CCTV cameras) are labelled OUTPUT: 12V AC, meaning they contain only a transformer with no rectifier. Connect one to an Arduino or an LED strip and it will be destroyed or won't work. Always read the output: the symbol ⎓ or DC means direct, and the symbol ~ or AC means alternating. Choosing the right adapter is covered in the how to choose a power supply article.
Measuring them with a multimeter
- DC: the V⎓ mode. If the reading is negative, the probes are swapped.
- AC: the V~ mode. The reading is the RMS value.
- Cheap multimeters calculate RMS assuming a perfect sine wave. If the wave isn't sinusoidal (the output of a cheap inverter or a light dimmer), the reading will be wrong. Meters marked True RMS measure correctly.
- Measuring DC in AC mode or vice versa gives meaningless numbers, so check the mode before reading. Details are in the multimeter article.
Safety warning
220 V is very dangerous and can kill. As a beginner, work on low-voltage DC circuits (5–12 V), and use a ready-made charger or power supply until you've learned the basics of safety well. Even high-voltage DC (such as electric car batteries or large solar systems) is dangerous, and it's harder to break than AC because the arc doesn't extinguish by itself. That's explained with the relay.
FAQ
An LED flickers on mains power but you can't see it? If it's fed from rectified AC without enough filtering, it turns off and on 100 times a second. The eye usually doesn't notice, but a camera captures it as bands.
Can I run a DC device on AC at the same voltage? No, unless it says it accepts both. Most DC devices will be destroyed or won't work.