The LED or Light Emitting Diode
What makes a LED work? Inside each LED is a small bit of chemical that when electrons are passed through, it emits radiation (i.e. light).
By changing this chemical compound, you can in effect change the wavelength emitted - infrared, green/blue/red, near-ultraviolet, etc.
Be sure to read my tutorial on color sensors if you'd like to know more on wavelengths of light.
How to Use a LED
How do you know which end is which? Note that the two wires on the LED are different lengths. The longer wire is always + and the shorter is -.
There are other ways to tell which lead is which. If you look from the top down, you will notice one side has a flat edge. That edge is ground. If you look inside, you can even tell by the shapes you see:
And what about surface mount (SMD) type LED's?
How to select a Resistor
Current is what determines how bright a LED is. More current means more light. LED current should typically be around 10 to 20mA. When current flows through the LED, a forward voltage drop of about 1.6V will develop between its pins, depending on the current. So this of this resistor as a valve - reduce it to increase LED brightness, or increase it to limit wasted power in your circuit.
First, find the datasheet on your LED. Scroll down towards the bottom until you see a few graphs:
First lets start with the graph on the right. Select a desired brightness and use the graph to then determine the required current. For this example, lets choose a luminous intensity of 1.0, giving a forward current of 20mA.
This means that 20mA must flow through the LED to give you a brightness of 1.0. Now we need to calculate the forward voltage drop across this diode with this current. Look at the left graph at 20mA. Now you know the forward voltage drop is about 1.85V. Know that forward voltage drop is not just a function of current, but also LED color and temperature (because of the different LED chemistries):
Next, determine what voltage you are applying to your LED - for example, if you are using a 5V regulator, then you are applying 5V. If you are using a 6V battery, then its 6V, etc.
Lastly, use this equation (derived from Ohm's Law, V=IR):
(voltage applied - forward voltage drop) / forward current = resistor value
LED's aren't very sensitive to resistor values, so don't worry if you must use a resistor 50% off of what you calculated.
PWM and LEDs
Your eyes also have different sensitivities to different wavelengths, so the matching will be different for each color.
Other stuff about LED's
However a narrow viewing angle means light is more concentrated onto a smaller area, like a laser.
The datasheet will typically give you a single number, but some will describe in more detail on the light distribution per angle:
And of course a wavelength chart, telling you its peak value. Why is this chart important? Well suppose you were trying to match a LED to a color sensor - the optimal LED would be the one that peaks at the same wavelength as your sensor.
Has this site helped you with your robot? Give us credit -
link back, and help others in the forums!
Society of Robots copyright 2005-2014