Arduino Controlled RGB LED Infinity Mirror
Project Overview
Creating a mesmerizing RGB LED infinity mirror that offers adjustable speed fade and direct control modes for individual red, green, and blue LED brightness levels is a captivating project. It combines the inspiration from the Infinity Mirror Instructable and Adafruit's RGB LED Strip tutorial, along with numerous other valuable resources.
For those with expertise and a desire to explore different design options while keeping costs under control, customizing the materials and choosing an alternative Arduino board is an option. Alternatively, it's possible to simplify the project and create a basic, budget-friendly infinity mirror without using an Arduino. On the other end of the spectrum, one could invest significant amounts of money, reaching hundreds or even thousands of dollars, to craft an extraordinary masterpiece.
Remember, the possibilities are endless, and depending on your preferences and skills, you can embark on this project with various approaches, resulting in unique and awe-inspiring outcomes.
Project Preparation
Arduino UNO R3
Arduino/breadboard stand (optional)
Four 10K potentiometers
Three N-channel MOSFETs
SPDT power switch
22 AWG connecting wire (black)
22 AWG connecting wire (red)
Barrel Jack Breadboard Adapter
12V/5A DC power supply
Iron
Lead-free solder
Wire strippers
Mini needle nose pliers
Electric drill
Super glue
Electrical tape
How to work?
Unsurprisingly, there is no mystical phenomenon involved in the functioning of an infinity mirror. The key lies in the clever use of two mirrors with different properties of transmittance and reflectivity. In our everyday encounters, we typically come across mirrors that reflect 100% of the light, known as regular mirrors. Behind the infinity mirror, there is indeed a regular mirror. However, the front mirror, which faces outward, is coated with a tinted window film that only reflects about half of the light*.
When the LED is placed between these two mirrors, a portion of the light manages to escape through the front mirror and reaches our eyes. The remaining light reflects off the rear mirror and re-enters the front mirror, initiating a seemingly infinite cycle. This continuous bouncing of light creates the mesmerizing effect, hence the name "infinity mirror." However, with each reflection, a small amount of light escapes, causing subsequent illusions of LEDs to appear slightly dimmer until they eventually fade away. Consequently, it is not possible to perceive an infinite number of LEDs.
It's worth noting that this illusion is not achieved by the notion that window tints "only permit light in one direction," a common misconception. To achieve the desired effect, the side of the front mirror facing the observer (the outside world) must be considerably darker than the side with the LEDs (inside the infinity mirror). This concept is akin to the familiar scenes in crime dramas or movies where an individual is interrogated in a room with a mirror on the wall, while someone watches from the other side of the mirror as if it were a window. However, this scenario only works when the interrogation room is well-lit, while the observation room remains dark.
*Please note that the exact percentages of reflectance and transmittance may vary depending on the type of window film used. Different regions and states may also have regulations specifying the permissible levels of reflectance and transmittance for car windows. If you are curious, a quick internet search can provide further information on this topic.
Build the Circuit
It's a wise approach to build, test, and debug the circuit before constructing the actual mirror. Imagine the disappointment of investing in a beautiful mirror only to discover that something isn't functioning as expected. So, let's begin by assembling the circuit and testing the LED strip to ensure everything works smoothly. Here's a step-by-step breakdown:
Start by setting up the circuit on a breadboard, referring to the third breadboard diagram or the circuit diagram if you're familiar with breadboards. Begin by placing three MOSFETs, four potentiometers, an SPDT switch, and a barrel jack adapter on the breadboard. In the image above, these components are marked as "transparent," allowing you to clearly see their pin configurations*.
Next, connect wires to establish connections with the power and ground rails. In the image, I've color-coded them as red and black, but keep in mind that if you only have a multicolor jumper kit without red and black wires, you can use any available colors. Notice that one of the breadboard rails is connected to the +12V supply from the barrel jack, which powers the Arduino through Vin. The other rail is connected to the Arduino's +5V supply pin, while both share a common ground. Be extremely cautious not to accidentally short-circuit the +12V and +5V supplies!
Now, add wires to connect to the Arduino's input and output, as well as the wires that will link to the LED strip (if your strip already has pre-soldered wires, use those)**. In the image, I've color-coded the respective wires as red, green, and blue. However, feel free to use the available wires you have on hand for these connections.
By following these steps, you'll establish a solid foundation for your circuit and be ready to test the functionality of the LED strip. Taking the time to build and test the circuit beforehand will ensure a more successful and enjoyable experience when constructing the actual infinity mirror.
How does the circuit work?
Understanding the inner workings of a circuit and its components is essential for experienced individuals. However, for those who are curious, we will provide a brief overview.
To power the breadboard and LED strip, a +12V power supply is connected using a barrel jack adapter. This power also feeds into the Arduino through its Vin pin. While the Arduino's built-in barrel plug can accept +12V power, it is not ideal to run the LED's high current through the Arduino board. By distributing the current, the Arduino draws only the necessary amount while the remaining current flows directly from the breadboard to the LED. We extend our gratitude to the Adafruit support forum for their valuable insights on this matter.
The SPDT switch serves as a toggle switch to select different program modes. These modes include a "color fade" mode where the LED displays a spinning array of colors, and a direct control mode where individual LED colors can be adjusted. The middle pin of the switch is connected to one of the Arduino's digital input pins, while the outer two pins are connected to +5V and ground. Based on the switch's position, the Arduino's digitalRead() function detects a high or low signal to execute the corresponding program instructions.
The potentiometer acts as a control mechanism based on the selected program mode. In direct control mode, three potentiometers are used to adjust the brightness of the red, green, and blue LEDs. In fade mode, a single potentiometer determines the speed of color fading. A potentiometer typically consists of three pins. Similarly to the switch, one pin connects to +5V, and another pin connects to ground. However, unlike a switch, a rotary potentiometer provides a continuous range of voltage values (between 0V and 5V) through its middle pin. This middle pin is connected to the Arduino's analog input. Utilizing the analogRead() function, the Arduino converts the varying voltage into a numerical value ranging from 0 to 1023 for program manipulation (refer to the next step for details).
For those who are new to the world of electronics, understanding MOSFETs can be quite challenging. These components are crucial for driving high-power devices such as motors, solenoids, and LED strips, as they often require more current than what the Arduino can provide. While the Wikipedia page on MOSFETs can be overwhelming, I'll attempt to provide a simplified explanation here.
A MOSFET consists of three pins: Gate (G), Drain (D), and Source (S). In its simplest form, a MOSFET acts like a valve, controlling the flow of current from the drain to the source. The gate serves as the control for this valve, similar to a garden hose valve that opens and closes. However, instead of mechanical control, the MOSFET's gate is controlled electrically. When a voltage is applied to the gate from one of the Arduino's output pins, the MOSFET "turns on," allowing high current to flow from the drain to the source without drawing any current from the Arduino itself. Conversely, if the voltage from the Arduino to the gate is zero, the MOSFET turns off, stopping the current flow. This enables the Arduino to control large motors and lights using a small amount of current, as long as there is an external power source capable of handling the load.
Another important concept to mention is pulse width modulation (PWM), a widely used technique for controlling LED brightness using an Arduino. Since the Arduino's output pins are digital, they can only output a high (5V) or low (0V) signal. They cannot continuously vary the voltage to adjust LED brightness or motor speed. However, they can send rapid pulses, much faster than what the human eye can perceive (about 500 pulses per second on an Arduino). Each pulse consists of a high segment and a low segment, and the relative duration between the two determines the perceived "brightness." For instance, a pulse with 0% high and 100% low appears as "off," while a pulse with 100% high and 0% low represents full brightness. A pulse with a 50% high and 50% low ratio results in approximately half brightness. In this circuit, a PWM signal is sent to a MOSFET, which in turn controls the flow of high current through the LED, enabling a fade effect and adjustable brightness.
Summarize
If you are interested in more Arduino LED projects, you can go to my TechSparks to learn more.