My Cart

Comparative - The Light-Emitting Diode (LED)November 7, 2012

[Versión en Español] by Arduteka

We can explain many things abouts LEDs, but in this comparative we are going to help you to discover a big variety of them and their characteristics. With this, you will be able to find the perfect model to include it in your project. Take advantage in your Arduino or Raspberry Pi projects using the best choice.

Small LEDs, big LEDs, RGB LEDs, LED Matrix... The list can be huge and if you have any question about them and their uses... This is the comparative you need!

Firstly, we have to remember the internal structure of a LED in THIS TUTORIAL. In addition, we can learn in it what is a LED and how to connect it to our Arduino or to other circuits.

 LED

This type of LED is the most common that we will be able to find. There are several colors like blue, green, red or yellow.

The correct polarization of these diodes is performed following a simple rule, the LONGEST pin goes to positive and the short one to the negative.

We will frequently use them in our projects to indicate a state, but the use that we want to give to them will always depend on our creativity!

 

 

RGB LED

Following with the previous package style, there are others types like the  RGB LEDs, this abbreviation means “Red-Green-Blue”. These diodes work like three LEDs inside the same package. Due to this, we can variate their intensities individually allowing us to “mix” their colors. We can get  almost any color we want!

The main thing that we must consider is that there are two types of RGD LEDs: common anode (the internal LEDs share the positive) and common cathode (they share the negative). It is very important to polarize them.
The best way to use the  RGB LEDs is to connect each color to a PWM output of our Arduino. So that we will have 255 levels in each color.
Here you have an example in which the RGB LED shows its colors.

 

 

#define PINROJO 5
#define PINVERDE 6
#define PINAZUL 3

#define VELOCIDAD 5     // VARIA LOS SALTOS DE INTESIDAD EN CADA COLOR

void setup() {
  pinMode(PINROJO, OUTPUT);
  pinMode(PINVERDE, OUTPUT);
  pinMode(PINAZUL, OUTPUT);
}

void loop() {
  int r, v, a;

  // azul a violeta
  for (r = 0; r < 256; r++) {
    analogWrite(PINROJO, r);
    delay(VELOCIDAD);
  }
  // violeta a rojo
  for (a = 255; a > 0; a--) {
    analogWrite(PINAZUL, a);
    delay(VELOCIDAD);
  }
  // rojo a amarillo
  for (v = 0; v < 256; v++) {
    analogWrite(PINVERDE, v);
    delay(VELOCIDAD);
  }
  // amarillo a verde
  for (r = 255; r > 0; r--) {
    analogWrite(PINROJO, r);
    delay(VELOCIDAD);
  }
  // verde a azul
  for (a = 0; a < 256; a++) {
    analogWrite(PINAZUL, a);
    delay(VELOCIDAD);
  }
  // cian a azul
  for (v = 255; v > 0; v--) {
    analogWrite(PINVERDE, v);
    delay(VELOCIDAD);
  }
}

 

Light Pipe

The LEDs shown can be joined to a light pipe using an adapter and we will obtain very visual results. You can watch it in the next video.

To obtain this result, we can use the code shown before and with this adapter, we will join the RGB led to the light pipe.

 

High Luminosity LED

We can also find some diodes with a similar package but slightly larger (10mm). That's why, they are going to provide us with a higher luminosity than the LEDs mentioned above.

While a normal LED gives 800 or 900 mcd (millicandelas), these  high luminosity LEDs are going to give us between 10000 and 12000 mcd. If we want to draw attention in an Arduino project, we will use them!!

In addition, so much brightness generates a higher consumption than a normal LED. They can consume 80mA, for this reason we have to remember that our Arduino outputs can support a maximum of 40 mA. That's why we have to adapt our circuit using a transistor.

 

 

 

LED Matrix

A LED matrix is a big quantity of LEDs inside the same package in which there are 8 columns of anodes of 8 diodes interconnected and the cathodes are in 8 rows (or vice versa, there are many models). That's why it is a matrix of pixels, and each pixel is the intersection of a row and a column.

When we speak about an 8x8 or 7x5 matrix, we are saying that the matrix has “rows x columns”. That's why a 8x8 LED matrix is a matrix with 64 LEDs. Let's see the connections diagram of an one color 8x8 matrix with cathodes in rows and anodes in columns.

First of all, we have to difference between the numbers of the PINS and the numbers of the rows and columns. On one hand, the part that we will connect to our Arduino is the number of the pin. On the other hand, the other numbers are the reference to find a particular LED (pixel).

You must always read the datasheet of the LED matrix because the same component of different manufacturers probably will have different connections. As we have mentioned, there are matrix of one color and we can find  bicolor LED matrix or even a RGB LED matrix!! If you want to use the last two matrix, you have a driver called  RAINBOWDUINO, a circuit based on the ATMEGA 328 that is going to make easier the integration of these matrix in our projects.

In THIS EXAMPLE you can learn how to connect a bicolor LEDs matrix in our Arduino!

 

Gauge Bar (LED Bar)

There are other types of encapsulated LEDs but they are not arranged in a matrix. We can highlight the LED gauge bars.

These LED bars will allow us to display levels in a very clearly way. We will be able to measure temperature, sound, pressure or other sensors that we can connect to our Arduino!

In addition, due to the rectangular shape, you can connect as many as you want. If you do this, you will have more than 10 levels to use.

Now you have all the necessary components to make a VUMETER with frequency cuts in our Arduino!

 

 

 

 

7-Segment LEDs

Finally, we are going to review other type of LEDs. They are encapsulated in a package that we can see in many places. We are speaking about the 7-Segment digits!

From the turn in your supermarket to the numbers in the elevators. We can find them in several places and applications where the display of one or more digits is necessary. That's why they can be very important in many of our Arduino projects!

To start with, we have the basic 7-Segment LED. They are called of 7 segments because they have 7 bars that can be illuminated. Although we can find them with a point too.

The connection of this component is very simple, each segment is a LED with an anode and cathode. It is very easy!

The only thing we have to think about is the pin-out of the digit that we have acquired. For example, reading the datasheet, the pin-out of this 7-Segment LED is:

This digit is the most standard of all, it can be found in different sizes and colors. As evidence, we can buy giant numbers like this, it is 15 centimeter high! Certainly, we can make very spectacular projects with something like this in our hands.

If we need for our Arduino projects several digits. It has integrated 4 digits of 7 segments with their points of separation!

They are perfect for us to make a clock, a counter or similar projects.

And this is not all, if we want to make a panel like in “back to the future”...

 

There are in the market 8 digits shields like this that can be connected in serial. Each module has one shift register for each digit and we can communicate with it using the SPI through the ICSP port of our Arduino!

 

On THIS page, we will find all the necessary information to use this shield and some sample codes.

Finally, if we want absolute simplicity, we have available the DIGIT SHIELD for our Arduino.

We are going to control it very easily with THIS LIBRARY to our Arduino. It has some basic samples and these functions:

DigitShield.begin() : Start the Digit Shield. This is necessary in the setup.
DigitShield.setValue(int value) : It shows an int value in the display.
DigitShield.setValue(double value) : It shows a double value in the display.
DigitShield.setPrecision(int decimalPlaces) : It specifies the number of decimal that you want to use.
DigitShield.setLeadingZeros(boolean b) : It specifies to display numbers with leading zeros (default false).
DigitShield.setBlank(boolean b) : It allows to blank the screen completely. False to turn on the screen again..
DigitShield.setDigit(int d, int n) : It sets a value “d” in the digit “n”. The digits are numbered 1-4 from left to right.
DigitShield.setDecimalPoint(int d, boolean on) : Switch on or off the decimal point.

I hope that this comparative will help you to choose which LED is the most appropriate for your Arduino projects and it has taught you to use new components.

See you soon!!

Source: Arduteka

Leave a Reply