Home Chapter 7 LED General information

Site Search


Chinese (Simplified) French German Italian Portuguese Russian Spanish
LED General information

In order to control many LEDs, you must start with one LED. In this lab, you will be using the Arduino and then construct your circuit and testing using MAX MSP and Jitter.

This will allow you to turn the LED on and off and later to turn two LEDs, on and off at different rates and for different periods of time. From here you will learn to sequence two LEDs off and on, and then you will use a switch to turn the LEDs off and on determined by your input of a  micro switch.

The circuits you build will all be expanded by your new ability to program different timing of events.


Pictured at right is an LED—the long lead is the anode and the short lead is the cathode. Pictured above is the schematic symbol for a light emitting diode.


The LED is a semiconductor light. It is also a diode, meaning current will travel in only one direction, but unlike other diodes, the LED gives off light in the process of passing electron current. LEDs are available in a variety of colors: red, green, yellow, amber, and blue, and they also come in a variety of brightness’. Notice the difference in the schematic symbol with two small arrows coming out indicating it is a light emitting diode and not just a diode.




You can also use LEDs to mix color and can use red, green, and blue to create varieties of RGB color. Now, special RGB LEDs are also available. Because LEDs do not have filaments, they do not burn out as quickly, and they also do not get hot like incandescent bulbs. They are also much less expensive to keep lit because a normal filaments loose lots of energy, to heat the filament.

To flash an LED at a given rate, on-off, on-off, is the seed of all programming, as it indicates your ability to change the value of an output gate on the Arduino. This is exciting, and the first step to being able to control much larger devices like motors, lamps, and actuators of all sorts.

In this exercise, you will be using Ohm’s law to identify the proper parts for the project and to calculate the size of resistor you will need. You will then place the parts in the breadboard and program them to turn on and off in sequence both with the Arduino and MAX MSP and Jitter talking through MAXUINO.

An LED has two terminals, one called the anode and the other the cathode. The longer lead is the anode, but the best way to test them is to carefully look for the flat mark at the bottom of the LED. On some LEDs, it is difficult to see the flat area or it may not be apparent, so you must use all clues.



side and top view of an LED


Because the LED is a semiconductor and we know that it is sensitive to too much current, we need to know what the absolute maximum ratings are on this part before we hook it up to the circuit.

We also need to know what the absolute maximum ratings are for the microprocessor, and we will address this in Chapter 8 in more detail.

The LEDs we are using do not want to see any more than 20 mA or .02 amps maximum, so you will need to a use a resistor to limit the current.


You must never exceed the absolute maximum ratings on any parts, or you risk the parts and maybe your Arduino


Here you will get to use Ohm’s law to calculate what the proper resistor would need to be in order to have the LED glow brightly and safely.

Ohm’s Law should be repeated for each and every part that you interface to your Arduino microcontroller because the controller has delicate components.

  1. Use Ohm’s law to calculate the resistor you need, because your LED can take no more than 20 mA. 20 mA is the same as .020 amps. The voltage of 5 volts is a given coming from your Arduino.
  2. Ohm’s Law is V = I x R, where R is the resistance (measured in ohms), V is the voltage (volts), and I is current (amps). We have 5 volts and want to solve for R or resistance, so 5v = .020A x R or 5/. 020 = R or 250 ohms.
  3. However, because we are concerned with the ability to drive many LEDs at one time for this lesson we are wise to use a 470 Ohm Resistor. This will allow us to turn on many LEDs on and off using the total of 50 ma we can source (provide) from the Arduino. Remember when driving more than one LED you need a resistor for each LED and line out from the Arduino.
  4. It is okay to use a larger value but not a smaller value. Using the larger value will only mean the LED will glow a little less brightly, but the circuit and flashing will still work. A smaller value will allow too much current and possibly damage your Arduino. so use your multimeter to confirm the resistor values.
  5. Identify the part using the color codes, which should be yellow, violet, and brown.
  6. Set your multimeter to the Ohm’s setting. As instructed in Chapter 3, use your meter to measure the resistor and confirm that you have the correct resistor for this circuit.