How to use an rgb led

Written by douglas quaid
  • Share
  • Tweet
  • Share
  • Pin
  • Email
How to use an rgb led
An RGB LED is actually three LEDs in one. (green led image by Albert Lozano from

An RGB LED is actually three LEDs in one bulb. The housing contains separate red, blue and green LEDs which share a common cathode, or negative terminal. The brightness of each colour is determined by its input voltage. By combining the three colours in different amounts, you can turn the LED any colour you want. This circuit demonstrates the use of an RGB LED by using a potentiometer to control the voltage going to each colour. A potentiometer is a variable resistor controlled by a knob, like the volume dial on your stereo.

Skill level:

Other People Are Reading

Things you need

  • Solderless breadboard
  • Battery clip for 2 AA batteries
  • 2 AA batteries
  • Jumper wires
  • 3 resistors (calculate values in step three)
  • 3 linear taper potentiometers, any value

Show MoreHide


  1. 1

    Connect the battery clip to the power and ground rails of the breadboard. The red wire from the battery clip connects to the power supply rail, and the black wire connects to ground. Do not put the batteries in the clip yet.

  2. 2

    Place the LED on the breadboard so that the four pins are not connected to each other. Connect the longest pin, the cathode, to ground. Consult your LED's datasheet to confirm which pin is which, as it may vary with different manufacturers.

  3. 3

    Calculate the resistor value you will need for each pin. Different colour LEDs have different maximum voltage ratings, so consult your LED's datasheet, which will list the maximum forward voltage for each colour. Calculate resistor values using Ohm's law, which states that resistance equals voltage divided by current, or R = V/I. For each colour, subtract the maximum forward voltage from the supply voltage. The result is the voltage you need to drop across the resistor. Plug in the resistor voltage for V, and divide by .02 for current. The result is the minimum resistor value you should use for that colour.

  4. 4

    Connect the first resistor to the positive power rail, and then to the left terminal of a potentiometer. Connect the centre terminal of the potentiometer to the appropriate leg of the LED for this colour. Connect the right terminal of the potentiometer to ground. Repeat for the other two colours. The potentiometer will act as a voltage divider, so the actual resistance value of the potentiometer is irrelevant. Turning the knob on the potentiometer will set the voltage to any position between 0 volts and the maximum forward voltage, controlling the brightness of the colour.

  5. 5

    Connect the batteries to the clip, and the LED will light up. Control the colour by turning the three potentiometer knobs. Each knob controls the brightness of its own colour.

Tips and warnings

  • LED pin configurations and rated voltages may change from manufacturer to manufacturer. Look at your component's datasheet for all the information you will need.
  • Expand on this project by replacing the potentiometers with a microcontroller. Connect each colour on the LED through a resistor to a PWM ("Pulse Width Modulation") output on the microcontroller. Program the microcontroller to change the PWM values to automatically cycle the LED through a series of colours.
  • Exceeding the maximum forward voltage on any leg of the LED will destroy it.

Don't Miss

  • All types
  • Articles
  • Slideshows
  • Videos
  • Most relevant
  • Most popular
  • Most recent

No articles available

No slideshows available

No videos available

By using the site, you consent to the use of cookies. For more information, please see our Cookie policy.