How a phase-control dimmer works
Mains voltage is a 50 Hz sine wave, so it passes through zero 100 times a second. A traditional dimmer uses a TRIAC, a semiconductor switch that conducts in both directions. Once triggered by a pulse on its gate, it stays on until the current falls to zero at the end of the half cycle, then turns itself off.
The dimmer waits for a delay after each zero crossing, then fires the TRIAC. That delay is measured as an angle, where 180° is a whole half cycle (10 ms). At 0° the lamp gets the whole sine wave. At 90° it gets the second half of each half cycle. At 180° it gets nothing. The delay is set by an RC timing circuit and a trigger diode called a DIAC, or by a small microcontroller in modern dimmers. Because the lamp is switched on at the leading edge of each conducting section, this is called leading-edge dimming.
Power isn't proportional to the angle
Most of the energy in a sine wave is in the middle of each half cycle, around the peak. So cutting off the first 30° removes very little power, and the last 30° holds very little too. For a resistive load the RMS voltage is:
VRMS = 230 × √(1 − α ÷ π + sin(2α) ÷ 2π)
where α is the firing angle in radians. At 90° you get exactly half the power, but the RMS voltage is still 163 V, not 115 V, because power goes with voltage squared.
Leading edge, trailing edge and LEDs
A trailing-edge dimmer does it the other way round. It uses MOSFETs or IGBTs that can switch off on command, so it turns on at the zero crossing and off part-way through. It's quieter and gentler on electronic loads. LED lamps contain their own driver electronics, and they only dim smoothly on a dimmer they're designed for. Many work best on trailing-edge dimmers, and leading-edge dimmers often have a minimum load that a few LED lamps don't reach, which causes flicker or buzzing. Check the lamp and dimmer makers' compatibility lists.
Phase control also draws current in sharp-edged chunks, which creates harmonics and radio interference, so dimmers include a small filter choke. Heater and motor speed controllers can use the same idea, and some heater controls use burst-fire instead, switching whole cycles on and off at the zero crossing, which avoids the interference.
How this simulation works
The load is a fixed resistance, sized to draw its rated power at 230 V, and the TRIAC is an ideal switch. The RMS voltage and power use the exact formula above. A real filament lamp's resistance is much lower when it's cool and dim, so at low settings it draws more power than this model shows. Never work on mains wiring unless you're competent to: our guide to wiring a light switch covers safe isolation.