Instructables
loading
loading
Picture of Arduino-controlled RGB LED Infinity Mirror
arduino-rgb-led-infinity-mirror-colors.jpg
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.
Tools

  • 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!
 
Remove these adsRemove these ads by Signing Up
1-40 of 89Next »
DanielM3711 days ago

Hey Ben, is it possible that I could substitute or not use a barrel jack adapter or a SPDT switch at all?

Ben Finio (author)  DanielM3710 days ago
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 "modes" for the LEDs but you dont need to use that either.

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?

Ben Finio (author)  DanielM3710 days ago
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.

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.

Is it possible to use a digital led strip with this setup?

Ben Finio (author)  DanielM372 days ago

Yep, from the intro step:

"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)."

nuelma4 days ago

so cool

SuperM324 days ago

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?

Ben Finio (author)  SuperM324 days ago

You mean as a replacement for the "regular" 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.

ok thanks

gordon.kaye1 month ago

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.

Ben Finio (author)  gordon.kaye1 month ago

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 "bar graph" form...so in this case you'd just be putting them in a ring around the inside of the mirror.

You can also do some basic visualization without using an Arduino at all, check out this project of mine:

http://www.instructables.com/id/Mini-LED-Volume-Towers-VU-meters/

does the gap between the LED and real mirror/fake mirror matter , how much is your gap ?

Ben Finio (author)  renad.samaan1 month ago

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.

So if the gap between mirror and fake mirror is bigger that means that the ''tunel'' of light created will be bigger/longer??

Ben Finio (author)  bieniekmario18.1 month ago

I think 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 "lid" yet - hold it at different distances away from the back and see how the image changes.

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?????

hqdefault.jpg
renad.samaan made it!1 month ago
Thank you very much!!?
DSC_0267.JPG
Suepac713 months ago

that depth of field is INSAAAAAAAANE.....!..love it.

Im using the Adafruit neopixel led strip , will i need to use a completely different code as it is digital ?
Ben Finio (author)  mohammedmemon 4 months ago

Yes, you'll need to use different code AND a different circuit - but Adafruit has great guides on how to set everything up:

https://learn.adafruit.com/adafruit-neopixel-uberguide/overview

Thanks Ben, will I still be able to use the potentiometers?
Ben Finio (author)  mohammedmemon 4 months ago

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).

https://learn.adafruit.com/adafruit-neopixel-uberg...

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:

http://www.instructables.com/id/Rainbow-Jar-RGB-Pi...

goldenshuttle4 months ago

Ben, I raise my hat to you, as this is one the most well written instructable I came across. Keep posting please.

Ben Finio (author)  goldenshuttle4 months ago

Thank you!

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.
Ben Finio (author)  JavaProgrammer5 months ago

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:

http://www.amazon.com/s/ref=nb_sb_noss_1?url=search-alias%3Daps&field-keywords=RGB+LED+strip

Glad you found it helpful!

Thanks, I might get those.
keerthana4566 months ago
Can we use regular glass instead of plexiglass?
Ben Finio (author)  keerthana4566 months ago

Yes, regular glass will work fine, it's just harder to cut at home.

hftounia8 months ago

IF I USE

N-Channel MOSFET 60V 50A

INSTEAD OF

N-Channel MOSFET 60V 30A

I WILL HAVE PROBLEM???

Ben Finio (author)  hftounia8 months ago

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.

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?

Yes i considering for this

http://www.ebay.com/itm/RFP50N06-50N06-POWER-MOSFET-N-CHANNEL-60V-50A-/260797369339?pt=LH_DefaultDomain_0&hash=item3cb8bc0bfb

Ben Finio (author)  hftounia7 months ago

*and sorry for the long delay, I was on vacation for two weeks.

Ben Finio (author)  hftounia7 months ago

According to the data sheet for that part, the gate threshold voltage has a typical range of 2-4V. Since the Arduino operates at 5V, you should be fine.

hftounia hftounia8 months ago

I bought this leds

http://www.ebay.com/itm/3528-5m-RGB-no-waterproof-300-LED-SMD-Flexible-Light-Strip-Lamp-500cm-DC-12V-/271609639050?ssPageName=STRK%3AMEBIDX%3AIT&_trksid=p2047675.l2557&nma=true&si=UXkhCdh4S2DTD7IvBwa5J9gBRGg%253D&orig_cvip=true&rt=nc

hftounia8 months ago

Yes i considering for this

http://www.ebay.com/itm/RFP50N06-50N06-POWER-MOSFET-N-CHANNEL-60V-50A-/260797369339?pt=LH_DefaultDomain_0&hash=item3cb8bc0bfb

HamiltonT8 months ago

Hey, this was really helpful. I reorganized some of the code into specific functions that are called by the loop and used a function that cycles through the colors a little more smoothly, I think. In the code below, I also make use of potentiometer 4 to give additional functionality of blinking, strobing, or constant on when the switch is in the other state.

// 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-...

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)
{
//slowfade(); //I left the code in, but the program isn't using this
showSpectrum();
}
else
{
FADESPEED = analogRead(POT4);
potcontrol();
}

}


void slowfade()
{
// 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.
// 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);
}
}

void potcontrol()
{
// 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.

if (FADESPEED < 10) //when potentiometer reads very low value or 0, it goes into "constant on"
{
analogWrite(RED, r); // write analog values to red, green and blue output pins
analogWrite(GREEN, g);
analogWrite(BLUE, b);

}
else
{
analogWrite(RED, r); // write analog values to red, green and blue output pins
analogWrite(GREEN, g);
analogWrite(BLUE, b);

delay(FADESPEED);

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

delay(FADESPEED);
}
}

void showSpectrum()
{
int x; // define an integer variable called "x"

for (x = 0; x < 768; x++)

{
FADESPEED = analogRead(POT4)/10;
showRGB(x); // Call RGBspectrum() with our new x
delay(FADESPEED); // Delay for 10 ms (1/100th of a second)
}
}


// showRGB()

// This function translates a number between 0 and 767 into a
// specific color on the RGB LED. If you have this number count
// through the whole range (0 to 767), the LED will smoothly
// change color through the entire spectrum.

// The "base" numbers are:
// 0 = pure red
// 255 = pure green
// 511 = pure blue
// 767 = pure red (again)

// Numbers between the above colors will create blends. For
// example, 640 is midway between 512 (pure blue) and 767
// (pure red). It will give you a 50/50 mix of blue and red,
// resulting in purple.

// If you count up from 0 to 767 and pass that number to this
// function, the LED will smoothly fade between all the colors.
// (Because it starts and ends on pure red, you can start over
// at 0 without any break in the spectrum).


void showRGB(int color)
{
int redIntensity;
int greenIntensity;
int blueIntensity;

// Here we'll use an "if / else" statement to determine which
// of the three (R,G,B) zones x falls into. Each of these zones
// spans 255 because analogWrite() wants a number from 0 to 255.

// In each of these zones, we'll calculate the brightness
// for each of the red, green, and blue LEDs within the RGB LED.

if (color <= 255) // zone 1
{
redIntensity = 255 - color; // red goes from on to off
greenIntensity = color; // green goes from off to on
blueIntensity = 0; // blue is always off
}
else if (color <= 511) // zone 2
{
redIntensity = 0; // red is always off
greenIntensity = 255 - (color - 256); // green on to off
blueIntensity = (color - 256); // blue off to on
}
else // color >= 512 // zone 3
{
redIntensity = (color - 512); // red off to on
greenIntensity = 0; // green is always off
blueIntensity = 255 - (color - 512); // blue on to off
}

// Now that the brightness values have been set, command the LED
// to those values

analogWrite(RED, redIntensity);
analogWrite(BLUE, blueIntensity);
analogWrite(GREEN, greenIntensity);
}

Ben Finio (author)  HamiltonT8 months ago

Nice, thank you!

dushu made it!10 months ago
IMG_0266.JPGIMG_20140706_222704.jpg
1-40 of 89Next »