Jump to main content

Color Mixing with Red, Green, & Blue LEDs

1
2
3
4
5
72 reviews

Abstract

This is a good project for someone who is interested in both electronics and color vision. The equipment needed is on the expensive side, but if you continue studying electronics, you can use it again and again.

Summary

Areas of Science
Difficulty
 
Time Required
Average (6-10 days)
Prerequisites
To do this project you should be familiar with Ohm's law. Experience building electronic circuits on a solderless breadboard is also helpful. The breadboard is the biggest expense, which can be used for future explorations in electronics.
Material Availability
Specialty items
Cost
Very High (over $150)
Safety
Adult supervision required when using power drill.
Credits
Andrew Olson, Ph.D., Science Buddies

Sources

This project is based on:

Objective

The goal of this project is to learn some basic principles of color perception by experimenting with various combinations of colored lights. For controlled light sources, you will build an electronic circuit to control the current for three separate LEDs: one red, one green, and one blue.

Introduction

An LED (light-emitting diode) is a special kind of diode that produces light (see Figure 1).

Diagram shows a red LED above the circuit diagram symbol for an LED
Figure 1. A red LED (top). The longer lead is the anode (+) and the shorter lead is the cathode (−). In the schematic symbol for an LED (bottom), the anode is on the left and the cathode is on the right (Hewes, 2006).

When current flows through the diode in the forward direction, some of the current is converted into light of a specific color (i.e., wavelength). The color of the light depends on the material from which the semiconductor is made. LEDs are available in many different colors.

As the current through the LED increases, the brightness also increases. Typically, the recommended current for an LED is 20 mA or less. Above this value, the lifetime of the LED will be decreased significantly. Far above this value, the LED will fail catastrophically, like a flashbulb.

To keep the LED current at a reasonable level, LEDs are typically connected in series with a current-limiting resistor, as shown in Figure 2.

Circuit diagram of a 1000 ohm resistor, an LED and a 9 volt battery wired in series
Figure 2. Schematic diagram of an LED in series with a 1kΩ resistor (Hewes, 2006).

The voltage drop across an LED is about 2 V (except for blue or white LEDs, where the voltage drop is about 4 V). In the circuit in Figure 2, the voltage drop across the resistor will be 9 − 2 = 7 V. Using Ohm's law, the current, I, through the resistor will be V/R = 7 V/1kΩ = 7 mA.

Figure 3 shows you how to use Ohm's Law to calculate what size resistor you need to limit the current through the LED to the desired value. The voltage drop across the resistor will equal the supply voltage minus the voltage drop across the LED (or, VSVL). You can then use Ohm's Law to calculate the resistance, R, needed to produce a desired current, I:

R = (VSVL)/I.

So, if the supply voltage is +7 V, what resistor would you need for a 15 mA current? R = (7 − 2)/0.015 A = 333Ω. The closest standard resistor value would be 330 Ω. For more details, and a set of online calculators, see the LED references in the Bibliography section (Hewes, 2006; Ngineering, 2003).

Circuit diagram of a resistor, an LED and a battery wired in series
Figure 3. Schematic diagram showing how to use Ohm's Law to calculate the correct value for the current-limiting resistor (Hewes, 2006).

For this project, we'd like to vary the output of each of three different LEDs over a continuous range. Obviously, it would be a major inconvenience if we had to keep changing the current-limiting resistor for each LED! The circuit shown in Figure 4 is a different approach to solving our problem.

Circuit diagram of an operational amplifier wired to a resistor and LED
Figure 4. This circuit uses an operational amplifier (op-amp) to control the current through an LED (Calvert, 2002).

The large triangle marked "LF411" in the center of the schematic is an operational amplifier, or op-amp, for short. An op-amp has two inputs and one output. (It also has positive and negative supply inputs, typically +/− 15 V, which are usually not shown in schematics.) In the schematic, the first input (marked +, and called the non-inverting input) is connected to a potentiometer. The second input (marked −, and called the inverting input) is connected to two circuit elements. It connects to the cathode of an LED, and to a 330 Ω resistor that connects to ground. The output of the op-amp is connected to the anode of that same LED. So the output of the op-amp is fed back to the inverting input, after first passing through the LED. Op-amps are almost always used with some type of feedback.

What does the op-amp do? For a good basic understanding of how op-amps work in circuits, you just need to understand two simple rules (Horowitz and Hill, 1989, 177):

  1. "The output attempts to do whatever is necessary to make the voltage difference between the two inputs zero.
  2. "The inputs draw no current."
These rules are simplifications—for example, the inputs do draw some current. For the LF411 op-amp used in this project, 0.2 nA. You won't be able to measure that with your DMM! So these op-amp rules, as the authors state, are "good enough for almost everything you'll ever do," (Horowitz and Hill, 1989, 177).

What do the op-amp rules mean for our LED control circuit? Let's examine the inputs to the op-amp to figure it out. The potentiometer connected to the non-inverting input provides a voltage, ranging between 0 and +5 V, depending on how far the knob is turned. Simple enough. OK, what about the inverting input? This is the feedback connection from the output. So, by rule 1, the op-amp output should do whatever is necessary to make the voltage at the inverting input match the voltage we set with the potentiometer.

Let's consider three examples:
  1. with the potentiometer knob all the way down (0 V),
  2. half-way up (+2.5 V), and
  3. all the way up (+5 V).

Example 1 is the easiest. With 0 V at the non-inverting input, there should be 0 V at the inverting input (rule 1), so the op-amp does nothing. No current flows through the LED.

With the potentiometer half-way up, the non-inverting input of the op-amp sees +2.5 V. How does the op-amp match that at the inverting input? It does it by passing current through the LED. How much current? Enough current so that the voltage at the inverting input equals +2.5 V. Where does the current go? The current flows to ground through the 330 Ω resistor (by rule 2, we know that the inputs draw no current, so the resistor is the only path to ground). By Ohm's Law, we have I = V/R = 2.5 V/330 Ω = 7.6 mA. So with the potentiometer half-way up, the op-amp output will provide 7.6 mA of current to the LED.

With the potentiometer all the way up, there is now +5 V at the non-inverting input. By the same analysis, we conclude that the current through the LED is now 15.2 mA. Perfect! The circuit has just the right range for a typical LED. The LF411 can supply 15 mA without a problem, so the behavior we expect from our op-amp rules is exactly the behavior that we get.

You can see from Ohm's Law that the LED current increases in direct proportion to the voltage from the potentiometer. Do some more calculations for more potentiometer settings to convince yourself that this is true. Then build the circuit and see how it actually performs. You'll be able to control the LED with good precision and repeatability. What colors will you be able to produce from red, green, and blue?

Terms and Concepts

To do this project, you should do research that enables you to understand the following terms and concepts:

Questions

Bibliography

You can read more about how we sense colors at this site:

  • Cooper, K. and C.J. Kazilek. (n.d.). Seeing Color. Ask a Biologist, Arizona State University. Retrieved March 5, 2007.

You can practice mixing colors with light on your computer screen with this website:

This webpage has useful information on LEDs:

Here is a page with an explanation of Ohm's Law:

  • Physics Department Staff. (n.d.). Ohm's Law. Physics Department, University of Guelph. Retrieved March 8, 2007.

The following references are recommended for more-advanced students:

More-advanced students will benefit from reading this page, which is the original source on which this project is based:

If you want to learn more about how op-amps work, this book is an excellent reference source, and we recommend it highly to those who are seriously interested in learning more about electronics:

Here are some additional electronics books, recommended by Prof. James B. Calvert, Associate Professor Emeritus of Engineering, University of Denver:

  • A. S. Sedra, A.S., and K.C. Smith (1987). Microelectronic Circuits, Second Edition. New York, NY: Holt, Rinehart and Wilson.
  • Jones, M.H. (1995). A Practical Introduction to Electronic Circuits, Third Edition. Cambridge, UK: Cambridge University Press.
  • ARRL. (2006). The ARRL Handbook for Radio Communications. Newington, CT: American Radio Relay League. (Frequently updated with new editions. Title varies slightly; for example, older editions entitled The ARRL Handbook for the Radio Amateur. Newer edition preferred, but any would be suitable. Dr. Calvert remarks: "A good source of explanations, practical information and data, with emphasis on communications electronics.")

Here is the technical data sheet for the LF411 op-amp (requires Adobe Acrobat Reader):

Materials and Equipment

The following electronic parts are available from Jameco Electronics:

Notes on electronics parts:

Tools:

Miscellaneous:

Disclaimer: Science Buddies participates in affiliate programs with Home Science Tools, Amazon.com, Carolina Biological, and Jameco Electronics. Proceeds from the affiliate programs help support Science Buddies, a 501(c)(3) public charity, and keep our resources free for everyone. Our top priority is student learning. If you have any comments (positive or negative) related to purchases you've made for science projects from recommendations on our site, please let us know. Write to us at scibuddy@sciencebuddies.org.

Experimental Procedure

Note Before Beginning: This science fair project requires you to hook up one or more devices in an electrical circuit. Basic help can be found in the Electronics Primer. However, if you do not have experience in putting together electrical circuits you may find it helpful to have someone who can answer questions and help you troubleshoot if your project is not working. A science teacher or parent may be a good resource. If you need to find another mentor, try to find someone who has hobbies like robotics, electronics, or building and fixing computers. You may also need to work your way up to this project by starting with an electronics project that has a lower level of difficulty.

Wiring the Potentiometers

  1. Here are some notes for before you start.
    1. Do your background research, and make sure that you are knowledgeable about all of the terms, concepts and questions.
    2. To avoid damage to components, the solderless breadboard should be powered off when your are building or making changes to the circuit.
    3. Do not turn on the power until the circuit is completed and you have double-checked all of your wiring paths.
  2. You'll need some knobs to twiddle, so take care of mounting and wiring your potentiometers first.
    1. Wear safety glasses for this step.
    2. A tunafish can makes a good, inexpensive support for the three potentiometers.
    3. Mark the center locations for the three holes. Use a center punch or tap a nail with a hammer to make a small depression at the center location so the drill bit won't slip.
    4. Drill a 5/16" hole for the shaft of each potentiometer. Go slow with the drill: the metal is thin, and the bit will tend to grab once it goes through. You'll have less problems with burrs if you go slow.
    5. Mark and drill a 5/16" hole in the side of the tuna can for running the hook-up wires.
    6. Mark the center and drill a 1/8" hole to the right of each shaft hole to accommodate the small mounting tab on the potentiometer.
    7. Carefully remove any burrs from the holes with a file.
    8. Mount the potentiometers in the can, using the provided washer and nut.
    9. Solder wires to the potentiometers (see Figure 5). Use red wire for the +5 V connection. Use black wire for the ground connection. For the center lug, I used red, green and black for the red, green and blue LEDs, respectively (didn't have any blue wire handy). (For the green and blue potentiometeres, remember that they are left-right reversed when you're working from the bottom!)

      Five wires are connected to three potentiometers inside an aluminum can
      Figure 5. Wiring the potentiometers. You can daisy-chain the +5 V wire (red) between the pots (right hand lug, when viewed from beneath, as in the photo). You can also daisy-chain the ground wire (black; left-hand lug, when viewed from beneath, as in the photo). The center lug is what goes to the non-inverting input of the op-amp (pin 3). To keep your connections straight, use a wire color that resembles the color of the LED (or label the wires).

    10. Add the knobs (Figure 6), and this part is done.

      A red, blue and green knob protrude from the underside of an aluminum can
      Figure 6. Completed potentiometer controls mounted in a tunafish can.

Building the Rest of the Circuit

  1. Next, you'll build the LED control circuits on the solderless breadboard. You can learn how to use a breadboard in the Science Buddies reference How to Use a Breadboard for Electronics and Circuits. Remember that the power supply for the breadboard should always be off when you are building the circuit!
    1. The LF411CN chip used in this project is an example of an integrated circuit (IC). The electronics industry has several different ways of making ICs, so you can often buy the same IC in several different physical formats or "packages." The LF411CN part used in this project is called a "dual inline plastic" (or "DIP") package.
    2. A DIP IC has two rows of metal "pins" coming out from each side. Figure 7 shows pin numbering scheme for the LF411 DIP package. The semi-circular depression at one end of the chip marks the "top" end of the chip. In this orientation, pin 1 is at the top left. (This is the electronics industry standard for all DIP packages.) Pin 1 is often additionally marked with a small circular depression. You count pin numbers down the pin 1 side, and then back up the other side. Thus on an 8-pin DIP, pin 8 is opposite pin 1, pin 7 is opposite pin 2, pin 6 is opposite pin 3, and pin 5 is opposite pin 4.

      Diagram of a rectangular dual-inline package has four pins on either side and a semi-circle cut into the top edge
      Figure 7. Pin numbering scheme for the LF411 DIP IC. The small semi-circular depression marks the top end of the chip. Pin 1 is at the top left. Often, the chip will also have a small circular depression next to the pin to mark pin 1. You count pin numbers down the pin 1 side, and then back up the other side.

    3. Figure 8 shows the schematic for an individual LED control. The numbers 2, 3, and 6 show which pin on LF411 IC chip corresponds to the connection in the schematic. Each LED gets its own control, so you need to make three copies of this circuit on your breadboard. Notice that the schematic does not show the connections for power to the LF411 (V+, pin 4, and V, pin 7).

      Circuit diagram of an operational amplifier wired to a resistor and LED
      Figure 8. Schematic of a single LED control circuit (Calvert, 2002).

    4. As described in the Introduction, you insert the LF411 IC into the breadboard so that chip straddles one of the gaps in the rows of holes. Make sure that each of the 8 pins is aligned with its proper hole, then carefully push the chip straight down.
    5. The first connections to make are the power supply connections for the LF411. Use jumper wires to connect the +15 V bus to pin 7 and the -15 V bus to pin 4.
    6. Next connect the 330 Ω resistor. One end of the resistor connects to pin 2, the other end connects to the ground bus. Use a needle-nose pliers to make 90° bends in the leads at the proper distance, then trim each lead to about 7-8 mm below the bend. Insert the resistor into the breadboard.
    7. Next connect an LED. Remember that the longer lead is the anode (+), which connects to pin 6, and the shorter lead is the cathode (-), which connects to pin 2. Use the needle-nose pliers to make a "jog" in the anode so that the ends of the leads are about the same length. Insert the anode into a hole above pin 6, insert the cathode into a hole beyond the end of the chip. Then use two jumpers to make an electrical path from the LED cathode to pin 2 of the LF411 (see Figure 9). Making the connection this way (rather than having the LED "straddle" the chip) keeps the circuit layout (and the LED leads) neater. A neater circuit has several advantages:
      • You have easier access to circuit points when you want to make voltage measurements with your digital multimeter.
      • The circuit is easier to understand.
      • You are less likely to make wiring mistakes, and more likely to catch them if you do.

        Three different colored LEDs and three dual-inline packages are connected to resistors with jumper cables on a breadboard
        Figure 9. Detail view of completed circuit on breadboard. Notice how the LF411 ICs span the gap between the holes in the breadboard. Power connections to each chip are made to pin 7 (+15 V) and pin 4 (−15 V). (Our breadboard has only two power bus lines, so we used the blue jumpers to "daisy-chain" the +15 V power connections. If your breadboard has enough bus lines, direct connections for each chip are preferable.) The 330 Ω resistors are connected between pin 2 of each chip and the ground bus. The anode (+ lead) of each LED connects to pin 6 of the appropriate LF411 chip, and the cathode (− lead) connects to pin 2. Notice how, for each LED, we used two jumpers to connect the cathode to pin 2. The center lug from each potentiometer is connected to pin 3 of the corresponding LF411 chip.

    8. The final component to connect is the potentiometer. Connect the +5 V lead for the potentiometers to the +5 V bus. Connect the ground lead for the potentiometers to the ground bus. Connect the center lug of each potentiometer to pin 3 of the corresponding LF411 chip. (Refer to Figure 6).
    9. Before you turn on the power for the first time, double-check all of your connections.
  2. Use your digital multimeter to measure the voltage between pin 3 (the output of the 10k potentiometer) and ground, as your assistant turns the knob up and down (if you need help using a multimeter, check out the Science Buddies reference How to Use a Multimeter). It should vary between 0 and about +5 V (your power supply may deliver a bit more than +5). Be careful to touch only a single pin; if your probe touches two pins at once, you'll short them, and you may destroy the chip.
  3. Do the same for pin 2. You should see values similar to what you saw on pin 3 as the potentiometer is turned. (Remember that, with feedback to the inverting input, the op-amp minimizes the voltage difference between its inputs.)
  4. As the voltage at pin 2 changes from 0 to +5 V, how does the current through the 330 Ω resistor vary? Notice that this is also the current through the LED.

Mixing Colors with the Circuit

  1. Your results will be best if you do this step in a darkened room.
  2. In order to mix light from the red, green, and blue LEDs to produce additional colors, you will need to project the light on to some surface. A slab of paraffin wax will work well. The wax is translucent, and it will diffuse the light.
    1. A small cardboard box, opened at both ends, will make a good support for the wax slab (see Figure 10). We used a coffee filter box, cut in half (dimensions approximately 12 cm x 4 cm x 10 cm (w x d x h). Tape some cardboard "struts" at the ends of the opening at the top so that the opened box keeps its shape.

      An open topped cardboard box is placed on a breadboard
      Figure 10. Cut-off cardboard box, used as support for wax slab.

    2. Place the wax slab on top of the box to use the wax as your translucent "projection screen" (see Figure 11).

      Red light shines through a translucent white block that is placed over the top of a cardboard box
      Figure 11. Wax illuminated by red LED.

  3. You'll notice that the LEDs appear brightest when you look straight down on them. Try to adjust them so that they project in overlapping circles on the wax.
    1. You may have an easier time with this if you solder some wire leads to the LEDs. Use needle nose pliers as a heat sink when you solder, so that you don't damage the LED. Hold the pliers closed with a rubber band on the handles. Clamp the pliers on the lead near the body of the LED. Do your soldering work on the side of the pliers that is away from the body of the LED.
    2. Strip the other ends of the wires so that they can connect to the breadboard.
    3. You can use heat-shrink tubing to insulate the exposed metal on the leads. Slide it over the soldered wire to cover the remaining metal, then warm it with a hair dryer to shrink it. Now you can safely bundle the LEDs together without risking a short circuit.
    4. Projecting a longer distance should help improve uniformity, but the light intensity will decrease in proportion to the square of the distance.
    5. Another trick you can use to get uniform illumination of the wax is to restrict the area of the wax that you can see. Cut a circular hole in a piece of black construction paper and place it over the wax (Figure 12). The size of your cut-out should match the area of uniform illumination on the wax.

      Red light shines through a circle cut into black paper that has been placed over a translucent white block
      Figure 12. Restricting the visible area for more uniform illumination.

  4. Start with just one pair of LEDs, for example, red and green. Turn up the red LED part-way and observe the color. Now add a bit of green light. What happens? Add a bit more and see what happens. What different colors can you make by mixing different levels of these two lights?
  5. Try all of the possible pairwise combinations, then try with all three LEDs.
icon scientific method

Ask an Expert

Do you have specific questions about your science project? Our team of volunteer scientists can help. Our Experts won't do the work for you, but they will make suggestions, offer guidance, and help you troubleshoot.

Global Connections

The United Nations Sustainable Development Goals (UNSDGs) are a blueprint to achieve a better and more sustainable future for all.

This project explores topics key to Industry, Innovation and Infrastructure: Build resilient infrastructure, promote sustainable industrialization and foster innovation.

Variations

  • For a more basic experiment on color mixing, see the Science Buddies project Mixing Light to Make Colors.
  • Does everyone see the same colors? Here's a way to use your circuit to investigate this question. Make sure that your LEDs are well-aligned, and that the wax slab is masked off with black so that only a uniformly illuminated area is visible. Do the testing in a darkened room. Set the red LED a middle value. Use your DMM to measure the voltage setting for the red LED (either pin 2 or pin 3 on the corresponding LF411), and record it in your notebook. You'll need to start out with this same voltage for the red LED for each test subject. Have your volunteers adjust only the green LED, until the color that they see is neither green, nor red. They should get a pure color, without any tinge of green or red. When they are finished, use your DMM to measure the voltage setting for the green LED. How close are the values for the green LED across all of your test subjects?
  • For a method for measuring LED output as a function of current, see the Science Buddies project How Does LED Brightness Vary with Current? That project uses a light-to-voltage converter, an IC that contains a photodiode and an op-amp. The photodiode produces a current when exposed to light, and the op-amp produces a voltage proportional to the photodiode current. The photodiode is more sensitive to some wavelengths of light than others, so you'll have to take that into account if you want to compare the brightness of red, green, and blue LEDs. The datasheet for the light-to-voltage converter has a spectral responsivity curve for the photodiode that you can use for this purpose (see the Bibliography section in the linked project).
  • You can use paraffin wax to make a Joly photometer, a simple device that will allow you to match the intensity (and color) of two light sources. Illuminate one side of the photometer with colored light produced using a colored filter over a flashlight (or slide projector). Can you match the color with light projected from your red, green, and blue LEDs?
  • Try using the color picker for an application on your computer (either the operating system itself, or drawing programs usually have this feature). See what RGB values correspond to particular colors. Can you use this information as a guide to reproduce the colors with the LEDs? Note that on your monitor, as the values get higher, the additional intensity for a given numerical change becomes greater. To learn more about this, look for information on the "gamma function" for computer monitors.
  • This project is live now: Linear vs. Logarithmic Changes: What Works Best for Human Senses?

Careers

If you like this project, you might enjoy exploring these related careers:

Career Profile
Electricians are the people who bring electricity to our homes, schools, businesses, public spaces, and streets—lighting up our world, keeping the indoor temperature comfortable, and powering TVs, computers, and all sorts of machines that make life better. Electricians install and maintain the wiring and equipment that carries electricity, and they also fix electrical machines. Read more
Career Profile
Just as a potter forms clay, or a steel worker molds molten steel, electrical and electronics engineers gather and shape electricity and use it to make products that transmit power or transmit information. Electrical and electronics engineers may specialize in one of the millions of products that make or use electricity, like cell phones, electric motors, microwaves, medical instruments, airline navigation system, or handheld games. Read more
Career Profile
Electrical engineering technicians help design, test, and manufacture electrical and electronic equipment. These people are part of the team of engineers and research scientists that keep our high-tech world going and moving forward. Read more

News Feed on This Topic

 
, ,

Cite This Page

General citation information is provided here. Be sure to check the formatting, including capitalization, for the method you are using and update your citation, as needed.

MLA Style

Science Buddies Staff. "Color Mixing with Red, Green, & Blue LEDs." Science Buddies, 26 Oct. 2023, https://www.sciencebuddies.org/science-fair-projects/project-ideas/Elec_p038/electricity-electronics/color-mixing-with-red-green-blue-leds. Accessed 19 Mar. 2024.

APA Style

Science Buddies Staff. (2023, October 26). Color Mixing with Red, Green, & Blue LEDs. Retrieved from https://www.sciencebuddies.org/science-fair-projects/project-ideas/Elec_p038/electricity-electronics/color-mixing-with-red-green-blue-leds


Last edit date: 2023-10-26
Top
We use cookies and those of third party providers to deliver the best possible web experience and to compile statistics.
By continuing and using the site, including the landing page, you agree to our Privacy Policy and Terms of Use.
OK, got it
Free science fair projects.