Skip to content

PRO TIP Block youtube.com at the DNS level — Pi-hole, NextDNS or your hosts file — but allow youtube-nocookie.com and i.ytimg.com. These tutorials keep playing; the rabbit hole does not.

Learning without distractions

Lesson: 18 – Arduino RGB LED Tutorial | Create Any Color with RGB & Potentiometers

1.5K views on YouTube

Lesson: 18 – Arduino RGB LED Tutorial | Create Any Color with RGB & Potentiometers

Hello and Welcome to Electro Nerds Academy. In this video, we’ll first understand how RGB LEDs work — including the difference between common anode and common cathode types — and how to identify their pin configuration using a multimeter. Then, we’ll connect an RGB LED to the Arduino along with three potentiometers to adjust the brightness (PWM control) of each color. Finally, we’ll upload a simple Arduino sketch that lets you mix any color you want by rotating the potentiometer knobs.

What You’ll Learn In This Video:

✅ What is an RGB LED and how it works ?
✅ Difference between common cathode and common anode RGB LED
✅ How to find RGB LED pin configuration using a multimeter
✅ How to connect an RGB LED and potentiometers to Arduino
✅ How to use PWM (analogWrite) to control LED brightness
✅ How to create a full RGB color mixer using Arduino

Arduino Code Used in This Project:

// Arduino RGB LED Color Mixer using Potentiometers
// Electro Nerds Academy

// Define LED pins
const int redPin = 9;
const int greenPin = 10;
const int bluePin = 11;

// Define potentiometer pins
const int pot1Pin = A0;
const int pot2Pin = A1;
const int pot3Pin = A2;

// Variables to store readings
int pot1, pot2, pot3;
int redValue, greenValue, blueValue;

void setup() {
// Set LED pins as output
pinMode(redPin, OUTPUT);
pinMode(greenPin, OUTPUT);
pinMode(bluePin, OUTPUT);

// Set potentiometer pins as input (optional, since analogRead sets it automatically)
pinMode(pot1Pin, INPUT);
pinMode(pot2Pin, INPUT);
pinMode(pot3Pin, INPUT);
}

void loop() {
// Read the potentiometer values (0 – 1023)
pot1 = analogRead(pot1Pin);
pot2 = analogRead(pot2Pin);
pot3 = analogRead(pot3Pin);

// Map them to PWM range (0 – 255)
redValue = map(pot1, 0, 1023, 0, 255);
greenValue = map(pot2, 0, 1023, 0, 255);
blueValue = map(pot3, 0, 1023, 0, 255);

// Write the PWM signals to the LED pins
analogWrite(redPin, redValue);
analogWrite(greenPin, greenValue);
analogWrite(bluePin, blueValue);

// Small delay for stability
delay(10);
}

If you found this tutorial helpful, don’t forget to like, subscribe, and turn on notifications 🔔 for more Arduino lessons from Electro Nerds Academy!

#Arduino #RGBLED #ArduinoProjects #ElectroNerdsAcademy #ArduinoTutorial #RGBLEDTutorial #ElectronicsForBeginners #ArduinoPWM #ColorMixer #DIYElectronics