Introduction: Controlling RGB Using a Potentiometer!

How to change the color of an anode RGB LED with a potentiometer.

Step 1: Things You Need

Hardware Components :

1. DFRobot Arduino UNO

2. DFRobot Jumper Wires

3. DFRobot Analog Rotation Sensor

4. DFRobot Analog Sensor Cable

5. DFRobot Breadboard-Plugin Resistor

6. RGB Diffused Common Cathode


RGB LED means red, blue and green LEDs. RGB LED products combine these three colors to produce over 16 million hues of light. Note that not all colors are possible. Some colors are “outside” the triangle formed by the RGB LEDs. Also, pigment colors such as brown or pink are difficult, or impossible, to achieve.

Step 2: Anode/Cathode RGB LEDs

RGB LED are of two types, common anode, and common cathode. The difference between CC and CA is , With a common anode you can connect the anode to the +5v and each individual LED to a resistor each. Connect that resistor to an output pin. Then a write LOW to that pin will turn the LED on and a HIGH will turn off .This is called current sinking

With a common cathode you connect the cathode to ground and connect each LED's anode through a resistor to the output pin. Then a HIGH turns it on. This is called current sourcing.

Recalling the mnemonic ACID (Anode Current Into Device), we can infer that a common anode RGB LED has current driving one pin, and that a common cathode RGB LED is grounded on one pin. Either way, this anode or cathode will be the longest of the four pins coming out of the LED. Unfortunately, these guys aren’t always labelled clearly as to what they are. In this example, I have worked out the wiring for a common anode RGB LED; most other guides describe a common cathode wiring.

Step 3: The Wiring

You can create sketch like this using fritzing which available for free.

Step 4: Code


Step 5: For More Projects :

You can visit my Hackster Profile .

Step 6: