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 AWG 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 strip I used requires 12V, and according to the datasheet, draws 60mA for every 3-LED segment (the smallest unit the strip can be cut into). So at 60 LEDs for the whole strip, that's an absolute maximum of 1.2A at full brightness. I had a 12V charger laying around from some old long-forgotten device, but it was only rated at 0.5A and couldn't light the whole strip. So, I went ahead and bought a beefy supply because I figured it would be useful for future projects anyway. Adafruit and SparkFun both carry smaller, cheaper 12V supplies (1A and 600mA respectively) that might suit your needs just fine depending on the size of your mirror and how many LEDs it will use. You could also scavenge something like an old laptop charger, but be sure 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 mache lid and a regular mirror that will fit snugly inside it  - the parts I bought didn't fit together perfectly, so I had to use a workaround (see Step 6). Second, cutting acrylic can be a pain depending on the tools you have available, so plan accordingly (see Steps 9 and 10). There's also an important consideration regarding the LED strip, which can't be cut to any length - it has to be cut in multiples of 3-LED segments, which are just shy of 2" long - so you want the inside perimeter of your mirror frame to be a multiple of that length. So, I'll link to the parts I used to build my mirror, but you can still follow these directions to build a mirror of a different size or shape.

  • 9" diameter circular mirror. I bought this kit of 7 mirrors ($14) with the intent of also making some smaller infinity mirrors. 
  • Kit of 8", 9", and 10" diameter round paper mache boxes ($9). Important - I bought these hoping that the 9" diameter mirror would fit snugly inside either the 9" lid or the box itself (and because I couldn't find individual boxes for sale on Amazon). It didn't. The 9" lid was just too small, and the 10" box was too big. So, I made it work by cutting out the top of the 9" lid, and just 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) and McMaster-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 worked reasonably well but resulted in some jagged edges, and in hindsight would have worked much better for a rectangular mirror instead of a round one. If you want to build a slightly smaller mirror, 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 in hardware 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 way mirror, instead of putting mirrored window tint onto a piece of plexiglass. This will probably give you a higher optical quality in your final product, but I didn't look into it.

  • Soldering iron. I have this variable temperature one from SparkFun ($45). You might be able to get away 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 already soldered on. Even so, pushing the ends of the (stranded) wires into a breadboard can be a pain, so I 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 can squeeze 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 breadboard components with your fingers.
  • Power drill (see Step 6 - you can probably just get away with a sharp knife)
  • Super glue
  • Electrical tape
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 do these things actually work?

Not surprisingly, there is no magic involved. The secret is that the infinity mirror actually contains two mirrors with different  transmissivity and reflectivity. For all practical intents and purposes, mirrors that we deal with in everyday life are 100% reflective (technically a tiny amount of light will also be absorbed, but we can ignore that for now). That's the regular mirror at the "back" of the infinity mirror (on the left in the diagram above). The tinted window film, however (on the right in the diagram above), only reflects about half of the light that hits it*. This means that, when you sandwich an LED between the two mirrors, some of the light escapes through the front mirror and into your eye. The rest is bounced back off the rear mirror, then into the front mirror again, and this process 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 gradually disappear - 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", which is a common misconception. In order for the illusion to work properly, the side of the front mirror the observer is on (the outside world) must be much darker than the side with the LEDs (inside the infinity mirror). This is the same effect that you see in crime dramas/movies where someone is held in an interrogation room that has a mirror on the wall, but there are people on the other side of that mirror observing as though it's just a window. That only works if the interrogation room is well-lit and the 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 in car windows, Google it if you're curious.
<p>Hi Ben, thank you for your help. Now &quot;I Made it!&quot;</p>
<p>Hi Ben,<br><br>Might be a stupid question but I'm trying to build on of these my own with some upgrade ideas to it. Most examples are not real mirror, like they have quite dark and not very shiny reflective front sides but yours looks like a proper mirror. What direction points your shiny reflective side to? to the spectator or to the led/inside?<br>I thought you have to apply the tint so the reflective side points inwards. or is it that your tint is properly reflecting on both sides?<br>could you give me some technical dates about your material? like how much light in percent does your tint let through? how thick is your acryl?<br>for my project it is very important to have as much light as possible getting out and when turned of the mirror should actually works like a proper mirror.<br><br>thank you!</p>
<p>Hi AnneW10,</p><p>Some of your questions are answered if you read through the Instructable in detail, but I'll summarize here:</p><p>- I ordered <a href="http://www.amazon.com/dp/B000H5XTKG" rel="nofollow">this window tint</a> from Amazon (apparently it's available in smaller quantities now, which is nice if you're only building a small mirror). I have tried googling but I can't actually find a data sheet for the material. The back of the box lists &quot;Visible Transmittance 0.15.&quot; My simplest interpretation of that number would mean it lets 15% of the light through and reflects 85%. However, that doesn't make sense because when you have equal lighting on both sides of the film, it is very transparent and definitely letting more than 15% of the light through. So, I'm not quite sure what that number means or how they calculate it. It might be specific to the residential privacy film application (e.g. on a typical sunny day, for a viewer standing outside your house, 85% of the light they see will be reflected and 15% will be transmitted from inside the house - that makes more sense to me). </p><p>- Either way - if you go with the exact stuff I used, or make sure you get residential privacy/mirrored window film, you should be fine. You don't want to use <em>automotive</em> window film which is much darker. The difference between my mirror and others may also come down to type of LEDs used and photo quality. Remember that an infinity mirror's appearance depends on exterior lighting in the room as well as the LEDs. Those LED strips are pretty bright, and I made sure to turn off most of the rest of the lights in the room so I could get a good picture. Compare that to say, <a href="http://www.instructables.com/id/Infinity-Mirror-Pendant/" rel="nofollow">this Instructable</a>, and it looks like that was built with smaller/dimmer LEDs and the picture was taken with the lights on in the room (since the fabric around the mirrors is lit up and you can see shadows) - which greatly diminishes the effect (nothing against that author, having one as a pendant is certainly cool - just commenting on the picture).</p><p>- Conversely, to have it work as a &quot;proper mirror&quot; when the LEDs are turned off, you need to have good lighting in the room. If the room is dark, you might still be able to see inside it slightly. The effect is explained in more detail in <a href="http://www.instructables.com/id/Arduino-controlled-RGB-LED-Infinity-Mirror/step1/How-does-an-infinity-mirror-work/" rel="nofollow">step 1</a>.</p><p>- The acrylic is 1/8&quot; thick (linked in the materials list)</p><p>- The mirrored tint does face towards the inside, as described in <a href="http://www.instructables.com/id/Arduino-controlled-RGB-LED-Infinity-Mirror/step12/Attach-One-Way-Mirror-to-the-Frame/" rel="nofollow">step 12</a>.</p><p>Hope that helps!</p>
<p>Hi</p><p>Was there no Problem with defining the digital and analog pins?</p><p>because of the: </p><p>const int POT3 = 2;</p><p>and the</p><p>const int BUTTON = 2;</p>
<p>It's been a while since I did this project, but I think the Arduino's digital and analog pins are just numbered separately. If you look at the board you'll see analog pins A0-A5 and digital pins 0-13. The code knows which type you're referring to depending on whether you're using analogWrite/Read or digitalWrite/Read respectively.</p>
<p>Hey Ben! Thank you for the very detailed tutorial. I&acute;m an Arduino novice and was wondering if there would be a way of providing the input through sensors like ones for proximity or pulse, instead of manually manipulating the potentiometers. <br><br>How would something like that work as an input to this?</p>
<p>Hi AliM37,</p><p>Absolutely! This project makes use of the Arduino's analog input pins, which can read any value between 0 and 5 volts. That value is converted to a number between 0 and 1023 in the code (see my replies to ChristianS6 for a more in-depth explanation of that). This means that you can use pretty much ANY sensor that will output 0 to 5 volts. The potentiometers just happen to be one convenient way to do that. For example, you should be able to use this thing to make the LEDs pulse with a heartbeat:</p><p><a href="https://www.sparkfun.com/products/11574" rel="nofollow">https://www.sparkfun.com/products/11574</a></p><p>You just have to be careful about two things when choosing a sensor:</p><p>- Make sure the sensor doesn't operate in a different voltage range (0 to 12 volts or something...don't want to fry your Arduino)</p><p>- Make sure the sensor isn't digital instead of analog. This means the sensor would output a series of 1's and 0's instead of a continuous voltage between 0 and 5V, and it wouldn't work with the analog input pins. You certainly CAN use all sorts of digital sensors with an Arduino, you would just have to look up a separate tutorial/code and not use the code from this project.</p><p>Hope that helps! If you find a sensor you want to use, and can't figure out how to hook it up, odds are if you google &quot;[name of sensor] + Arduino&quot;, someone out there has done it already and posted the circuit diagram.</p>
<p>Hey Ben, I pretty much followed your design exactly, but I'm wondering if any of your MOSFETs get really hot to the touch. For some reason the one connected to the red led gets pretty hot to touch if it's left on full. The others seem to be cool no matter what. If I keep them fading in and out you really can't feel it on any of them but if I turn them to white the red one gets so hot.</p>
<p>I can't say that I ever noticed them getting hot, but I also don't think I really tried touching each one when it had been running for a while. However, I don't think the MOSFETs should be getting super hot - their <a href="https://www.sparkfun.com/datasheets/Components/LED/FLB6%205060RGB%28300%29%20Waterproof%20FLEX%20STRIP.pdf" rel="nofollow">datasheet</a> says they're rated up to 32 amps continuous current, whereas the LEDs only draw 60 milliamps according to their <a href="https://www.sparkfun.com/datasheets/Components/LED/FLB6%205060RGB%28300%29%20Waterproof%20FLEX%20STRIP.pdf" rel="nofollow">datasheet</a>. So, you're nowhere near the max rating. </p><p>What happens if you try switching the MOSFETs around? i.e. take the MOSFET that is currently connected to red, and connected it to green or blue instead? If the same MOSFET always gets hot regardless of which color it's connected to, then there could be a problem with that MOSFET. If a new MOSFET always gets hot whenever you connected to the red LEDs, then the problem is with that connection (maybe it's shorted to ground somehow). </p>
When I've switched the MOSFETs around the red line still gets hot, one thing I've noticed that is different is that the 2 different MOSFETs i've tried have different ratings for the continuous current, <a href="http://www.irf.com/product-info/datasheets/data/irf530n.pdf" rel="nofollow">this one</a>&nbsp;is rated at 12amps and this one is rated at 9.2amps. &nbsp;I'm wondering if it's just getting close to the max is what is causing the heat. &nbsp;<br> <br> It's weird to me that only the red one gets hot, I've double checked the connections and it looks like it's not shorted to ground or anything like that.<br> <br> I switched up the code for the fade so that it just randomly selects a color and fades to that, here's the code I used:<br> <br> {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; const int DelaySpeed = 100;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int red = random(256);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int green = random(256);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int blue = random(256);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int redinc = prevred&gt;red? -1:1; //if the previous number is greater than the new number subtract 1 otherwise add 1<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int greeninc = prevgreen&gt;green? -1:1;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; int blueinc = prevblue&gt;blue? -1:1;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String DebugDataTemp = &quot;(&quot;;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i= prevred; i != red; i+=redinc)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prevgreen = prevgreen== green? prevgreen:prevgreen+greeninc;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prevblue = prevblue== blue? prevblue:prevblue+blueinc;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String DebugData = DebugDataTemp + i + &quot;,&quot; + prevgreen + &quot;,&quot; + prevblue + &quot;)R&quot;;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(DebugData);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; analogWrite(REDLED,i);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; analogWrite(GREENLED,prevgreen);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; analogWrite(BLUELED,prevblue);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delay(DelaySpeed);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prevred = red;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i=prevgreen; i != green; i+=greeninc)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prevblue = prevblue== blue? prevblue:prevblue+blueinc;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String DebugData = DebugDataTemp + prevred + &quot;,&quot; + i + &quot;,&quot; + prevblue + &quot;)G&quot;;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(DebugData);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; analogWrite(GREENLED,i);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; analogWrite(BLUELED,prevblue);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delay(DelaySpeed);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prevgreen = green;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for (int i=prevblue; i != blue; i+=blueinc)<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; {<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; String DebugData = DebugDataTemp + prevred + &quot;,&quot; + prevgreen + &quot;,&quot; + i + &quot;)B&quot;;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(DebugData);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; analogWrite(BLUELED,i);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delay(DelaySpeed);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; prevblue = blue;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Serial.println(&quot;------&quot;);<br> &nbsp;&nbsp;&nbsp; }
<p>Hmm. Another thing you can try is skipping the MOSFETs entirely and just hooking each LED channel directly up to the +12V power supply. As long as your power supply is rated to supply enough current, that shouldn't cause any problems. If something still gets hot, that would make me think the red LEDs are actually shorted out (maybe internally on the LED strip - so not something you can see on your breadboard).</p><p>Even if the MOSFETs you're using have a lower current rating than the ones I linked, that still seems way higher than what the LED strip would draw (side note: the first one you linked is rated at 12A at 100 deg C, it's actually 17A at room temperature, so even more breathing room. Look carefully at the data sheet and you'll see the two different ratings).</p>
<p>Is there a On/Off switch?</p><p>If not, can i use a switch between the the barrel jack and the orduino and the leds or is this a bad idea?</p>
<p>Hi Christian - I did not include an on/off switch in the original design, so you had to unplug the barrel jack to turn the whole thing off. This is kind of inconvenient, so you're correct that you could just include a switch between the barrel jack and the power rails on the breadboard, and you'd be OK. As far as I know, the Arduino handles sudden shutdowns pretty well (as opposed to the Raspberry Pi, for example, where you need to shut down properly or it can corrupt the SD card).</p>
<p>Hi Ben i wan't to build your protject. But I have not much experience with programming. Can you explain the /4 in your code with some more details plese?</p><p>I mean this:</p><p>if (val == HIGH){ <br> // code for RGB color fade<br> FADESPEED = analogRead(POT4)/10; // set the fade speed by reading analog input from 4th potentiometer<br> // analogRead will output a number between 0 and 1023, and &quot;delay&quot;<br> // is in milliseconds, so the biggest delay you'll get here is about<br> // 1/10 of a second. Divide by a different number to change the max<br> // fade time.</p>
<p>I tried to reply and I think my comment got deleted somehow, so let's try that again (and apologies if this shows up twice).</p><p>I can try to explain, but I don't see a &quot;/4&quot; in the snippet of code you pasted. My guess is that you're referring to the /10 in this line:</p><p>FADESPEED = analogRead(POT4)/10;</p><p>This page provides a good explanation of the analogRead function on Aruino:</p><p><a href="http://www.arduino.cc/en/Reference/AnalogRead" rel="nofollow">http://www.arduino.cc/en/Reference/AnalogRead</a></p><p>- The analog input pins on an Arduino are designed to read a value between 0 and 5 volts. That value is analog (meaning it's continuous and can have any value between 0 and 5 - like 4.999999999999...).</p><p>- Computers are digital, meaning they can only handle discrete numbers. The Arduino has a &quot;10 bit analog to digital converter&quot; which means it takes analog voltages between 0 and 5 and converts them to a number from 0 and 1023 (0 = 0 volts, 1023 = 5 volts). So, when you use the &quot;analogRead&quot; function, your code gets a number between 0 and 1023.</p><p>- Later on in the code I want to use this value for a &quot;delay&quot; which is in milliseconds (1,000 milliseconds = 1 second). So, if you just used the value from analogRead directly, you would get a maxmimum delay of 1,023 milliseconds, or 1.023 seconds.</p><p>- That delay is way too long for my purposes (fading between different colors), so I wanted to make it shorter. I do that by just dividing it by 10. Now I get a maximum delay of 1023 / 10 = 102.3 milliseconds.</p><p>- You can use any number you want to do this. Say you want a REALLY fast delay, then you can divide by 100 or 1000 instead. If you want a slower delay, you can multiply by 10, 100, etc.</p><p>Hope that makes sense.</p>
<p>Thank you </p><p>I noticed there was a mistake in my komment.</p><p>I wanted to paste this part of code:</p><p>else {<br> // code for individual RGB control with potentiometers<br> r = analogRead(POT3)/4; // read values from the 3 potentiometers and divide by 4 to set brightness<br> g = analogRead(POT2)/4; // note that analog read is 10-bit (0-1023), analog write is an 8-bit PWM<br> b = analogRead(POT1)/4; // signal so you need to divide this value by 4.</p><p>But your desciption of the /10 part is also verry helpfull :)</p>
<p>Oh. The explanation here is pretty much the same concept as the /10. &quot;note that analog read is 10-bit (0-1023), analog write is an 8-bit PWM signal so you need to divide this value by 4.&quot; means:</p><p>As mentioned previously, analogRead is 10-bit so it goes from 0-1023. Apparently analogWrite is only 8-bit so it goes from 0-255 (don't ask me why they're different, that's a question for the people who designed Arduinos to begin with). Here we want to take values between the range of 0-1023 (read from the potentiometers) and convert them to the range of 0-255 (used to control LED brightness). You do that by dividing by 4. I know that 1023/4 actually equals 255.75...so I'm not quite sure how the Arduino handles decimals. That might just be sloppy code on my part, but it works, so maybe someone else can provide an explanation there.</p><p>Notice how conceptually this is the same as the &quot;/10&quot; code. In both cases you are taking a value from analogRead that will always be between 0-1023. You need to convert that to some other number that is useful for whatever your code is doing. In this case I needed to divide by 10 and 4 for two different reasons. But, there's no rule saying you couldn't do something else. For example, say you buy an analog temperature sensor and hook that up to an analog pin instead of a potentiometer like in this project. There would be some equation you use (given by the sensor's manufacturer, or someone on the internet who already wrote the code for that sensor) to convert the analogRead() value to degrees. It could look something like</p><p>degrees_Celsius = 0.1*analogRead()+15</p><p>(Do the math by plugging in 0 and 1023 for analogRead, and this sensor would have a range of 15 - 117.3 deg C, which would be kind of odd...I just made up the numbers as an example, but you get the idea)</p><p>It might help if you do some background reading on binary numbers in general. That's already been done in plenty of places on the internet, so I won't type a binary tutorial into this comment...but here are some to get you started:</p><p><a href="https://learn.sparkfun.com/tutorials/binary" rel="nofollow">https://learn.sparkfun.com/tutorials/binary</a></p><p><a href="http://www.mathsisfun.com/binary-number-system.html" rel="nofollow">http://www.mathsisfun.com/binary-number-system.htm...</a></p>
Ok i think i understand.<br>Thank you for your help
<p>Hey Ben, is it possible that I could substitute or not use a barrel jack adapter or a SPDT switch at all?</p>
Hi Daniel - certainly, you don't need to use the barrel jack adapter. that's just one way to connect the power supply to the breadboard. you can just cut the cord and stick the 2 wires directly into the breadboard instead (use a multimeter to check which one is + and which one is -). the spdt switch is just what I chose to switch between the two &quot;modes&quot; for the LEDs but you dont need to use that either.
<p>Thanks for the fast reply Ben! I'm having trouble locating a mirror in my required size in my area, would it be possible to have two sides with acrylic and mirrored window tint? Would it cause any great trouble overall?</p>
you want the rear mirror to be 100% reflective. since the window tint lets some of the light through instead of reflecting it, you will lose some light and not get as many reflections as you would otherwise.<br><br>you could, however, do this on purpose and make a two-sided infinity mirror by not using a cardboard back to the case. then you can look into it from both sides. I'm on my phone so don't have the link but I think there's an instructable on two-sided infinity mirrors.
<p>Is it possible to use a digital led strip with this setup?</p>
<p>Yep, from the intro step:</p><p>&quot;If you want to try this project with an addressable LED strip instead of an analog strip, check out the <a href="http://www.instructables.com/id/Rainbow-Jar-RGB-Pixel-Strip-Controlled-via-Ardui/" rel="nofollow">Rainbow Jar</a> project (also an Arduino contest winner).&quot;</p>
<p>so cool</p>
<p>What if i use an acryilic window panel and apply a 5% window tint on one of the sides and paint it black on the other. Would it act like a mirror then?</p>
<p>You mean as a replacement for the &quot;regular&quot; mirror at the back? Technically, yes, I believe that would work, but since it's not reflecting 100% of the light, it would not be as efficient and you would not see as many LED reflections.</p>
<p>ok thanks</p>
<p>I've been looking at ADRUINO-based LED projects for music visualizers and I am curious if it possible to create an Infinity Mirror that doubles as one of these visualizers? I was considering building both but if it possible, I would strongly prefer to do this because I am planning to attach it a set of suitcase-speakers that I will also be building.</p>
<p>Certainly! You would just need to run different code on the Arduino to control the LEDs based on the music. There are plenty of music visualizer Instructables that arrange the LEDs in a &quot;bar graph&quot; form...so in this case you'd just be putting them in a ring around the inside of the mirror.</p><p>You can also do some basic visualization without using an Arduino at all, check out this project of mine:</p><p>http://www.instructables.com/id/Mini-LED-Volume-Towers-VU-meters/</p>
<p>does the gap between the LED and real mirror/fake mirror matter , how much is your gap ?</p>
<p>That gap will determine the distance between the reflections. Closer together, the reflections will appear closer together. I think the gap in mine is a little less than an inch.</p>
<p>So if the gap between mirror and fake mirror is bigger that means that the ''tunel'' of light created will be bigger/longer??</p>
<p>I <em>think</em> so but there could be some limits to that...for example, you're increasing the surface area of the interior wall, so there's more area for light to get absorbed instead of bounced back and forth, possibly making the reflections dimmer. The best way to find out would be to start building a mirror, but don't permanently attach the &quot;lid&quot; yet - hold it at different distances away from the back and see how the image changes.</p>
<p>Thank u for the answer. But I have one more question. I want to build inside my mirror another mirror/shape like on the foto. So I need 2 LED strips. I bought 2LED strips with adapter but my questions is how connect the 2 strips to one adapter. Can I do this anyway?????</p>
Thank you very much!!?
<p>that depth of field is INSAAAAAAAANE.....!..love it.</p>
Im using the Adafruit neopixel led strip , will i need to use a completely different code as it is digital ?
<p>Yes, you'll need to use different code AND a different circuit - but Adafruit has great guides on how to set everything up:</p><p><a href="https://learn.adafruit.com/adafruit-neopixel-uberguide/overview" rel="nofollow">https://learn.adafruit.com/adafruit-neopixel-uberguide/overview</a></p>
Thanks Ben, will I still be able to use the potentiometers?
<p>Sorry, I should have clarified. The circuit to POWER the neopixels is different. You should check Adafruit's tutorials to be sure, but I don't think you need the MOSFETs at all - they just take a 12V supply line (I think).</p><p><a href="https://learn.adafruit.com/adafruit-neopixel-uberguide/power" rel="nofollow">https://learn.adafruit.com/adafruit-neopixel-uberg...</a></p><p>You can still use the potentiometers as INPUTS to your Arduino to control what the neopixels do (but you will need to figure out the code). It might also help to check out this project, or other Instructables that use addressable LED strips:</p><p><a href="http://www.instructables.com/id/Rainbow-Jar-RGB-Pixel-Strip-Controlled-via-Ardui/" rel="nofollow">http://www.instructables.com/id/Rainbow-Jar-RGB-Pi...</a></p>
<p>Ben, I raise my hat to you, as this is one the most well written instructable I came across. Keep posting please.</p>
<p>Thank you!</p>
This is an excellent instructable. I saw one for an infinity mirror but it didn't explain very well so I looked around and your's is the most explanatory where I could actually see what was happening. I am definitely going to build one. I won't be using an arduino, probably just some LED chistmas lights but this was very helpful with how it actually works and how to make an infinity mirror.
<p>Thank you! Honestly that was part of my motivation for writing it originally. I saw a lot of cool infinity mirror builds (especially on YouTube, people go crazy and make whole desks/coffee tables/bar tops) but very few that actually provided a complete materials list, build instructions, and explanation of how they work. They work just fine with Christmas lights, and there are also RGB LED strips with remote controls you can buy so you don't need an Arduino:</p><p><a href="http://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=RGB+LED+strip" rel="nofollow">http://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&amp;field-keywords=RGB+LED+strip</a></p><p>Glad you found it helpful!</p>
Thanks, I might get those.
Can we use regular glass instead of plexiglass?
<p>Yes, regular glass will work fine, it's just harder to cut at home.</p>
<p>IF I USE </p>N-Channel MOSFET 60V 50A<p>INSTEAD OF</p>N-Channel MOSFET 60V 30A<p>I WILL HAVE PROBLEM???</p>
<p>No, the LEDs shouldn't draw anywhere near 30 amps to begin with, so a MOSFET that is rated for 50 amps shouldn't be a problem.</p><p>What you care about is the gate threshold voltage though, which might be different. Do you have a link to the exact part you're considering?</p>

About This Instructable


1,917 favorites


Bio: I'm a mechanical engineer/roboticist turned informal science educator. For my day job I write K-12 science and engineering projects for the STEM education ... More »
More by Ben Finio: Jam Jar Wedding Favors Deer-Proof Raised Garden Beds Fall-themed Mason Jar Wedding Centerpieces
Add instructable to: