A fluorescent light has two electrodes, one at either end of its tube. When the light is turned on, a high voltage is applied between these electrodes, which causes the gas between them to ionize. Normally the gas has a very high resistance, but when it becomes ionized its resistance drops greatly.
Because of Ohm's Law, the current flowing through the tube is proportional to the voltage divided by the resistance:
I = ---
So, before the gas is ionized, hardly any current flows through the tube. However, as soon as a path of ionized gas is formed, the current is free to flow. If the light were plugged directly into the mains, a very high current would flow through the light, generating a lot of heat. The heat would then either burn through the light's electrodes or simply cause the light's tube to crack.
Neither of these are very good things, of course, unless you can afford to replace your lights every time you switch them on. Hence, the ballast is needed to limit the current that flows through the light.
Ballasts come in two types: magnetic and electronic. Magnetic ballasts are cheap to produce, but cause an audible hum as well as being somewhat inefficient. Electronic ballasts are more expensive but use less electricity to produce the same amount of light.
A magnetic ballast (also known as a 'core-and-coil ballast' due to its construction) is usually made up of a stack of steel discs. Around the discs are wound two lengths of insulated aluminium or copper wire.
The ballast acts a combination of a transformer and inductor. During the switch-on phase, the light needs a very high voltage to allow an arc to jump between the two electrodes and ionize the gas. The transformer increases the voltage of the mains supply to a level suitable to induce this arc. After the gas has been ionized, the inductor serves as a current choke, stopping excessive current from flowing through the lamp.
Magnetic ballasts can generate an annoying hum, because they operate at 60Hz, which is within human hearing range. Electronic ballasts use circuitry which boosts the frequency of the supply to around 20 KHz, which is too high for most people to hear.
The electronic ballast is essentially a small switching power supply. It is made up of several stages. First the alternating mains current is rectified and smoothed, then an oscillator generates a high-frequency waveform. The resulting alternating current is fed through a transformer to boost its voltage, similar to the magnetic ballast above. However, because of the higher frequency, only a very small inductor is needed.
In addition to reducing noise, this also has another advantage. Mains current is made up of a sine wave, which goes from a positive voltage to zero, to a negative voltage, back to zero and then repeats the cycle. The light glows on both positive and negative voltages. The tube of the light is coated with phosphors which react to the ultraviolet radiation that the light gives off, turning it into visible light. These phosphors remain glowing for a short period after the light stops emitting UV (ie, when the voltage has dropped too low for the light to continue operating).
At 60 Hz, the light level coming off the phosphors looks like this:
| |\ |\ |\
|\ | \ | \ | \
| \ | \ | \ | \
| \ | \ | \ | \
| \| \| \| \
P is the period of the wave, which is 1/120 seconds (the period of a wave is one over its frequency, and in this case the light is emitting a burst of UV on both the negative and positive halves of the mains cycle, so it would be running at 120 Hz.)
However, if we increase the frequency of the supply (say by a factor of 5, to 300Hz) the graph will now look like this:
The phosphors now have less time to 'relax' between excitations, so the average light output level is much higher. This means that electronic ballasts can save money by allowing less current to be used for the same amount of light.