RGB LED: everything you need to know about this component

LED RGB

There are many types of semiconductor diodes on the market, and within them there is a particular type such as the LED (Light-Emitting Diode) type. These types can emit light, but they are not all identical. Manufacturers play with different compositions of the semiconductor material so that they emit lights of different colors. In addition, there is RGB LED, which uses various combinations of LEDs to be able to emit light in different colors.

Therefore, if you want to create a project in which a single color LED is not enoughWith RGB LEDs you can achieve wonderful multi-color light effects. And they are not very different from conventional LEDs, so you can integrate them with your Arduino board or in other electronic projects in a very simple way.

RGB

RGB light spectrum

RGB (Red Green Blue) they represent the colors red, green and blue. It is a very typical color composition that you have heard on many occasions in the world of electronics. In addition, you should know that with only those three colors many other colors can be formed, since they are the primary ones. That is why printer cartridges and toners are cyan, magenta and yellow (CMYK), and by mixing together with black, many other different tones and colors can be achieved.

In the case of LED light something similar happens, being able to use different lights from those three primary colors to achieve many other combinations that go beyond the single color of the LEDs traditional. In fact, many kinds of screens and electronic devices use this combination to display images.

RGB LED

RGB LED pins

El LED RGB It is a special type of LED diode that is made up of several simple LED arrays like those found in other single-color LEDs. In this way, they can emit in these three primary colors, thus generating all kinds of different effects and colors (even white combining red, green and blue at the same time) just by controlling one of the pins of these components.

Each filtering bag 3 packed LEDs in the same encapsulation it is capable of producing this entire range of colors. It has a slightly different pinout than conventional LEDs, since they include 3 pins, one for each color (cathodes or +) and another additional common to all, the anode (-). Otherwise it does not have too much mystery ...

Semiconductor colors and materials

What is interesting that you know is that thanks to type of semiconductor different colors can be achieved. This is what differentiates red LEDs from green, yellow, blue, and other shades. Researchers have been combining different materials to achieve all the colors that currently exist on the market. For example:

  • IRInfrared LEDs use GaAs or AlGaAs as materials to emit at this IR wavelength.
  • Red color:: AlGaAs, GaAsP, AlGaInP and GaP are used in colored light LEDs.
  • Orange: semiconductor materials such as GaAsP, AlGaInP, GaP are used with some variations.
  • Yellow:: it can be a composition similar to the previous one, such as GaAsP, AlGaInP and GaP to emit in a wavelength of the electromagnetic spectrum corresponding to yellow.
  • finanacing: to emit at this wavelength, special materials such as GaP, AlGaInP, AlGaP, InGaN / GaN are needed.
  • Blue: in this case, semiconductors and dopants based on materials such as ZnSe, InGaN, SiC, etc. are used.
  • Violeta- Created from InGaN.
  • Purple: Dual blue and red LEDs are used to achieve this color. Plastic of this color is even used with internal white LED light to give this effect.
  • Pink: there is no material for this color, what you do is combine two LEDs of different colors to get this color, such as red with yellow, etc.
  • White: it is the one that has given rise to the current LED bulbs, with pure white or warm white colors. For this, blue or UV LEDs are used with a yellow phosphor for pure white, or an orange phosphor for warm white.
  • UV: the ultraviolet spectrum can be achieved with various materials such as InGaN, Diamante, BN, AlN, AlGaN, AlGaInN.

Integration with Arduino

Arduino with RGB LED

Si quieres use RGB LED with Arduino, you can start by creating the previous image scheme. It is very simple, you just have to use the RGB LED and a resistor for the anode as is done with the LEDs, and connect it to the digital pins you want on your Arduino board. The connection should be as follows:

  • Long pin: the longest pin of the RGB LED must be connected to the GND pin of the Arduino, since it is the one marked as -, and it is the common anode. This is where the 330 ohm resistor will be connected between the diode pin and the Arduino board.
  • Red color:: is the single pin on the other side of the long pin. You can connect this to any pin you want.
  • finanacing: is the one right next to the long one, but on the opposite side of the red one. You can also connect it to any Arduino digital pin.
  • Blue: is the one next to the green, at the opposite end of the red. Do the same with it to be able to control it from an Arduino output.
Although you can use the pins you want, it is better to use the PWM to be able to play with the signal ...

After this basic connection, you will be able to begin with the programming of the sketches taking into account the pins in which you have connected each pin. On Arduino IDE you can generate a small source code that you can upload to your Arduino board to start testing how the RGB LED works:

void setup()
   {
       for (int i =9 ; i<12 ; i++)
            pinMode(i, OUTPUT);
   }

void Color(int R, int G, int B)
    {     
        analogWrite(9 , R);   // Rojo
        analogWrite(10, G);   // Verde
        analogWrite(11, B);   // Azul
    }

void loop()
   {    Color(255 ,0 ,0);
        delay(1000); 
        Color(0,255 ,0);
        delay(1000);
        Color(0 ,0 ,255);
        delay(1000);
        Color(0,0,0);
        delay(1000);
   }

With this simple code you will see that it first turns red, then turns green, then blue, then turns off and then the loop would start again. Each light remains for 1 second (1000ms). You can alter the order, times, and values ​​inside the parentheses to get more colors by combining. For example:

  • The first value corresponds to red and you can vary it from 0 to 255, with 0 being no red and 255 being the maximum.
  • The second value corresponds to green, with values ​​from 0-255 the same as the previous one.
  • The third is for blue, ditto for the previous ones.

To help you get other specific colors, you can use this website. In it an app appears in which you can choose the color range you want by moving the cursor of the colors to where you need it. Look at the values ​​of R, G and BIf you replicate them in your Arduino IDE program, you can create the color you want just like you do on this website or in programs like Paint, Pinta, GIMP, etc. For example, to get a striking green, you can use the values ​​100,229,25.

Striking green RGB color

For, more information About using Arduino IDE or programming, you can download our free PDF course...


The content of the article adheres to our principles of editorial ethics. To report an error click here!.

Be the first to comment

Leave a Comment

Your email address will not be published. Required fields are marked with *

*

*

  1. Responsible for the data: Miguel Ángel Gatón
  2. Purpose of the data: Control SPAM, comment management.
  3. Legitimation: Your consent
  4. Communication of the data: The data will not be communicated to third parties except by legal obligation.
  5. Data storage: Database hosted by Occentus Networks (EU)
  6. Rights: At any time you can limit, recover and delete your information.