The RGB LED is a triple color LED, it emits colored light when pulses are given to one or more of its pins, using RGB LEDs you can generate different light colors, so this is an entertaining experiment. For this lesson, we will use what is called PWM to control a RGB LED and causes it to display multiple colors, the RGB LEDs can be categorized as common anode or common cathode, the first one is rare and hard to find, so the most circuits use common anode type, such as our RGB LED in this experiment.

RGB  LED With Arduino

          Fig1: RGB  LED


- 3 Resistor (220Ω)
- 1 Breadboard
- 1 Uno board
- Jumper wires
- USB cable


Color Principle of RGB

RGB stands for the red, green, and blue color channels and is an industry color standard. RGB displays various new colors by changing the three channels and superimposing them, which, according to statistics, can create 16,777,216 different colors. If you say the color displayed doesn't completely match a natural color, then it almost certainly cannot be differentiated with the naked eye.

Each of the three color channels of red, green, and blue has 255 stages of brightness. When the three primary colors are all 0, "LED light" is the darkest, that is, it turns off. When the three primary colors are all 255, "LED light" is the brightest. When superimposing the light emitted by the three primary colors, the colors will be mixed. However, the brightness is equal to the sum of all brightness, and the more you mix, the brighter the LED is. This process is known as additive mixing.

In this experiment, we will also use PWM feature in Arduino uno, it should be mentioned that the PWM feature deals only with 6 pins in the board. Here we input any value between 0 and 255 for each of the three RGB LED pins to make it display different colors.

Experimental Procedures

Step 1: Connect circuit as shown in Fig 2. The corresponding schematic diagram is shown in Fig 3. (Schematic is generated by EAGLE).
Step 2: Program the Arduino (download program from documents).
Step 3: Compile the program.
Step 4: Burn the program into Uno board.

The RGB LED will appear red, green, and blue first, then red, orange, yellow, green, blue, indigo, and purple.

circuit connection

Fig2: RGB connection

eagle schematic

Fig3: the schematic

Experiment summary

In this experiment, a you have met a new concept which is PWM, you are advised to pay attention to this concept, it is used wildly to control motors, almost every motor driver system implements this concept, in addition to that, your knowledge in RGB LEDs will allow you to build more efficient, entertaining and Profitable simple projects.


1-Arduino progrme (code)
2-Eagle file