RGB LED is the abbreviation of ‘’Red Green Blue Light Emitting Diode’’. RGB LED is the most amazing type of LED which has the ability to create millions of different shades of light colors using red, green, and blue colors.
![]() |
RGB LED is the abbreviation
of ‘’Red Green Blue Light Emitting Diode’’. RGB LED is the most amazing type of LED which has the ability to create millions of different shades of light colors using red, green, and blue colors.
RGB LED looks just like
a regular LED or we can say that an RGB LED actually had three LEDs (red, green, and blue colored LED) inside a single packaged LED with four legs. We can
generate any color by adjusting the brightness of each of the three LEDs of
the RGB LED.
If you want to produce red color, you would
set the red LED at the highest intensity along with the green and blue LED with
minimal (zero) intensity. In a similar manner, if you need to generate white
color, you would set all the three LEDs with the highest intensity.
Common anode and common cathode type RGB LED:
There are two types of
RGB LED one is a common anode type and the other one is a common cathode type. The
RGB LED had four legs, the first one is for red-colored LED, the third one is for green
colored LED, the fourth one is for blue colored LED and the second one is for common anode or common cathode.
You can identify the
type of the RGB LED by using the multimeter in continuity mode or by reading
the component data sheet provided by the manufacturing company.
Common Anode type:
In common anode type RGB
LED all the three colored LEDs leg shares a (positive) anode connection. You
can understand the structure of common anode type RGB LEDs using the image
illustrated below.
Common cathode type:
In common cathode type
RGB LED all the three colored LEDs leg shares a (negative) cathode connection.
You can understand the structure of c RGB LED using the image illustrated
below.
In this article, I will explain to you how an RGB LED can be operated using the Arduino Uno using two very basic
examples for the same circuit connection. At the end of this article, you will be able to play with multiple colors generated by the RGB LED.
Required components:
- 1 x Arduino Uno board........................................BUY
- 1 x breadboard: ...................................................BUY
- 1 x RGB LED common anode mode: .................BUY
- 3 x 1 K ohm resistors: .........................................BUY
- Few jumper wires: ...............................................BUY
Circuit diagram:
As shown in the above circuit diagram, the first terminal of the RGB LED along with the 1 K ohm
resistor is connected to the PWM pin 11 of the Arduino board. The second pin
(common anode) of the RGB LED is connected with the 5-volt power supply pin of the
Arduino board. The third pin of the RGB LED along with the 1 K ohm resistor is
connected to the PWM pin 9 of the Arduino board. The last pin of the RGB LED is
also connected with the PWM pin 6 of the Arduino board along with the 1 K ohm resistor. I have preferred this circuit connection for both the codes to make things easier for you to understand.
Code 1:
Click Here
PWM or pulse width modulation
is the technique that is used to control the brightness of the LED, speed, and
direction of different types of motors. Arduino Uno has six pins (3, 5, 6, 9,
10, and 11) to generate PWM signals of the specific duty cycle. The duty cycle specifies
the duration for which the pulse is HIGH. It measures in percentage and defines
the voltage between 0 and 5 volt. analogWrite(pin, value) function is used to
generate PWM signal of specific duty cycle where the value varies from 0 to 255
for 0 to 100% duty cycle (for example, 25% duty cycle: analogWrite(64), 100%
duty cycle: analogWrite(255)).
According to this code, I
have used the PWM pins 11, 9, and 6 for LED outputs. I have used the analogWrite()
function to generate output which accepts values between 0 to 255.
In the “common anode” type
if the value is 0 means LED has the highest brightness on the other side if the
value is 255 means LED has the lowest brightness (off). As shown in the connection diagram I used this common anode mode to generate output using RGB LED.
However, in “common cathode”
type 0 values indicate the lowest brightness and the 255 value indicates the
highest brightness.
According to the code
in the output red, green, blue, and white-colored will be produced by the RGB
LED. You can check the output according to the provided input values in the analogWrite() function.
Code 2: Click Here
In this example code, I
have tried to produce four different colors by mixing the values of red, green, and
blue pins. You can change these values and try to produce a new color. I had used the same circuit connection based on common anode mode for this code to generate output.
Output:
Important points:
- In a common anode type, the second pin of the RGB LED is always connected with the 5-volt power supply pin.
- In a common cathode type of mode, the second pin of the RGB LED is always connected with the GND pin.
- In a common anode type, the analogWrite() function generates the highest brightness for the value 0 and the lowest brightness for the value 255.
- In a common cathode type, the analogWrite() function generates the highest brightness for the value 255 and the lowest brightness for the value 0.
You've shared some incredibly useful information about LED lights. This is frequently a terrific way for us to broaden our knowledge while remaining useful. Thank you for bringing this article to our attention.
ReplyDeleteI respect this article for its well-researched subject matter and superb writing. Find out more by reading. I became so engrossed in this subject that I couldn't put the book down. I am in awe of your talent and labour. I greatly appreciate it.led business signs
ReplyDeleteThank you so much for sharing. this would be absolutely amazing. Check also E26 led bulbs
ReplyDelete