LEDs
Categories: electronics analogue electronics analogue electronic components discrete semiconductors
An LED (Light Emitting Diode) is a special type of diode that emits light.
Typical uses
LEDs are often used as indicator lights, for example on the front panel of an electronic device such as a synthesiser module. They are typically used to indicate that the device is powered on, what mode is selected, and whether data is flowing. For synthesisers they may be used to indicated the current state of a sequencer, signal volume etc.
LEDs have many advantages over old style filament bulbs - they don't run hot, they are smaller, brighter and use less power, they are more reliable and physically stronger
In recent years very bright white LEDs have been developed that can be used in room lighting, car headlights, torches and similar. This section is concerned with LEDs as electronic components, not any other uses.
Basic circuit
Here is a simple circuit to light an LED:
Several points are very important:
- It is vital to include a resistor with a suitable value (calculated for the maximum voltage). An LED has very low internal resistance, so without an external resistor a large current could flow through the LED, burning it out.
- The LED (like any diode) has positive and negative legs. Current can only flow from the positive leg to the negative leg, so the positive leg need to be connected to the positive voltage (the positive side of the battery in this case). If the LED is reversed, it will not normally be damaged, but it won't light up.
- LEDs have a voltage drop (about 1.8V for a red LED), if the voltage is less than that value very little current will flow and the LED will not light.
Positive and negative legs
There are three ways to identify the polarity of an LED:
The most obvious indicator is that the positive leg is longer than the negative leg.
Unfortunately this doesn't help much after you have cut the legs to size. The second indicator is that the rim of the LED body is flattened on the negative side.
If all else fails, you can also use the diode test setting of a multimeter, just as you would for a normal diode.
Calculating the resister
An LED drops a constant voltage when it current flows through it. So in the following circuit:
The voltage drop across the LED, Vled
, is fairly constant - it doesn't depend too much on the battery voltage or the resistor. For example for a red LED the voltage drop is usually about 1.7 to 2.0 volts. Green LEDs have a higher voltage drop, and blue LEDs even higher (up to about 3.3 volts).
The LED itself will not naturally limit the current passing through it to a suitable level - it has a low internal resistance and will burn out without a suitable resistor.
The desired current is Iled
(For a typical LED this is about 20mA to give good brightness). The value of the resistor is calculated as:
R1 = (Vcc - Vled)/Iled
You should refer to the data sheet of the actual LED you are using, but assuming a voltage drop of 1.8v, these resistors give a current of about 15mA, which should be safe for most LEDs, assuming the resistors are within 10% of their stated value:
- 5V - 220R
- 6V - 270R
- 9V - 470R
- 12V - 680R
LED colours
LEDs are commonly available is several colours - red, yellow, green and blue. The casing is usually the same colour as the LED, but in fact a coloured LED produces light of the specified colour, the colour of the casing is just to enhance the light colour.
Infra-red LEDs are also available. They produce radiation as lower frequencies than visible red light, and the light cannot be seen by the human eye. It can be detected by infra-red detectors. IR LEDs are typically used by TV remote controls similar.
Ultraviolet LEDs are also available. They are used less in consumer goods, because UV light can be harmful to the eyes. They have specialised uses for curing adhesives and coatings in production processes, disinfecting (UV kills many bacteria), checking UV watermarks on currency, and many other uses.
RGB LEDs are LEDs that have a red, a green, and a blue LED all in the same clear casing. By applying different currents to each LED you can mix different amounts of RGB to simulate a range of colours, including white.
LED form factors
LEDs are also packaged as surface mount devices. These are very small but still emit quite a bright point of light. They are often mounted on PCBs for disgnostic purposes - for example a board might have an LED to indicate it has power, and other LEDs to indicate that data is being transferred over a network, USB or other connection. Arduino and Raspberry Pi boards have surface mount LEDs for this purpose.
See also
Sign up to the Creative Coding Newletter
Join my newsletter to receive occasional emails when new content is added, using the form below:
Popular tags
555 timer abstract data type abstraction addition algorithm and gate array ascii ascii85 base32 base64 battery binary binary encoding binary search bit block cipher block padding byte canvas colour coming soon computer music condition cryptographic attacks cryptography decomposition decryption deduplication dictionary attack encryption file server flash memory hard drive hashing hexadecimal hmac html image insertion sort ip address key derivation lamp linear search list mac mac address mesh network message authentication code music nand gate network storage none nor gate not gate op-amp or gate pixel private key python quantisation queue raid ram relational operator resources rgb rom search sort sound synthesis ssd star network supercollider svg switch symmetric encryption truth table turtle graphics yenc