arduino-controlled rgb led infinity mirror

12
Arduino-controlled RGB LED Infinity Mirror by Ben Finio Update 11/22/2013: Thanks to everyone who voted for this project in the Microcontroller Contest ! It was one of three first-prize winners. Update 9/17/2013 : Thanks to everyone who voted for this project in the Arduino contest (I was one of ten "second prize" winners)! If you want to try this project with an addressable LED strip instead of an analog strip, check out the Rainbow Jar project (also an Arduino contest winner). This is my take on a combination of two classic projects: RGB LED control with an Arduino, and an Infinity Mirror. It's an RGB LED infinity mirror that lets you toggle between an adjustable-speed color-fade mode and a direct-control mode where you individually set the red, green, and blue LED brightness levels. The primary inspiration for this particular project comes from this infinity mirror Instructable and Adafruit's RGB LED Strip tutorial , but there are many more quality resources out there on both projects. I've done my best to gear this project towards newbies by providing an exact list of materials I used and the exact procedure that I followed. One recurring theme I've noticed in comment sections for other infinity mirrors is a lack of links to specific parts (e.g. exactly what type of LEDs or LED strips were used, what power supply, where to buy the mirrors, the enclosure...). Clearly, if you know what you're doing and want to spend more (or less) money to design a slightly different mirror, you can adjust your materials as needed, use a different Arduino board, etc. You can skip the Arduino entirely and make a pretty simple, cheap infinity mirror if you want (just search Instructables for "infinity mirror" and you'll find a few), or go crazy and spend hundreds if not thousands of dollars (search YouTube for "infinity mirror table" and you'll get the idea). So, on to the materials list. Remember that this is an exact list of parts that I used, but I gradually cobbled together the supplies for this project over a long period of time. I didn't sit down, compare vendors (e.g. Adafruit vs. Sparkfun) and find the absolute cheapest way to build this. So, feel free to shop around to bring down the cost (and post links in the comments if you find a better/cheaper version of a certain part!). Quantities are just 1 (one) unless otherwise noted, prices are rounded to the nearest dollar as of September 2013. Materials: Electronics Arduino UNO R3 with mini breadboard and jumper wires. I have the Getting Started with Arduino Kit from Maker Shed ($65). (Optional): Arduino/breadboard holder. The Maker Shed kit didn't come with one - I 3D printed this cool minimalist design I found on Thingiverse. 1 meter RGB LED strip ($25). This is an analog strip, which means you can only control the color of the whole strip at once. SparkFun also carries a digital RGB LED strip which has individually addressable LEDs (if you wanted to send pulses of light down the strip one LED at a time, or have some other pattern), but it's more expensive ($45) and you'll need completely different Arduino code. Both strips can be cut to length to fit your mirror. Four 10K potentiometers ($1 each). Three N-channel MOSFETs ($1 each). SPDT power switch ($1.50). 22 AW G hookup wire (black), 100 feet ($8). This is only required if you pref to color-code your V+ and ground connections with red and black respectively. Otherwise you can just use the multi-colored jumper wires that come with most Arduino kits. 100 feet is also WAY more than you'll need for this project, but you can never have too much hookup wire! You can get a smaller 25' roll from SparkFun. 22 AWG hookup wire (red), 100 feet ($8). Same note as above, with smaller roll here . Barrel jack breadboard adapter ($1). 12V/5A DC power supply ($25). This is a big place to potentially save money. The RGB LED

Upload: jjbateman

Post on 19-Jan-2016

137 views

Category:

Documents


0 download

DESCRIPTION

This is my take on a combination of two classic projects: RGB LED control with an Arduino, and an Infinity Mirror. It's an RGB LED infinity mirror that lets you toggle between an adjustable-speed color-fade mode and a direct-control mode where you individually set the red, green, and blue LED brightness levels. The primary inspiration for this particular project comes from this infinity mirror Instructable and Adafruit's RGB LED Strip tutorial, but there are many more quality resources out there on both projects.

TRANSCRIPT

Page 1: Arduino-controlled RGB LED  Infinity Mirror

Arduino-controlled RGB LEDInfinity Mirror

by Ben Finio

Update 11/22/2013: Thanks to everyone who voted forthis project in the Microcontroller Contest! It was one ofthree first-prize winners.

Update 9/17/2013: Thanks to everyone who voted forthis project in the Arduino contest (I was one of ten"second prize" winners)! If you want to try this projectwith an addressable LED strip instead of an analogstrip, check out the Rainbow Jar project (also anArduino contest winner).

This is my take on a combination of two classic projects: RGB LED control with an Arduino, and anInfinity Mirror. It's an RGB LED infinity mirror that lets you toggle between an adjustable-speedcolor-fade mode and a direct-control mode where you individually set the red, green, and blue LEDbrightness levels. The primary inspiration for this particular project comes from this infinity mirrorInstructable and Adafruit's RGB LED Strip tutorial, but there are many more quality resources outthere on both projects.

I've done my best to gear this project towards newbies by providing an exact list of materials I usedand the exact procedure that I followed. One recurring theme I've noticed in comment sections forother infinity mirrors is a lack of links to specific parts (e.g. exactly what type of LEDs or LED stripswere used, what power supply, where to buy the mirrors, the enclosure...). Clearly, if you knowwhat you're doing and want to spend more (or less) money to design a slightly different mirror, youcan adjust your materials as needed, use a different Arduino board, etc. You can skip the Arduinoentirely and make a pretty simple, cheap infinity mirror if you want (just search Instructables for"infinity mirror" and you'll find a few), or go crazy and spend hundreds if not thousands of dollars(search YouTube for "infinity mirror table" and you'll get the idea).

So, on to the materials list. Remember that this is an exact list of parts that I used, but I graduallycobbled together the supplies for this project over a long period of time. I didn't sit down, comparevendors (e.g. Adafruit vs. Sparkfun) and find the absolute cheapest way to build this. So, feel freeto shop around to bring down the cost (and post links in the comments if you find a better/cheaperversion of a certain part!). Quantities are just 1 (one) unless otherwise noted, prices are rounded tothe nearest dollar as of September 2013.

Materials: Electronics

Arduino UNO R3 with mini breadboard and jumper wires. I have the Getting Started withArduino Kit from Maker Shed ($65).(Optional): Arduino/breadboard holder. The Maker Shed kit didn't come with one - I 3D printedthis cool minimalist design I found on Thingiverse.1 meter RGB LED strip ($25). This is an analog strip, which means you can only control thecolor of the whole strip at once. SparkFun also carries a digital RGB LED strip which hasindividually addressable LEDs (if you wanted to send pulses of light down the strip one LED ata time, or have some other pattern), but it's more expensive ($45) and you'll need completelydifferent Arduino code. Both strips can be cut to length to fit your mirror.Four 10K potentiometers ($1 each).Three N-channel MOSFETs ($1 each).SPDT power switch ($1.50).22 AWG hookup wire (black), 100 feet ($8). This is only required if you pref to color-codeyour V+ and ground connections with red and black respectively. Otherwise you can just usethe multi-colored jumper wires that come with most Arduino kits. 100 feet is also WAY morethan you'll need for this project, but you can never have too much hookup wire! You can get asmaller 25' roll from SparkFun.22 AWG hookup wire (red), 100 feet ($8). Same note as above, with smaller roll here.Barrel jack breadboard adapter ($1).12V/5A DC power supply ($25). This is a big place to potentially save money. The RGB LED

Page 2: Arduino-controlled RGB LED  Infinity Mirror

12V/5A DC power supply ($25). This is a big place to potentially save money. The RGB LEDstrip I used requires 12V, and according to the datasheet, draws 60mA for every 3-LEDsegment (the smallest unit the strip can be cut into). So at 60 LEDs for the whole strip, that'san absolute maximum of 1.2A at full brightness. I had a 12V charger laying around from someold long-forgotten device, but it was only rated at 0.5A and couldn't light the whole strip. So, Iwent ahead and bought a beefy supply because I figured it would be useful for future projectsanyway. Adafruit and SparkFun both carry smaller, cheaper 12V supplies (1A and 600mArespectively) that might suit your needs just fine depending on the size of your mirror and howmany LEDs it will use. You could also scavenge something like an old laptop charger, but besure to check the output voltage and current specs (usually printed on the label)

Materials: Building the Mirror

Important: there are three main parts that need to fit together to build this: the regular mirror,the frame, and the one-way mirror. First, it's easiest if you can find a cardboard/paper machelid and a regular mirror that will fit snugly inside it - the parts I bought didn't fit togetherperfectly, so I had to use a workaround (see Step 6). Second, cutting acrylic can be a paindepending on the tools you have available, so plan accordingly (see Steps 9 and 10). There'salso an important consideration regarding the LED strip, which can't be cut to any length - ithas to be cut in multiples of 3-LED segments, which are just shy of 2" long - so you want theinside perimeter of your mirror frame to be a multiple of that length. So, I'll link to the parts Iused to build my mirror, but you can still follow these directions to build a mirror of a differentsize or shape.

9" diameter circular mirror. I bought this kit of 7 mirrors ($14) with the intent of also makingsome smaller infinity mirrors.

Kit of 8", 9", and 10" diameter round paper mache boxes ($9). Important - I bought thesehoping that the 9" diameter mirror would fit snugly inside either the 9" lid or the box itself (andbecause I couldn't find individual boxes for sale on Amazon). It didn't. The 9" lid was just toosmall, and the 10" box was too big. So, I made it work by cutting out the top of the 9" lid, andjust using the rim. This will make sense if you skip ahead and look at the pictures in Step 6.Point being, ideally you should use a mirror that fits snugly inside a paper mache lid or box.

1/8" thick 12"x12" sheet of clear cast acrylic (plexiglass). Available on Amazon ($8) andMcMaster-Carr ($9). Acrylic is super easy to cut if you have access to a laser cutter. I don't,so I tried using a jigsaw (Step 9) and a score-and-snap method (Step 10). Both workedreasonably well but resulted in some jagged edges, and in hindsight would have worked muchbetter for a rectangular mirror instead of a round one. If you want to build a slightly smallermirror, McMaster sells pre-cut 6" diameter circles. I didn't shop around much for larger pre-cut circles but you might be able to find them.

Mirrored window tint. I ordered this stuff from Amazon ($27) but you can easily find this inhardware stores. Probably hard to find in small quantities, so plan on having plenty left over.

Black paint. I picked up a can of generic black spray paint ($3) at A.C. Moore.

Optional: if you want to get really fancy, you might be able to order a custom-sized one waymirror, instead of putting mirrored window tint onto a piece of plexiglass. This will probablygive you a higher optical quality in your final product, but I didn't look into it.

Tools

Soldering iron. I have this variable temperature one from SparkFun ($45). You might be able to getaway without one, depending on how your LED strip arrives. The SparkFun product page says"You will need to solder on your own wires.", but my strip arrived with all four wires alreadysoldered on. Even so, pushing the ends of the (stranded) wires into a breadboard can be a pain, soI recommend soldering on small segments of solid-core wire to make that easier.Lead-free solder ($8).Wire strippers ($5), if you don't already have a pair that can strip 22 AWG. Again, you cansqueeze by without these if necessary, but I'm betting most people reading this have wire strippers.Mini needle nose pliers ($2) if, like me, you're clumsy and hate handling tiny breadboardcomponents with your fingers.Power drill (see Step 6 - you can probably just get away with a sharp knife)Super glueElectrical tape

Page 3: Arduino-controlled RGB LED  Infinity Mirror

Got all that? Time to start building!

Step 1: How does an infinity mirror work?Ok, almost time to start building. First, I want to pre-emptively address another common comment: how dothese things actually work?

Not surprisingly, there is no magic involved. The secretis that the infinity mirror actually contains two mirrorswith different transmissivity and reflectivity. For allpractical intents and purposes, mirrors that we deal within everyday life are 100% reflective (technically a tinyamount of light will also be absorbed, but we can ignorethat for now). That's the regular mirror at the "back" ofthe infinity mirror (on the left in the diagram above). The tinted window film, however (on the right inthe diagram above), only reflects about half of the light that hits it*. This means that, when yousandwich an LED between the two mirrors, some of the light escapes through the front mirror andinto your eye. The rest is bounced back off the rear mirror, then into the front mirror again, and thisprocess continues off to infinity - thus the name. But, since a little bit of light escapes each time,each successive illusionary LED that you see will look a little bit dimmer, until they graduallydisappear - you can't actually see infinitely many LEDs.

Note that this does not work because the window tint "only lets light through in one direction", whichis a common misconception. In order for the illusion to work properly, the side of the front mirrorthe observer is on (the outside world) must be much darker than the side with the LEDs (inside theinfinity mirror). This is the same effect that you see in crime dramas/movies where someone is heldin an interrogation room that has a mirror on the wall, but there are people on the other side of thatmirror observing as though it's just a window. That only works if the interrogation room is well-lit andthe observation room is dark.

*The exact percentages of reflectivity/transmissivity might vary depending on what kind you buy -different levels of reflectivity and transmissivity are actually regulated in different states for use incar windows, Google it if you're curious.

Page 4: Arduino-controlled RGB LED  Infinity Mirror

Step 2: Building the CircuitIt's probably a good idea to build, test, and debug yourcircuit before you build the mirror. Otherwise, it wouldbe quite sad if you get a nice, fancy mirror built only tothrow the switch and find out something doesn't work.So, first let's assemble the circuit and test the LED strip.If you're new to circuits and don't understand what'sgoing on, you can either (a) just blindly follow thedirections, or (b) look ahead to the next step for anexplanation of how the circuit works.If you have experience working with breadboards, youcan go ahead and assemble the circuit based on thethird breadboard diagram above, or directly from the

circuit diagram. For newbies I broke it into three steps, hopefully to make things less overwhelming- corresponding to the first three diagrams above:

1) Populate the breadboard with the three MOSFETs, four potentiometers, SPDT switch, and barreljack adapter. I made these parts "transparent" in the figure above so you can see exactly wheretheir pins go*.

2) Add wires to connect to your power and ground rails. I've color-coded these with red and blackhere, but remember that you can use whatever colors you want if you just have a multi-coloredjumper wire kit and no red and black hookup wire. Notice how one of the breadboard rails isconnected to the +12V supply from the barrel jack (which feeds power to the Arduino through Vin),and one is connected to the Arduino's +5V power pin, but they share a common ground. Whateverelse you do, don't short the +12V and +5V supplies together!

3) Add wires to connect to the Arduino's inputs and outputs, and wires that you will connect to yourLED strip (if your strip came with pre-soldered wires, use those)**. Again, I've color-coded therespective red, green, and blue wires here but your ability to do that will depend on what wire youhave available.

* I started making this diagram in Fritzing, but got frustrated with the enormous amount of spacecomponents like MOSFETs and potentiometers take up in breadboard view mode (they give aquasi-3D view instead of a "top-down" view, so take up way more space than they do in real lifeand obscure other things on the breadboard). So, I took a screenshot of the Arduino andbreadboard and drew over them in Powerpoint.

** If your LED strip did come with pre-soldered wires, be careful about the color coding.SparkFun's product page notes that the blue and green wires are switched, which can be irritatingbut won't cause any harm. My strip came with a black wire connected to V+, and getting thepolarity reversed on the LED strip could be bad news. I guess I understand not wanting to use twored wires (one for V+ and one for the red LEDs) but I wish they'd use something other than blackfor V+.

Page 5: Arduino-controlled RGB LED  Infinity Mirror

Step 3: How Does the Circuit Work?This is a rough explanation of how the circuit works andwhat the components are for. Seasoned veterans canskip this step, but read on if you're curious. I don't havetime to write a whole introductory chapter on circuits soI've tried to provide relevant links when possible.The barrel jack adapter provides a +12V supply to thebreadboard. This is required to power the LED strips,and also powers the Arduino through its Vin pin.Technically, the Arduino's built-in barrel plug will accepta +12V supply, which you can then access through theVin pin, but the LEDs draw a lot of current - more thanyou want running through the Arduino board. This way,

the current "splits up" - the Arduino only draws what it needs, and the high current goes straight tothe LEDs through the breadboard. Special thanks to the Adafruit support forums for helping mefigure this out.The SPDT switch just acts as a toggle to select which "mode" the program is in. The details of thecode are explained in the next step, but essentially it just switches between a "color fade" mode thatrotates through different colors, and a direct-control mode where you control individual red, green,and blue LED brightness. The middle pin of the switch is connected to one of the Arduino's digitalinput pins, and the outer two pins are connected to +5V and ground. So, depending on which waythe switch is flipped, the program reads a digital HIGH or LOW using the digitalRead() function andacts accordingly (note: SPDT stands for "single-pole double-throw", the Wikipedia page onswitches has a nice table summarizing the different types of switches, with diagrams).The potentiometers are your "controls" depending on which mode the program is in. In individual-control mode, the three potentiometers control brightness of the red, green, and blue LEDsrespectively. In color-fade mode, a single potentiometer controls the speed of the fading. Thepotentiometers have three pins. Like the switch, one pin is connected to +5V, and one pin toground. However, unlike the switch, rotating the potentiometer makes the voltage on the middle pinvary continuously between 0V and 5V, instead of just toggling between the two. So, the middle pinsof the potentiometers are connected to the Arduino's analog inputs. Then, using the analogRead()function, the Arduino converts that voltage to a number between 0 and 1023 for use in the program(see next step).The MOSFETs are probably the trickiest part to understand for a newcomer to electronics. Theseare required to drive "high power" devices like motors, solenoids and LED strips, which frequentlyrequire more current than the Arduino can supply. The Wikipedia page on these is actually ratherdense, so I'll try to give a simplified explanation here. The MOSFET has three pins, called the "gate"(G), "drain" (D), and "source" (S). In its simplest form, the MOSFET acts like a valve that letscurrent flow from the drain to the source. The "gate" controls this valve (think of opening andclosing a valve to a garden hose), except that control is electrical instead of mechanical. A voltageapplied to the gate from one of the Arduino's output pins turns the MOSFET "on" - allowing highcurrent to flow from the drain to the source, without actually drawing any current from the Arduino.If the voltage to the gate from the Arduino is zero, the MOSFET shuts off and stops current fromflowing. This way you can control even enormous motors and lights with a tiny little Arduino, as longas you have an external power supply big enough to handle it.I should also mention pulse width modulation (PWM). This is a common technique used tocontrol LED brightness with an Arduino. In short, the Arduino's output pins are digital, so they canonly output a HIGH or a LOW (5V or 0V). They can't continuously vary their voltage to adjustsomething like LED brightness or motor speed. Instead, what they can do is send out very rapidpulses (roughly 500 times per second with the Arduino), much faster than the human eye can see.Each pulse consists of a HIGH segment and a LOW segment, and the relative ratio between the twodetermines the "brightness" that we actually see. A pulse that is 0% high and 100% low will just looklike "off". 100% high and 0% low will be "full brightness", and 50% high/50% low will be about half-brightness. You get the idea. In this circuit, a PWM signal is sent to the MOSFETs, which thencontrols the high current going through the LEDs, allowing a "fading" effect and adjustablebrightness.

Step 4: Arduino CodeCopy and paste the Arduino code below into a new sketch. I won't write my own tutorial here, so ifyou don't know how to create/upload a sketch, check out the official Arduino - Getting Started page.

Page 6: Arduino-controlled RGB LED  Infinity Mirror

If you want to learn more about a specific command, just Google it (e.g. "Arduino analogWrite")and the official help page should pop right up.

Caveat: this probably isn't the most efficient code! Particularly, I'm not sure of a nicer way tocontinuously monitor the fade-speed potentiometer without copying and pasting the same line ofcode over and over, or if there's a way to break out of a for loop if you flip the toggle switch (rightnow, if you switch to individual-control mode while in color-fade mode, the switch won't occur until itfinishes the current fade cycle). So, I'll throw that out there as a challenge to anyone who's readingthis and wants to post better code. Clearly I'm a mechanical engineer at heart and not aprogrammer.

// Arduino code to control and RGB LED strip

// Uses a toggle switch to switch between color-fade mode

// and individual RGB control mode

// adapted from http://learn.adafruit.com/rgb-led-strips/example-code

const int RED = 9; // define digital output pins for individual red,

const int GREEN = 10; //green and blue channels

const int BLUE = 11;

const int POT1 = 0; // define analog input pins for three potentiometers

const int POT2 = 1;

const int POT3 = 2;

const int POT4 = 3;

const int BUTTON = 2; // define digital input pin for the switch

int val = 0; // stores the state of the switch input pin

int FADESPEED = 0; // initiate fade speed set by potentiometer

int r = 0; // initialize the red, green and blue values

int g = 0;

int b = 0;

void setup(){

pinMode(RED, OUTPUT); // define digital pins as outputs and inputs as needed

pinMode(GREEN, OUTPUT);

pinMode(BLUE, OUTPUT);

pinMode(BUTTON, INPUT);

}

void loop(){

val = digitalRead(BUTTON); // read the input value from the toggle switch

if (val == HIGH){

// code for RGB color fade

FADESPEED = analogRead(POT4)/10; // set the fade speed by reading analog input from 4th

potentiometer

// analogRead will output a number between 0 and 1023, and "delay"

// is in milliseconds, so the biggest delay you'll get here is about

// 1/10 of a second. Divide by a different number to change the max

// fade time.

Page 7: Arduino-controlled RGB LED  Infinity Mirror

// fade time.

// fade from blue to violet

for (r = 0; r < 256; r++) {

analogWrite(RED, r);

FADESPEED = analogRead(POT4)/10; // check the fade speed continuously, otherwise

// it won't update until it's gone through a complete cycle.

// Probably not the most efficient way to do this...

delay(FADESPEED);

}

// fade from violet to red

for (b = 255; b > 0; b--) {

analogWrite(BLUE, b);

FADESPEED = analogRead(POT4)/10;

delay(FADESPEED);

}

// fade from red to yellow

for (g = 0; g < 256; g++) {

analogWrite(GREEN, g);

FADESPEED = analogRead(POT4)/10;

delay(FADESPEED);

}

// fade from yellow to green

for (r = 255; r > 0; r--) {

analogWrite(RED, r);

FADESPEED = analogRead(POT4)/10;

delay(FADESPEED);

}

// fade from green to teal

for (b = 0; b < 256; b++) {

analogWrite(BLUE, b);

FADESPEED = analogRead(POT4)/10;

delay(FADESPEED);

}

// fade from teal to blue

for (g = 255; g > 0; g--) {

analogWrite(GREEN, g);

FADESPEED = analogRead(POT4)/10;

delay(FADESPEED);

}

}

else {

// code for individual RGB control with potentiometers

r = analogRead(POT3)/4; // read values from the 3 potentiometers and divide by 4 to set brightness

g = analogRead(POT2)/4; // note that analog read is 10-bit (0-1023), analog write is an 8-bit PWM

b = analogRead(POT1)/4; // signal so you need to divide this value by 4.

analogWrite(RED, r); // write analog values to red, green and blue output pins

analogWrite(GREEN, g);

analogWrite(BLUE, b);

}

}

Page 8: Arduino-controlled RGB LED  Infinity Mirror

Step 5: Testing your Circuit, Code, and LEDStrip

Plug your power supply into the barrel jack adapter,and after your Arduino takes a second to boot up, youshould be able to control the lights! Use the toggleswitch to switch between two modes. In one mode, youcan directly the control the red, green, and blue LEDbrightness with the first three potentiometers; andcombine them to make different colors. In the othermode, the LEDs will fade between colors automatically,but you can control the speed of the fading with thefourth potentiometer.Watch this video for a demonstration, and see below fortroubleshooting tips if it doesn't work. Notice how there

are a couple spots in this video where my LEDs flicker - this must mean I have a loose connectionor two bare wires bumping into each other somewhere when I jostle the Arduino around. Watch outfor that.

Troubleshooting Tips

Double and triple check your breadboard connections. It only takes one misplaced wire to stopthe whole thing from working.Make sure the I/O pins assigned in your code match the pins you're actually using. Thisshouldn't be an issue if you copied and pasted my code directly, but it can't hurt to check.Make sure your LED strip works. Hook the LED strip's V+ wire up directly to the +12V rail on thebreadboard, then test red, green, and blue individually by plugging their respective wires into theground rail. The LED strip has built-in resistors so you don't have to worry about blowing it out. Ifeach color lights up, then your strip is fine, and the problem is elsewhere in your circuit.Test your circuit and code with regular LEDs, skip the MOSFETs. If MOSFETs are a bit toonew and confusing, you can do a starter version of this project that just uses three plain old LEDs,or a single RGB LED (search common vendors like SparkFun or Adafruit, there are plenty ofoptions). These are low-current and low-voltage enough that they can be driven straight from theArduino and don't require the MOSFETs, but you will need current-limiting resistors so the LEDsdon't burn out. LED blinking and fading are very common starter Arduino projects so I won'treproduce the directions here.Skip the potentiometers and test the circuit with a hard-coded color pattern. This lets youmake sure the PWM signals and MOSFETs are working, without having to worry about the analoginputs and potentiometers.You may have noticed a trend here - the general idea is to break your circuit (or code) down intosmaller, isolated sections that can be tested individually. This lets you narrow things down andsearch for problems in a compartmentalized way, instead of just staring at a giant circuit and messof code and wondering what went wrong. If you can think of other/better ways to debug this circuit,please chime in in the comments.

Page 9: Arduino-controlled RGB LED  Infinity Mirror

Step 6: Preparing the Mirror FrameSo, this is where I hoped that my 9" diameter mirrorwould fit snugly inside my 9" diameter lid, or the boxitself. As you can see from the photos above, it didn't(they were just too small), and the 10" diameter box andlid were too big. My workaround was to cut out the topof the 9" lid and just use the rim. I kept the circularpiece that I cut out of the top to reinforce the back ofthe mirror. So:

1) Use a utility knife to carefully cut out the top of yourcardboard lid. Not necessary if you bought a lid/mirrorcombo that fit together snugly.

2) Paint both pieces a color of your choice. I believe the illusion will work better if the inside of therim is black, the outside doesn't really matter.

3) Drill a hole in the side of the rim that's big enough for the wires from your LED strip to fitthrough. In hindsight, I probably should have drilled first and painted second.

Step 7: Mounting the LED stripThread the LED strip wires through the hole you drilledin the cardboard lid.Carefully begin to remove the adhesive paper backingfrom the LED strip, and press it firmly against the insideperimeter or the lid. Make sure it is centered inside therim.

Once you've gotten the entire way around, cut the LEDstrip. Important: the LED can't just be cut anywhere -you have to cut it in 3-LED segments, and you can seethe cut lines with labeled solder pads. If you cutanywhere else, the last few LEDs of your strip won't

work.

You'll also have to hope that the circumference of your lid matches up nicely with a multiple of thelength of these 3-LED segments (about 1 15/16"), otherwise you could wind up with either a gap ora bit of overlap between your first and last LEDs.

Page 10: Arduino-controlled RGB LED  Infinity Mirror

Step 8: Assembling the FrameThe mirrors I bought came with small hooks on theback, and I accidentally ripped the hook off the 9"mirror when I was removing it from the packaging. So,it's probably a good thing I didn't try to use that to hangit on a wall. That works out anyway because you'll wantto remove the hook so you can mount the mirror flat onthe inside of your frame.

I super-glued the back of the mirror to the flat (non-painted) part of the cardboard lid from earlier. Now isprobably a good time to make sure your mirror is cleanand free from fingerprint smudges, because anydefects will detract from the illusion in the finished product. I used paper towels to handle/pick upthe mirror from this point on, to avoid getting additional fingerprint marks around the edges.

After gluing the mirror to the cardboard circle, I just used electrical tape to wrap around the outeredge of the rim with the LED strip and attach it to the mirror (of course duct tape would work too,but I wanted it to be black). Again, this is just a roundabout process that I had to go throughbecause my mirror didn't fit inside the lid to begin with.

Once you have everything secure, it's probably a good idea to fire up the Arduino and make sureyou didn't somehow damage the LED strip or wires during this process.

Step 9: Cutting the Acrylic - JigsawSo, in grad school I used a laser to cut acrylic all thetime, and it worked great. Now I don't have a laser sothat wasn't an option, and I really wanted to use the 9"mirror instead of going with 6" and buying a pre-cut 6"acrylic circle. That meant I had to cut my own acrylic.Thanks to everyone who pitched in to this forum threadwith ideas.

IMPORTANT SAFETY INFORMATION BEFORECONTINUING: If you're using a laser, acrylic fumesaren't good for you. If you'recutting/sawing/sanding/whatever-ing it, you don't wantto inhale the dust either. Be sure to work in a properly ventilated area and wear an appropriatemask if necessary.

So, with the jigsaw: I traced the outline of the 9" mirror onto the acrylic's paper backing. Then Iused two C-clamps to hold it onto the edge of a table, and just roughly cut off the corners to makean octagon. Then I went in for successively smaller cuts following the line. The end result wasn't toobad - some cracking around the edges, but no catastrophic breaks that ruined the circular shape.

Some safety notes - first I tried this with a wood blade, which didn't work at all and resulted insome large, jagged pieces of acrylic snapping off when the blade snagged. Got a finer-toothedmetal blade at the hardware store and that worked much better. The edges were still quite sharp so Ijust hand-sanded them to avoid cuts. As usual with power tools, I'd recommend safety glasses forthis step.

Page 11: Arduino-controlled RGB LED  Infinity Mirror

Step 10: Cutting the Acrylic - Score-and-SnapMy other approach to cutting the acrylic was scoring acircular outline with a utility knife, then scoring a bunchof additional radial lines, hoping I'd be able to break offindividual pieces, and wind up with a circle left in themiddle.The first time I tried this, I used C-clamps to clamp theacrylic down on the edge of a table, and then hit thebreakaway pieces with a mallet. That didn't work andresulted in big chunks breaking off inside the circularperimeter (this works fine for straight cuts if you'remaking a rectangular mirror, though).

Next, I took some helpful advice from the forum thread: I scored the acrylic and then put it in thefreezer for a few hours. Then I used the C-clamps again, but snapped the edges off with a vise gripinstead of hitting it with a mallet. This worked pretty well, with less cracking around the edges thanthe jigsaw method. It still had some sharp points sticking out, which I sanded down.

To be fair, I never tried using the vise grips without freezing first, or using the mallet after freezing -so I can't say with 100% certainty whether it was the vise grips or the freezing that made it workbetter the second time.

Step 11: Applying the Mirror TintAt this point we'll assume you've somehow managed tocut your acrylic to the appropriate size. Make sure youwipe down/clean off your acrylic (fingerprint smudges,dust from sanding etc) before you continue.Next you'll need to cut a piece of mirror tint that isbigger than your piece of acrylic - this means you canhandle the extra material on the edges without worryingabout fingerprint smudges.

The window tint comes with a clear protective coatingon one side, that you need to remove to expose thesticky adhesive. Start in a corner and carefully useyour fingernail to peel up the clear layer (this can be a pain to do), then carefully lay the mirror tintflat on your piece of acrylic. I think this is the most frustrating/difficult part of the whole project -you want to get the tint as flat as possible, without any air bubbles. Big air bubbles will be painfullyvisible in the final mirror and can detract from the illusion. I did my best to get the tint as flat aspossible, and "popped" a few air bubbles by pushing them toward the outer edge with my fingertip(using a paper towel so I didn't smudge the window tint). If you really mess up on your first try, youcan peel the window tint off most of the way and try laying it down flat again, the adhesive shouldn'tlose its stickiness. If all else fails you can also just cut a new piece.

Once you're happy with the appearance and smoothness of your window tint, use scissors to cutaround the outer perimeter so it's flush with your piece of acrylic.

Page 12: Arduino-controlled RGB LED  Infinity Mirror

Step 12: Attach One-Way Mirror to the FrameNothing fancy here...place the one-way mirror with themirror tint facing in*. I just used electrical tape aroundthe outer edge again. If you wanted to get fancier, youcould mount the one-way mirror on the inside of aslightly larger cardboard lid and then fit that around theoutside of your frame.

*Here I'm just following the directions I've seen on otherinfinity mirrors. Optically, it should work in eitherdirection, as discussed in Step 1. Maybe the acrylic isjust harder to scratch/easier to clean, so it's better tohave that facing out...honestly I'm not sure.

Step 13: Light it Up!Plug in the power supply and fire it up! Assuming youtested your LED strip in Step 5 and didn't have anymajor issues with constructing the mirror, it should workas advertised. Above are a bunch of photos I took indifferent lighting conditions (the darker the room, thebetter the "infinity" effect), and below is a video of thefinal product in action.I want to make this Instructable as clear as possible forbeginners - so if you saw something that wasn't clear,or I skipped over/implied something that you thinkshould be spelled out, please leave a comment to let meknow.

Thanks for reading! Here's a video of the final product: