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

Update Feb. 2016: A kit with all the electronic materials for this project is now available from Jameco Electronics. Please note that this kit does not include materials for building the mirror frame so you will still need to purchase those separately (see below). I earn a commission on sales of this kit as described at the bottom of this page.

  • 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.
  • Four10K potentiometers ($1 each).
  • ThreeN-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, I was wondering if you have to cut the acrylic into a circle? Like would the illusion still work if you cut it into a square, put some acrylic on it, and hot glue it to the mirror? The only problem with it is there's a couple corners from the square sticking out, but it'd still work right? </p>
Hi - you are just talking about the front piece of acrylic, right? Then the answer is yes, the illusion will work as long as the front piece is as big or larger then the perimeter of the LEDs (it could be any shape - a bigger circle, a square, whatever). You will not see anything in the &quot;extra&quot; areas overhanging the edges, but the illusion will still work.<br><br>If you were talking about the front and back pieces, then the mirror can be any shape. Look online and there are lots of rectangular infinity mirrors.
<p>Hi Ben,</p><p>Thank you for writing up such a clear and easy-to-follow instructions manual. I haven't built one yet myself, but plan to do so by following this!</p><p>I came across an infinity mirror project (<a href="http://www.jameco.com/Jameco/workshop/JamecoBuilds/infinity-mirror.html" rel="nofollow">http://www.jameco.com/Jameco/workshop/JamecoBuilds...</a>), which seems to have been inspired by yours, as cited in the write-up. I was wondering what the difference is between this and yours, besides the fact that this one includes an ABS enclosure for the electronic hardware or uses different product parts. Is there any difference in the performance? If so, I'd greatly appreciate it if you could explain it!</p><p>Cheers,</p><p>Matt</p>
<p>Hi Matt,</p><p>The Jameco build is pretty much a direct copy of mine except is uses Jameco parts whereas my original materials list was from SparkFun. I actually contacted them about it because a) I published this under a Creative Commons non-commercial license (which basically meant I didn't want people selling it - but I'm pretty sure the Jameco intern had good intentions and didn't mean to &quot;steal&quot; anything, so I didn't make a huge fuss about it) and b) I thought their kit contained a few parts that drove the price up too much, mainly the ABS enclosure and an unnecessarily beefy power supply. The result is that you can buy the original $80 kit from Jameco: </p><p><a href="http://www.jameco.com/webapp/wcs/stores/servlet/ProductDisplay?langId=-1&storeId=10001&productId=2215380&catalogId=10001">http://www.jameco.com/webapp/wcs/stores/servlet/Pr...</a> </p><p>or a cheaper $60 version of the kit that I designed to bring the cost down: </p><p><a href="http://www.jameco.com/z/CJKIT-21467-Infinity-Mirror-v2-0_2247322.html.">http://www.jameco.com/z/CJKIT-21467-Infinity-Mirro...</a> </p><p>I get a commission on sales of the latter through their &quot;Club Jameco&quot; program as explained in the Materials section of this Instructable, but obviously you're welcome to buy/scavenge the materials wherever you want!</p>
<p>on the tops you said: &quot; </p><p>Optional: if you want to get really fancy, you might be able to order a <br>custom-sized one way mirror, instead of putting mirrored window tint <br>onto a piece of plexiglass. This will probably give you a higher optical<br> quality in your final product, but I didn't look into it&quot;<br><br>what do you mean on way mirror?<br>all the mirrors are one way,do you mean reflective glass ( two way mirror)?</p>
When I wrote this project, I found the terminology to be really confusing and inconsistent in terms of how people use the terms &quot;one way mirror&quot; and &quot;two way mirror.&quot; From Wikipedia: https://en.wikipedia.org/wiki/One-way_mirror - &quot;A one-way mirror, also called two-way mirror...&quot;<br><br>and if you search google images for &quot;one way mirror&quot; you see the type of mirror referred to in this project (where it appears as a mirror from one side but transparent from the other side): https://www.google.com/search?q=one+way+mirror&amp;biw=1680&amp;bih=957&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ved=0ahUKEwiOsIa_zajRAhVnw4MKHeKoB2UQ_AUIBygC<br><br>but you get similar results if you search for &quot;two way mirror&quot;: https://www.google.com/search?q=one+way+mirror&amp;biw=1680&amp;bih=957&amp;source=lnms&amp;tbm=isch&amp;sa=X&amp;ved=0ahUKEwiOsIa_zajRAhVnw4MKHeKoB2UQ_AUIBygC#tbm=isch&amp;q=two+way+mirror<br><br>see the &quot;How does an infinity mirror work?&quot; step for an explanation and that should explain, regardless of what you choose to call it.
<p>would putting the mirrors further away from each other make the illusion better or worse?</p>
<p>Putting the mirrors farther away will make the LEDs appear farther away in the reflections. I think it's personal opinion whether you consider that better or worse.</p>
<p>I went the lazy way of buying a 12 inch clock and using the frame, front glass and inside case to make mine. Black poster board cut to size with mirrored window tint spray glued to it in the back and the glass front covered with mirrored window tint on the inside (mirrored side in of course). I am still experimenting with the mirrors as I now get about 8 levels of reflected LEDs going in but I want more. This is the clock that I used $12.99. <a href="https://www.amazon.com/gp/product/B01DW6KROW" rel="nofollow">https://www.amazon.com/gp/product/B01DW6KROW</a></p><p>I had to put a small crimp between each LED to get the 60 pixel strip to fit in the 12 inch clock case, maybe a 13 or 14 inch clock would work better but this was the first attempt so I made due with what I had.</p><p>This photo is with 5% mirrored film front and back, I have ordered some 35% film for the front and actual glass mirrors for the back. There are still a few bubbles that I need to work out of the front film but that will wait until I get the darker film. This photo was also taken under florescent lights, it looks much better in the dark. </p>
<p>If I read that correctly - you're using the same mirrored window tint on the front AND the back of the mirror? If so, you're going to be losing a lot of light, as you want the back surface to be 100% reflective. So, I imagine you'll get a big improvement when your glass mirrors for the back arrive.</p>
<p>Hi Ben</p><p>I am doing electronics at A2 level and I want to make a infinity mirror clock where the LED's are two colors one for hours and one for minutes and make it have changeable modes. I will also be making it with picaxe. So do what do you think of my idea and do you have any ideas or tips to help me and if you could only have two colours which two would you have?</p>
<p>Hello, </p><p>I have seen multiple infinity mirror clock instructables:</p><p><a href="https://www.instructables.com/id/Infinity-Mirror-Clock/">https://www.instructables.com/id/Infinity-Mirror-Cl...</a></p><p><a href="https://www.instructables.com/id/DIY-Infinity-Mirror-Clock/">https://www.instructables.com/id/DIY-Infinity-Mirro...</a></p><p><a href="https://www.instructables.com/id/Infinity-Mirror-Clock-Making/">https://www.instructables.com/id/Infinity-Mirror-Cl...</a></p><p>so it should certainly be possible. I would check out those for more ideas. I don't have any experience with picaxe unfortunately so can't provide much advice there.</p><p>(I'm also not sure what &quot;A2 level&quot; means, but guessing by your spelling of colour, that's a UK thing?)</p>
<p>Thank you For your help, I will go to link and yes A2 level is a UK course</p>
<p>hi Ben, what kind of pic do you use or do you even use a pic because i have this project and it has to be 100% pic and the pic im using is 16f628a?</p>
<p>Hi - I'm not sure I understand your question. As it says in the project, I used an Arduino UNO R3. According to the official Arduino site the R3 has an <a href="http://www.atmel.com/images/Atmel-8271-8-bit-AVR-Microcontroller-ATmega48A-48PA-88A-88PA-168A-168PA-328-328P_datasheet_Complete.pdf" style="">ATmega328P</a>, not a PIC.</p><p><a href="https://www.arduino.cc/en/main/arduinoBoardUno">https://www.arduino.cc/en/main/arduinoBoardUno</a></p>
<p>Hi Ben,</p><p>I had old frame at home, with reference to your DIY I have completed it. Check the images. Not as great as yours.</p><p>Please provide constructive feedback for improvement.</p>
<p>Whoa - I've never seen one with a statue in the middle like that - that's awesome! I think the resulting appearance is really cool - no improvements needed!</p>
<p>Thanks a ton for your encouragement...</p>
looking for someone to make and sell me 6 of these infinity mirror frames completely done to ship to New York . Would love to hear from offers on the price . Thank you
can I use acrylic sheet with tinted film of 50% mirror instead of one-way real mirror.<br>I am afraid that real mirror may break while handling as mirrors are highly brittle in nature....
<p>Yes, if you read the materials list that is actually what I used, however if you are careful you should be able to use a real mirror.</p>
<p>I want to make it light weighted so hesitant to use real mirror. Also it needs extra cutting for mirror with extra care.</p><p>another question.</p><p>I applied window tint on two acrylic sheets. but very small minute particles are contaminating. I tried real hard to clean but no success. I really followed the steps for attaching the tint to sheet with extra care.</p><p>Do you have any best method to share on this?</p>
<p>Hi - unfortunately I don't have any advice beyond what the tint manufacturer's directions will say. Do your best to clean your work area in advance and work in a dust-free environment, and handle the materials carefully by the edges - avoid touching them in the middle or you'll get fingerprint smudges.</p>
<p>Thanks a lot for your suggessions. I will post the images of my project once it is completed.</p>
<p>Hi Ben, Is there any way i can make it pulse to sound?</p>
Hi - yes, there are a TON of instructables on syncing LEDs to music. You don't even need an Arduino to do it, you just need the right transistors. Just search the site for &quot;LED music&quot; or &quot;LED arduino music&quot; depending on what you want to do, and you will find plenty of examples.
<p>so my led strip only came with three wire they are ground, 12 volts, and din the led wont let up expect for 3 of them and wont change color</p>
<p>Hi - &quot;din&quot; probably stands for &quot;digital in&quot; which means you bought a digital LED strip, not an analog one. The good news is that means you can individually control the color of each LED instead of the whole strip at once, and there are many Instructables that show how to use these strips, like this one:</p><p><a href="https://www.instructables.com/id/Rainbow-Jar-RGB-Pixel-Strip-Controlled-via-Ardui/">https://www.instructables.com/id/Rainbow-Jar-RGB-Pi...</a></p><p>The bad news is that I believe the &quot;din&quot; line is supposed to be controlled by 5V logic, so I'm not sure if you may have damaged something if you already connected it to 12V.</p>
<p>Stupid question, but what do the 4 wires on the far right go to? (The Red, Green, Blue, and V+ ones.) </p>
<p>They go to the LED strip. It's been a while since I wrote this, but see the bottom of step 2 for notes about colors (some LED strips come with pre-attached wires, some don't, depends on where you buy).</p>
<p>thanks so much</p>
<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="https://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="https://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="https://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

About This Instructable




Bio: For my day job I write K-12 STEM projects for www.sciencebuddies.org. In my spare time I write Instructables.
More by Ben Finio:Rudolf the Red-Nosed Christmas Tree Water Level Indicator Raspberry Pi Controlled Irrigation System Jam Jar Wedding Favors 
Add instructable to: