## Introduction: Interfacing RGB Led With Arduino on TinkerCad

In this tutorial, you will learn about Arduino RGB led interfacing. The RGB led consists of three different led’s, from the name you can guess that these LEDs are red, green and blue. We can obtain many other colours by mixing up these colours. The Arduino has an analog write function which will help us in obtaining different colours for Arduino RGB led.

## Step 1: RGB LED Schematic

There are actually two types of RGB led’s; the common cathode one and the common anode one. In the common cathode RGB led, the cathode of all the led’s is common and we give PWM signals to the anode of led’s while in the common anode RGB led, the anode of all the led’s is common and we give PWM signals to the cathode of led’s.

The one that we are going to use is the common cathode RGB led. So, we will connect the common pin to the GND of Arduino and the other three leads of the led’s to the PWM pins of Arduino.
Note You cannot distinguish between the common cathode and common anode type by just looking at the RGB led because both look same. You will have to make the connections to see that either it is common cathode or common anode. The RGB led has one big lead than the other leads. In the common cathode case, it will be connected to GND and in the common anode case; it will be connected to 5V.

## Step 2: Circuit Diagram

Connect the cathode of the RGB led which is the longer pin of RGB led to the GND of Arduino and the other three pins to the pin 3, 4, 5 of Arduino through the 220-ohm resistors. The resistors will prevent the excess amount of current to flow through the RGB led.

If you are using the common anode RGB led, then connect the long lead to the 5V of Arduino.

Note: If you have any other Arduino, then make sure that you are using the PWM pins of that Arduino. The PWM pins have a ~ sign with them.

## Step 3: Working

Inside the RGB led, there are three more LEDs. So by changing the brightness of these led’s, we can obtain many other colours. To change the brightness of RGB led, we can use the PWM pins of Arduino. The PWM pins will give signal different duty cycles to the RGB led to obtaining different colours.

The below RGB colour wheel will help you in selecting different colours for Arduino RGB led.

## Step 4: Code

For more interesting projects connect with me on: