Use an Arduino™ to Control a Color-Changing Infinity Mirror
Cutting plexiglass can create jagged edges or small shards of material. Always wear protective eyewear when cutting plexiglass.
Ben Finio, PhD, Science Buddies
- Arduino is a registered trademark of Arduino and its partners.
If you want a Project Idea with full instructions, please pick one without an asterisk (*) at the end of the title.
AbstractThis project is a follow-up to the Science Buddies project Explore Optical Illusions: Build an Infinity Mirror, which shows you how to build a basic infinity mirror using light emitting diodes (LEDs) and arts and crafts materials. What if you wanted to build an infinity mirror that could change colors, like the one in Figure 1?
Figure 1. A color-changing infinity mirror.
You can do this by using special RGB (red, green, and blue) LEDs. Just like the pixels on a TV or computer monitor, an RGB LED actually contains three distinct color LEDs that can be controlled individually. Adjusting the relative brightness of the three base colors enables you to create a huge combination of other colors. Figure 2 shows the basic color combinations.
- Note: Additive color mixing, which is what occurs when you add two or more different colors of light, is different from subtractive color mixing, which is what happens when you mix two or more different paints or pigments. Can you look up the difference between the two terms, and explain which one is used in this project?
Figure 2. Additive color mixing: Red and green are combined to make yellow; red and blue are combined to make magenta; and blue and green are combined to make cyan. All three colors are combined to make white, and the absence of any color leaves black. (Image credit: Wikimedia Commons user Quark67, 2006)
So, how do you control the individual brightness of the red, green, and blue LEDs? Engineers and hobbyists commonly do this using pulse-width modulation or PWM. Pulse-width modulation essentially means that you flick the LED on and off very fast, much faster than the human eye can see. Varying the width of the "pulse" relative to the on-off period is called the duty cycle. A duty cycle of 0% means the LED is never on, and will appear dark. A duty cycle of 100% means the LED is always on, and will appear at full brightness. A duty cycle of 50% means the LED is on half the time and off half the time — so it will light up, but not as bright as a 100% duty cycle. Figure 3 shows graphs of voltage vs. time for different duty cycles.
Figure 3. Graphs of voltage versus time for different duty cycles. The greater the duty cycle, the brighter an LED will appear. These graphs are just for illustration purposes, so the axes do not have specific units. For example, if an LED is on for 1/100th of a second and off for 1/100th of a second, or on for one second and off for one second, in both cases the LED has a 50% duty cycle.
How would you go about using pulse-width modulation to control the brightness of three different LEDs? You have probably guessed that manually flicking three switches on and off as fast as you can is not going to work. This is where a microcontroller comes in handy. You can program a microcontroller, like the popular Arduino™, to electronically control LEDs using pulse-width modulation. Can you build your own infinity mirror with RGB LEDs that are controlled by a microcontroller, like the one in Figure 1?
Because this is an abbreviated project idea, Science Buddies will not provide an exact list of materials or a procedure you can follow to build a specific type of mirror. Instead, you will have to do some of your own background research and figure out how to use an Arduino and build an infinity mirror. The references in the Bibliography can help you get started, but how exactly you design, build, and control your mirror is up to you. The possibilities are nearly endless for the sensors and control mechanisms you can use with an Arduino. Here are just a few ideas you can try:
- Use individual control knobs to manually adjust the three LED colors (as the first reference in the Bibliography does).
- Make the LEDs react to sound from an audio source, like an MP3 player or a microphone (search the Web for something along the lines of "sound activated LED" and you will find many good tutorials).
- Control the color of the LEDs with a distance sensor that measures how far a person looking at the LEDs is standing in front of the mirror.
- Make a temperature-controlled infinity mirror using a temperature sensor.
- Use a light sensor to automatically turn the LEDs on when the room is dark and turn them off when the room is bright.
- Make the LEDs change color based on the time of day.
- Use a digital LED strip (also referred to as an addressable LED strip), where the color of each RGB LED can be controlled individually (the mirror in Figure 1 uses an analog LED strip, where each RGB LED must be the same color).
Ask an Expert
If you like this project, you might enjoy exploring these related careers:
Contact UsIf you have purchased a kit for this project from Science Buddies, we are pleased to answer your questions.
In your email, please follow these instructions:
- What is your Science Buddies kit order number?
- Please describe how you need help as thoroughly as possible:
Good Question I'm trying to do Experimental Procedure step #5, "Scrape the insulation from the wire. . ." How do I know when I've scraped enough?
Good Question I'm at Experimental Procedure step #7, "Move the magnet back and forth . . ." and the LED is not lighting up.
Bad Question I don't understand the instructions. Help!
Good Question I am purchasing my materials. Can I substitute a 1N34 diode for the 1N25 diode called for in the material list?
Bad Question Can I use a different part?