Introduction: Light Bulbs
The incandescent light bulb was invented in 1879 and quickly changed the world. No longer were people reliant on natural cycles of light and dark. Being able to create buildings with electric light - many times as bright as a candle - allowed them to safely get bigger and taller without the reliance on natural light. In turn, urban centers were able to grow more dense and turn into the metropolises we know today. Light bulbs may not seem like much, but they made the modern world possible. Stick with me as I talk a little bit about what they are and how to use them.
How a Light Bulb Works
The incandescent light bulb consists of a thin tungsten filament inside of an inert gas-filled glass bulb. When electricity is applied across the filament, electrons begin to flow. These electrons encounter resistance from the tungsten material, and in turn produce energy as they collide. This energy turns into heat.
Since the heat rises above a certain threshold (around 4000 degrees Fahrenheit), it begins to emit photons (light particles) in the visible light spectrum. Thus, the light bulb glows.
Under normal conditions, the heat required to get the metal to glow would cause the filament to catch on fire, melt, and stop the electricity from flowing. However, tungsten has a very high melting point and the inert gas prevents the tungsten from breaking down and igniting (since there is no oxygen). This combination of factors allows the light bulb to glow for an exceptionally long time without the filament burning up.
Powering a Light Bulb
A typical light bulb has two terminals: an outer base consisting of metal threads and a round conductive "foot" contact on the bottom.
By connecting electricity to each terminal, a current is allowed to flow through it, and produce light.
The incandescent light bulb is the only component we will be dealing with in this class that can be powered with either AC or DC electricity. This statement is not true of even other types of light bulbs.
A socket is a mechanical connector that makes it easy to make electrical contact with the light bulb's base and foot. The socket typically has either screw terminals or wires for quickly connecting the light bulb to a power source.
When working with light bulbs, you will want to use a socket.
Types of Light Bulbs
There are three types of light bulbs you may encounter. They are incandescent, fluorescent, and LED. They nominally function the same by producing light, but are all different from one another.
Incandescent bulbs are the standard glass light bulb that we have been discussing thus far. It is the most common type of light bulb and has been in use for over 100 years. These bulbs tend to emit a warm white light.
Incandescent bulbs come in a host of different shapes, and sizes. This opens up a world of aesthetic lighting possibilities and make them fun to experiment with. However, if you are going to - do it quick. They are phasing out the sale of incandescent light bulbs (in the USA at least) in favor of more environmentally friendly versions over the next couple of years.
Fluorescent bulbs are similar to incandescent bulbs in that they are sealed glass containers filled with gas. However, where they differ is in that they require a special driver circuit to convert wall current into high voltage AC electricity. The high voltage causes mercury vapor inside of the bulb to ionize and emit UV (ultraviolet) photons (light particles). The UV photons are then converted to visible light by a special coating inside of the glass. These bulbs tend to be a cool white light.
Both incandescent and fluorescent bulbs all glow in roughly the same color, but can alter this by tinted the glass of the bulb. In doing so, you can often find these light bulbs in a host of fun colors, which provide interesting lighting effects.
Lastly, there are LED bulbs. An LED bulb is typically just a light bulb shaped enclosure with a circuit board inside that is covered in LEDs. For all intents and purposes they look like and (mostly) function like a standard lightbulb. However, like fluorescent lights, they too require a special driver circuit in order to power them. In the case of LED bulbs, they convert AC wall current into low voltage DC current. These bulbs can come in either warm or cool white light. In fact, some are even adjustable between the two. There are even some that have multi-color LEDs installed on them, and can be set to glow any color.
The brightness of light bulbs is typically described in terms of the amount of Watts, which is not actually a measure of brightness at all. Watts is the amount of power a light bulb draws from a power supply.
Based on how incandescent bulbs convert energy into light, it goes to follow lights which draw more power, glow brighter. This assumed correlation has carried over to fluorescent and LED light bulbs, which actually draw significantly less power than incandescent bulbs, but still have their brightness described in terms of Watts.
The most accurate measure for the brightness of light bulbs is Lumens, which is a measure of the amount of light emitted over time from a standardized source. In plain English, it is a standardized measurement of brightness.
A standard 60 Watt incandescent bulb is equivalent to 800 Lumens. However, the correlation between wattage and Lumens is not linear. A 40 watt bulb is only 450 Lumens, which is only 1/3 less power, but nearly half as bright. These correlations are important to keep in mind when finding LED and fluorescent equivalents.
Controlling Light Bulbs
Light bulbs can be toggled on and off with a power switch. A switch is basically just a mechanism for making and breaking an electrical connection. There are many different types of light switches such as the standard light switch (as pictured), and in-line switches which are connected directly to a lamp cord (not pictured). To wire a switch, you connect the terminals in series between one of the power connections, and one of the light bulb's connections.
Light bulb brightness can be adjusted using a dimmer. This is wired in series with the light like the switch. Dimmers work with all incandescent bulbs, but not all fluorescent or LED light bulbs. If you plan to dim an LED or fluorescent bulb, you need to make sure that you buy one that explicitly states that it can be dimmed.
The third green wire pictured above is for a socket's ground terminal. For most lamp applications, this is not needed.
If you would like to learn more about wiring switches and dimmers to light bulbs, you can check out the Lamps Class.
Arduino Control (advanced Topic)
For more advanced control of a light bulb, you can also use an Arduino. If you don't understand what an Arduino is, feel free to skip ahead to the final lamp project (and perhaps return to it at a later time). These instructions are meant for advanced students with an existing understanding of microcontrollers and electronics.
To turn a light bulb on and off using an Arduino, the best way is to use a solid state "puck" relay (so called, because they look like hockey pucks). These relays use a low voltage DC signal to control a high voltage and/or high current AC or DC signal. To be more technical, inside of the relay, the low voltage DC side controls something akin to an LED inside of the relay, which in turn triggers a sensor on the high voltage AC side to optically switch the higher voltage signal on or off. It is important to find one with a rating higher than the current you are using.
You can determine the current rating easily by using Ohm's Law. If we know the wattage of a light bulb, and we know how much power they are receiving from an outlet, we can use Ohm's law to determine how much current they consume. For instance, a 60 watt light bulb, being powered by 120 volts, is using 1/2 an amp power. This is because 60 Watts / 120 Volts = 0.5 Amps (or Amperes - to be technical about it).
This relay is rated for 40A, which is way more than we will be needing, which makes it okay to use. The relay should always be about double the maximum calculated current to be safe.
To wire up the Arduino to control a light bulb, make the following connections:
- To begin, it should go without saying that the light bulb should always be unplugged from the wall when handling its wires. You should never touch any metal electrical connection when the light bulb is plugged in!
- The supply wire from the wall socket to the bulb should be split in half and connected to the high voltage AC terminals on the relay.
- Pin 7 (or digital pin of choice) on the Arduino should be wired to the low voltage DC positive (+) terminal.
- Ground on the Arduino should be connected to the relay's ground (-) terminal.
Load the following code onto your Arduino:
In the code, the relay is turned on and off in the same manner you would turn and LED (or most anything) on and off using an Arduino. Basically, when a digital pin goes high (5V) it turns on, and then when it is pulled low (ground), it turns off. It is very simple.
This code should cause the light bulb to blink. You can modify the timing to blink the light bulb at different rates.
Dimming a light bulb with a microcontroller is a bit trickier, and requires a special controller board. This type of controller board differs between manufacturers, and is by no means standard. However, they all typically have a connector for an AC input from a wall socket, a connector to output the voltage to a light bulb, and a third connector for connecting a microcontroller (like an Arduino).
The one pictured is a generic programmable light dimmer board I found on Amazon. It is a triac based dimmer, which is an electrical component that can control the flow of AC current, and is a tiny bit like a transistor for AC current.
The board has two control pins that are meaningful to us. The first is the Gate pin connected to the "gate" of the triac, which turns the triac on and off. The second pin is the Sync pin, which tells us when the waveform is crossing zero, as it arcs up and down. This is used for timing the AC signal and triggering the triac at the appropriate time.
To wire it up, make the following connections:
- Connect 5V on the Arduino, to the 5V socket on the light controller board.
- Connect Ground on the Arduino to the Ground socket on the light controller board.
- Connect Pin 3 on the Arduino to the Sync socket on the light controller board.
- Connect Pin 7 on the Arduino to the Gate socket on the light controller board.
- Connect the AC supply to the AC input sockets, and the light bulb to the Load sockets.
Once it is all wired up, the following code fades the light bulb in and out:
It is important to research the protocol that is needed for properly having the microcontroller talk to the circuit board before you try to use it. Often you will find example code provided by the manufacturer or retailer. If not, you usually can find example code by searching online. Rarely are you the first person who needs to solve a problem.
The light bulb should now be fading in and out. You can change the rate, by altering the length of the delays in the loop() function.