What is an LED?

From ROBOTC API Guide
Jump to: navigation, search

What is an LED?

An LED (Light Emitting Diode) is an electronics component that emits light when it is powered. Since it is a diode, an LED must be wired correctly for it to work (diodes only let current flow in one direction). When connecting an LED it is important to distinguish which lead is the anode (positive) and which is the cathode (negative).

To make it easier to identify the two leads, all LEDs are manufactured with two physical properties; the first is that LEDs are manufactured with one lead that is longer that the other. The longer lead is the anode(+) and the shorter lead is the cathode(-). The second feature is a small flat notch on the side of the LED. The lead that is closer to the notch is always the cathode. This is important to remember since the leads may have been clipped.

Close up of an LED and one of the possible schematic symbols for an LED.

When referencing a schematic (drawing of the electrical pathways and components using symbols), the symbol for the LED shows which way the current flows and allows you to connect the LED the correct way. On the symbol for an LED, the cathode is on the side with the line touching the point of the triangle. An easy way to remember this is that the triangle 'points' the way the current may flow. It is important to note that there are many variations on the schematic symbol; however, they all have a triangle with a line across the point and one or two arrows pointing out.

How to Wire up an LED

To wire up an LED you will need an LED, a breadboard, some wires, and a 470Ω resistor (color code: yellow-violet-brown). A resistor is an electronics component that limits the flow of electricity. This is important because most components, (including LEDs) have a limit on how much current can flow through them before they are damaged. Resistors are used to limit the current flow and help prevent this damage.

LED parts

Wiring up an LED is very simple. For this circuit, all you need to do is connect one lead of the resistor to digital pin 5 on the Arduino. Connect the other lead of the resistor to the anode lead of one of the LEDs, and then connect the cathode to ground.

LED Circuit Schematic

To make this easier, we will use the breadboard. Make sure that you have the anode and cathode of the LED on separate buses (to prevent a short) and that one of the resistor leads is in the same bus as the LED's anode.

Virtual breadboard setup for one LED
Breadboard setup for one LED

Understanding the circuit

The Arduino digital pin in this circuit will be configured as an output, which means the pin will act as a 5 volt source when high and a ground when low.In electronics the ground connection refers to the voltage supply connection that has 0 volts.

The Arduino supplies 5 volts for its digital pins. However, the LED requires about 2 volts across the leads, not the 5 volt output from the pin. This is where the resistor comes in to play.

For a series circuit (the components are connected one after the other), the sum of the voltage drop (voltage drop - the amount of voltage used by a component) across each component must be equal to the source voltage, which in this case is 5 volts. Since the LED needs 2 volts the resistor must have a voltage drop of 3 volts. Additionally, for series circuits, the current (amperes or amps abbreviated as A) flowing through each component in the circuit is the same. Based on these properties it is possible to calculate the required resistance of the resistor using (Vs·VLED)/ILED=R, where Vs is the supply voltage, VLED is the voltage across the LED, ILED is the desired current flowing through the LED, and R is the resistance of the resistor. We already selected the 470Ω resistor because it provides a nice safety range for variances of the components.