Serial at 9600 baudTap a part to see what it does.
Tap the parts to see what each one does. A teaching simulation, not a circuit simulator.
Build it step by step
0 of 4 donePlace the RGB LED
Longest leg to the ground rail.
Three resistors
Each colour leg through 220 Ω to D9, D10, D11.
Three knobs
Ends to 5V and GND, wipers to A0, A1, A2.
Upload and mix
Turn the knobs and paste the hex code into any colour picker.
How do you build an RGB colour mixer?
Three knobs set the red, green and blue brightness of one RGB LED, and the serial monitor prints the colour as a web hex code. You need Arduino Uno R3, RGB LED 5 mm common cathode, Potentiometer 10 kΩ × 3, Resistor 220 Ω × 3 and Breadboard 830 Tie Points. It takes 4 steps and about 35 minutes.
- Level
- Beginner
- Time
- About 35 min
- Parts
- 5
Parts list
- Development BoardsBuyArduino Uno R3 × 1
- SemiconductorsBuy
- PassivesBuy
- PassivesBuyResistor 220 Ω × 3
- PrototypingBuy
Tick what you already own. It saves to My Garage, so “Build with what I have” knows.
Wiring
| From | To | Why |
|---|---|---|
| Pot wipers | A0 / A1 / A2 | Red / green / blue knobs (ends to 5V and GND) |
| D9 → 220 Ω | RGB red leg | PWM red |
| D10 → 220 Ω | RGB green leg | PWM green |
| D11 → 220 Ω | RGB blue leg | PWM blue |
| RGB longest leg | GND | Common cathode |
Code
No libraries. analogRead gives 0 to 1023; dividing by 4 gives the 0 to 255 range of analogWrite. For a common-anode LED, use 255 − value.
Runs on a virtual Arduino Uno in your browser, with sliders for the sensors. Happy with it? Verify and upload to your real board from the same page (Chrome or Edge on a computer).
void setup() { Serial.begin(9600); }
void loop() {
int r = analogRead(A0) / 4, g = analogRead(A1) / 4, b = analogRead(A2) / 4;
analogWrite(9, r); analogWrite(10, g); analogWrite(11, b);
char hex[8];
sprintf(hex, "#%02X%02X%02X", r, g, b);
Serial.println(hex);
delay(200);
}What the serial monitor should show
Open the serial monitor at the baud rate in the code. This is what our simulator prints for a virtual Arduino Uno with its sensors at their default values. Your numbers will follow your real readings, but the format should match.
#808080 #807F7F #807F80 #7F7F80 #807F80 #808080
Test checklist
What you should see at each check. If a reading is far off, stop and use the troubleshooting list.
| Check | Expected |
|---|---|
| Red and green full, blue off | Yellow light, #FFFF00 |
| All full | Close to white (often slightly blue or pink) |
| All zero | LED off, #000000 |
If it does not work
Colours inverted
Common-anode LED: long leg to 5V and invert the values.
One colour never lights
Wrong leg order: check the pinout with a meter on diode mode.
Flicker
Normal at very low values; keep values above about 5.
Still stuck? Find the fault step by step with your multimeter →
Common questions
What parts do I need for the RGB colour mixer?
Arduino Uno R3, RGB LED 5 mm common cathode, Potentiometer 10 kΩ × 3, Resistor 220 Ω × 3 and Breadboard 830 Tie Points.
How long does the RGB colour mixer take to build?
About 35 minutes for a beginner maker, in 4 steps.
How do I know the RGB colour mixer works?
Red and green full, blue off: Yellow light, #FFFF00. All full: Close to white (often slightly blue or pink). All zero: LED off, #000000.
Colours inverted: what should I check?
Common-anode LED: long leg to 5V and invert the values.
One colour never lights: what should I check?
Wrong leg order: check the pinout with a meter on diode mode.
Flicker: what should I check?
Normal at very low values; keep values above about 5.
