TESTING AN LED - If a light-emitting diode fails completely to light when you think it should a simple first diagnostic step is to test it. Why not just swap it for another? Well, because possibly your circuit has an error that is causing them to be damaged.

STEP 1: Verify the LED is supposed to produce visible light and not infrared light. Infrared-emitting diodes are usually, but not always, pale blue in color. But many have a colorless package. A good infrared-emitting diode will pass a test with a diode tester, such as is built in to many digital multimeters, but not produce visible light while doing so.

 

STEP 2: Electrically test the LED

  • OPTION 1: Use the diode test setting of a multimeter. A good LED will produce a reading between 1 and 2 when the red test lead is connected to the anode (positive wire) and the black test lead to the cathode (negative wire). The diode will often light up dimly. When the test leads are reversed the meter reading should be infinite (no reading).
  • OPTION 2: The LED should light when the following circuit is constructed. Using alligator clip leads and jumpers do the following:
    • Connect power to an Arduino by plugging it into a computer USB port. The Arduino's power indicator should be on.
    • Plug one end of a 220 ohm resistor into +5 volts on the Arduino.
    • Using an alligator clip lead connect the other side of the resistor to the anode of the LED. Usually the anode is indicated by being the longer of the two wires. If the wires of the LED are the same length the anode is the wire closest to a small indent in the base of the LED.
    • Using an alligator clip lead and a jumper connect the cathode of the LED to a GND connector on the Arduino.

If the LED fails to light it is damaged. Choose another.

 

LED IS CONNECTED TO DIGITAL PIN AND DOESN'T LIGHT OR IS DIM - the following assumes the LED in question is undamaged and should be working.

 

STEP 1: Verify the digital pin has been initialized to OUTPUT. This is accomplished with the programming statement pinMode(<pin number>, OUTPUT); If this statement is in the sketch be certain it is being executed.

 

STEP 2: Check the value of the current-limiting resistor. The value is almost always 1000 ohms (brown, black, red) or less. Most often the value used in this class is 220 ohms (red, red, brown). Sometimes resistors of 220 ohms become confused with those of 220,000 ohms. Pay attention to that third color stripe. For 220 ohms it is brown. For 220,000 ohms it is yellow.

 

STEP 3: Verify the cathode of the LED is connected to the electrical ground (GND) of the Arduino. Often the cathodes in a circuit are all neatly plugged into the blue stripe of a solderless circuit board but the jumper connecting this stripe to an Arduino GND pin has been forgotten.

 

STEP 4: Verify the Arduino Sketch leaves the LED on long enough to be seen. A common error is to turn an LED on near the end of the loop() method with the digitalWrite() statement but turn it off with digitalWrite() near the beginning. As a result, the LED does come on but for so short a time it cannot be seen.