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:
Things you need
- Solderless breadboard
- Battery clip for 2 AA batteries
- 2 AA batteries
- Jumper wires
- RGB LED
- 3 resistors (calculate values in step three)
- 3 linear taper potentiometers, any value
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.
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.
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.
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.
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.
- 20 of the funniest online reviews ever
- 14 Biggest lies people tell in online dating sites
- Hilarious things Google thinks you're trying to search for