Arduino Circuits

Colour Mixing with an RGB LED

Drive the three channels of a four-terminal RGB LED separately to create the colour you want.

22 November 20265 min read
Four-terminal RGB LED with three separate series resistors connected to a control board on a breadboard
Breadboard layout, components and jumper connections of the RGB LED Colour Mixing circuit.

Interactive circuit guide

Run the simulation, follow the build steps one by one and try it in our real app.

Real screenshot of our circuit simulator Stopped
Open in our app →

Step-by-step build

What is it for?

In this project you drive the red, green and blue channels of a four-terminal RGB LED separately. Each channel connects to a digital pin through its own series resistor, while the common terminal goes to ground. By changing the brightness ratio of the three channels you obtain intermediate tones as well as the primary colours. The circuit shows how colours add in light and how digital outputs can be controlled in steps. On the breadboard the three resistors and the LED sit side by side and every wire uses a different colour of jumper. While working, one channel on gives a pure colour, two channels together give an intermediate tone and all three give a near-white light. This is the basis of lighting and indicator applications.

Parts list

The following components are used to build this project:

  • Control board × 1 — Drives the three channels independently.
  • Four-terminal RGB LED × 1 — Contains three colour channels in one package.
  • 220 Ω resistor × 3 — Limits the current of each colour channel.
  • Jumper wire × 8 — Makes the channel and ground connections.
  • Ground (GND) × 1 — Common cathode reference.

Build it step by step

  1. Place the RGB LED and the three resistors on the breadboard.Tip: separate the four legs according to the pin order.
  2. Connect the red channel to board pin 1 through a 220 Ω resistor.Tip: the resistor must come before the LED.
  3. Connect the green channel with its own resistor to board pin 2.Tip: each channel uses a separate resistor.
  4. Connect the blue channel with its own resistor to board pin 3.Tip: separate the wire colours by channel.
  5. Connect the common cathode to ground and ground to the board GND pin.Tip: without the common terminal no channel lights.
  6. Turn channels on one at a time and then combine them to watch the colour mix.Tip: red plus green gives yellow; all three give near white.

How it works

An RGB LED contains three separate diodes producing red, green and blue light in one package. The three channels are independent and each is driven through its own series resistor. The resistor keeps the channel current in a safe range and prevents the LED from failing. When the common cathode is connected to ground, a signal applied to the corresponding pin makes that channel conduct. When two channels are on together the eye combines the two lights and perceives an intermediate colour; with all three on the result is close to white. By setting channel brightness at different ratios you can produce many intermediate tones. This principle underlies coloured indicator panels and ambient lighting.

What you learn

  • Explains that the three colour channels are driven independently.
  • States why a separate series resistor is needed for every channel.
  • Understands that colour mixing results from adding light.
  • Recognises the role of the common cathode connection.

Tips

  • If a channel stays dark, check that channel resistor and pin order first.
  • Choose resistors of the same value so colours mix evenly.
  • If the common terminal does not go to ground, no colour appears.

Try it yourself

  • Make a pure colour: Light a single channel and name the colour you see. One channel produces a pure red, green or blue light.
  • Mix two colours: Turn on two channels together and observe the intermediate tone. Two channels produce a clear intermediate colour.

Getting the parts

If you want to build this project in real life, you can get the parts from hobidevre.com.

Frequently asked questions

What is this circuit for?

It drives the three channels of an RGB LED separately so you can create pure and mixed colours.

How does the circuit work?

Each colour channel has its own series resistor and digital pin; the common cathode goes to ground. Turning channels on in combinations adds their light, producing intermediate colours.

What is the expected result?

One channel gives a pure colour and multiple channels give an intermediate tone, with no colour appearing if the common terminal is disconnected.

You may also like