Introduction: Arduino Infinity Mirror (Bluetooth & Sound Reactive)

About: Student at HKU Utrecht, the Netherlands.

I created an Infinity Mirror for a school project with Arduino which you can control with your phone or tablet by using Bluetooth. The mirror also has a built-in microphone which detects sound/music and reacts accordingly by generating eye-catching light strobes on the beat of the music! Simply start up the app, connect to bluetooth and see the magic happen!

In this Instructables I will show you how you can make this Infinity Mirror. So let's get started!

Step 1: Gather Materials

To make this infinity mirror, you will need the following materials:

1) Arduino Uno ($30)

You can also use a different type of Arduino, but that's entirely up to you.

2) Mini breadboard or PCB ($5)

I used the breadboard for prototyping and later soldered everything to a perfboard/stripboard.

3) WS2813 Digital 5050 RGB LED Strip - 144 LEDs (1 meter) ($25)

You can also use a different LED strip, but make sure that all LEDs are individually adressable. Also make sure that the LED strip gives an "extra" 5V voltage for every meter of LEDs. This is because the voltage drops over the strip and the current at the start can increase considerably. (and maybe burn the start of your LED strip!) You can read more about this here: Powering Neopixels.

4) Prototype wires ($3)

Colors do not matter in general, but it's very useful to have them as reference for yourself. I used white, black, red, green, yellow, orange and blue.

5) USB A to B cable ($4)

This will be used to upload your Arduino code to the Arduino Uno board.

6) Mean Well Switching Power Supply - 5V 10A ($15)

This will be used used to support the LED strip with external 5V voltage, because the Arduino itself isn't powerful enough to light up all LEDs. You can also choose to use a Wall Adapter Power Supply, but make sure that it runs on 5V.

7) 230V Power cable with plug ($3)

This will be used for connecting the Switching Power Supply to the 230V Power Socket. Depending on where you live, the amount of voltage from the power socket can vary. In any case, you will need a proper cable with plug.

8) Bluetooth HC-06 module RF transceiver Slave 4-PIN ($8)

This module will be used for sending data from your phone or tablet to the Arduino. This bluetooth module can only serve as a slave. The standard bluetooth pin / password is 1234.

9) Sound Detection Sensor Module 3-PIN ($3)

This module will be used for detecting sound since it has a built-in microphone. Set the potentiometer for the desired amount of sound at which a signal is generated. You can also use a different sound sensor, but that's up to you.

10) 220 Ω Resistor ($0.25)

This will be used for controlling the voltages of the LEDs. If you don't use this, then the LEDs will eventually get really hot. A 220Ω resistor has red, red, and brown stripes in that order. The last stripe represents the tolerance. Gold means ±5%. More info here: 220 Ohm Resistor.

11) 1000uF 16V Electrolytic Capacitor ($0.25)

This will be used to add and store capacitance (energy) to your circuit. More info here: Electrolytic Capacitors.

Box and mirror:

These are the materials and dimensions that I used to create my box. You can also choose to buy a frame or pre-made box instead which is big enough to fit a one-way reflective mirror, normal mirror, LEDs and electronics in it. I only recommend to build it yourself if you have the correct tools and materials.

12) Glass 25 x 25cm (3mm thick) ($5)

The glass will be used as a one-way reflective mirror, which you will need the one-way mirror window film for (see 13). You can also choose to buy a one-way mirror/semi-transparent mirror instead which is big enough to fit inside your box. You can cut glass yourself with a glass cutter (see 22), but I rather recommend to consult specialists to do this for you or even better just buy glass with the right dimensions.

13) Tinted one-way mirror window film 30 x 30 cm ($5)

In order to replicate a one-way mirror, you will need glass and a roll of tinted one-way mirror window film, which will be applied onto the glas with water and soap (see 29). The reason why it's slightly bigger than the glass is because it will shrink over time. If you choose to buy a one-way mirror instead as mentioned above, then you won't be needing this.

14) Mirror 25 x 25cm (3mm thick) ($5)

Just a normal mirror, like the one you have in the bathroom. This will be used, along with the one-way mirror, to create the "infinity" effect.

15) 2x Thick Wooden lath 25 x 10 x 2cm ($2)

Two wooden lath for the top and bottom of the box.

16) 2x Thick Wooden lath 27 x 10 x 2cm ($2)

Two wooden lath for the right and left side of the box.

17) 2x Thin Wooden lath 25 x 2.5 x 0.5cm ($1)

Two wooden lath for the top and bottom of the inside of the box (which the mirrors will rest on and which the LEDs are pasted on).

18) 2x Thin Wooden lath 24 x 2.5 x 0.5cm ($1)

Two wooden lath for the right and left side of the inside of the box (which the mirrors will rest on and which the LEDs are pasted on).

19) Black paint can/spray

I used this to paint my box black to make it blend in more with the dark theme.

Tools:

These are the tools that you will need to create the box as well as the mirror:

20) Measuring tape ($3)

Used for measuring your box of course. More info here: How to Read a Measuring Tape.

21) Measuring square ($5)

Also used for measuring your box/materials. Not really required, but it could come in very handy.

22) Wire cutter/stripper ($5)

Used for stripping and cutting your wires. As alternative you can also use a kitchen knife or stanley knife. More info here: How to Strip Wire.

23) Glass cutter ($5)

Used for cutting glass and mirrors. As alternative you can use a diamond, but I do not recommend it. More info here: How to Cut Stained Glass.

24) Screwdriver/drill ($2)

Used for driving screws and drilling holes. More info here: How to Drive a Woodscrew.

25) Hammer ($5)

Used for driving nails. More info here: How to Use a Hammer Safely.

26) Wood glue ($5)

If screws or nails aren't good enough, you can also apply some wood glue to keep parts together. More info here: How to Glue Wood Together.

27) Saw ($5)

Used for sawing wood. More info here: How to Saw Wood With a Handsaw.

28) Nails ($3)

Used to keep parts together, in our case permanently.

29) Screws ($3)

Also used to keep parts together, but by using screws instead of nails you can easily disconnect the parts if needed.

30) Water and soap

Used for applying the tinted one-way mirror window film onto the glass. And also used for cleaning the infinity mirror. If you want to know how to install the window film, you can follow this tutorial: How To Install Window Film.

31) Sandpaper ($1)

Used for refining the sharp edges of the glass and wood.

Soldering tools (optional):

32) Soldering Iron ($15)

Optional if you choose to solder everything together instead of leaving it on the breadboard. If you want to know how to solder, you can follow this tutorial: How to Solder Electronics.

33) Solder tin 0.6mm - 100g ($5.50)

Used for soldering the wires together.

34) Desoldering wire - 1mm 1.5m ($1.50)

Used for desoldering the wires, in case you made a mistake by accident.

35) Heat shrinking tubes ($2)

Used for safely keeping soldered wires together.

36) 1x 3 Pins header female ($0.10)

Not really required, but it could be handy if you don't want to directly solder the sound detection sensor to the wires.

37) 1x 4 Pins header female ($0.10)

Not really required, but it could be handy if you don't want to directly solder the bluetooth module to the wires.

Step 2: Breadboard Connections

Once you have assembled the materials, it's time to make your first prototype by using a breadboard. The breadboard has four columns in total. The first two and last two blue and red columns share a connection vertically, representing the +5V (red) and ground/GND (blue) connections. The two columns in the middle are where your main components will be placed. You can learn more about breadboards here.

So what you want to do is connect your Arduino to the breadboard by using some prototype wires. As I mentioned before, colors do not matter but they are a useful reference for yourself. For example, I used the red wires to represent the +5V and the white wires to represent the GND. It also does not matter where you place your pins as long as they stay in the same circuit.

Next you want to connect your LED strip to the breadboard. You will notice that it has 3-6 wires depending on which type you have. White represents GND/min input, red represents +5V input, green represents the data input PIN and blue represents the back-up data input PIN (don't connect unless the LED is linked). Plug in the external 5V power and connect it to the LED strip. Don't forget to also connect the resistor and capacitor as shown in the picture above, or else you might burn out your LEDs!

Lastly you want to connect your bluetooth module and sound detection sensor to the breadboard. Assign the sound detection sensor to pin A0 (analog). As for the bluetooth module, you will notice that it has one RXD and one TXD pin. These are for sending and receiving signals. NOTE: connect the TXD pin of the module to the RXD pin of the Arduino, and the RXD pin of the module to the TXD pin of the Arduino. Not to the same pins!

Step 3: Code the Arduino

So the next step is to code the Arduino. You will need the Arduino IDE software to do this, which you can download here. Once you have downloaded the IDE open up a new document and copy and paste the following code into the project window:

#include <Adafruit_NeoPixel.h>

//Pins that are connected to the Arduino const int PIN = 6; //The input pin of the LED strip int NUMPIXELS = 144; //The number of pixels that will light up const int SOUNDSENSOR = A0; //The input pin of the Sound Sensor

int ButtonState = 0; //State that is assigned to a button on the bluetooth app int volume = 0; //State that checks if there is a signal in the microphone or not

//Color variables boolean PrimBlue = false; boolean PrimGreen = false; boolean PrimRed = false; boolean PrimWhite = false; boolean PrimYellow = false; boolean PrimOrange = false; boolean PrimPink = false; boolean PrimPurple = false;

//Light and sound variables boolean SoundDetect = false; boolean FullLight = false;

Adafruit_NeoPixel strip = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);

void setup() { pinMode(SOUNDSENSOR, INPUT); //Input of the Sound Sensor pinMode(PIN, OUTPUT); //Input of the LED strip

Serial.begin(9600); strip.setPixelColor(0, 0, 0, 0); strip.setBrightness(0); strip.begin(); //This initializes the NeoPixel library strip.show();

}

void loop() { //Define the brightness amount according to the slider byte brightness = analogRead(A0)/4; Serial.println(brightness); if (Serial.available() > 0) { ButtonState = Serial.read(); }

//Enable or disable LED and Sound Detection if (FullLight == 1 && SoundDetect == 0) { strip.setBrightness(ButtonState); strip.show(); } else if (FullLight == 0 && SoundDetect == 0) { strip.setBrightness(0); strip.show(); } else if (FullLight == 0 && SoundDetect == 1) { strip.setBrightness(brightness); strip.show(); } else if (FullLight == 1 && SoundDetect == 1) { strip.setBrightness(0); strip.show(); }

//////////////////////////LED switch////////////////////////// if (ButtonState == 'a') { primaryColors(); FullLight = 1; SoundDetect = 0; }

if (ButtonState == 'b') { FullLight = 0; SoundDetect = 0; }

//////////////////////////Sound detection switch////////////////////////// if (ButtonState == 'c') { primaryColors(); SoundDetect = 1; FullLight = 0; }

if (ButtonState == 'd') { SoundDetect = 0; FullLight = 0; }

//////////////////////////Primary Colors////////////////////////// if (ButtonState == '1') { primaryColors(); PrimBlue = 0; PrimGreen = 0; PrimRed = 1; PrimWhite = 0; PrimYellow = 0; PrimOrange = 0; PrimPink = 0; PrimPurple = 0; }

if (ButtonState == '2') { primaryColors(); PrimGreen = 1; PrimBlue = 0; PrimRed = 0; PrimWhite = 0; PrimYellow = 0; PrimOrange = 0; PrimPink = 0; PrimPurple = 0; }

if (ButtonState == '3') { primaryColors(); PrimRed = 0; PrimBlue = 1; PrimGreen = 0; PrimWhite = 0; PrimYellow = 0; PrimOrange = 0; PrimPink = 0; PrimPurple = 0; } if (ButtonState == '4') { primaryColors(); PrimRed = 0; PrimBlue = 0; PrimGreen = 0; PrimWhite = 1; PrimYellow = 0; PrimOrange = 0; PrimPink = 0; PrimPurple = 0; } if (ButtonState == '5') { primaryColors(); PrimRed = 0; PrimBlue = 0; PrimGreen = 0; PrimWhite = 0; PrimYellow = 1; PrimOrange = 0; PrimPink = 0; PrimPurple = 0; } if (ButtonState == '6') { primaryColors(); PrimRed = 0; PrimBlue = 0; PrimGreen = 0; PrimWhite = 0; PrimYellow = 0; PrimOrange = 1; PrimPink = 0; PrimPurple = 0; } if (ButtonState == '7') { primaryColors(); PrimRed = 0; PrimBlue = 0; PrimGreen = 0; PrimWhite = 0; PrimYellow = 0; PrimOrange = 0; PrimPink = 1; PrimPurple = 0; } if (ButtonState == '8') { primaryColors(); PrimRed = 0; PrimBlue = 0; PrimGreen = 0; PrimWhite = 0; PrimYellow = 0; PrimOrange = 0; PrimPink = 0; PrimPurple = 1; } }

void primaryColors() { for (int i = 0; i < NUMPIXELS; i++) { if (PrimBlue == 1) { strip.setPixelColor(i, 0, 0, 255); } else if (PrimGreen == 1) { strip.setPixelColor(i, 0, 255, 0); } else if (PrimRed == 1) { strip.setPixelColor(i, 255, 0, 0); } else if (PrimWhite == 1) { strip.setPixelColor(i, 255, 255, 255); } else if (PrimYellow == 1) { strip.setPixelColor(i, 255, 255, 0); } else if (PrimOrange == 1) { strip.setPixelColor(i, 255, 102, 0); } else if (PrimPink == 1) { strip.setPixelColor(i, 255, 0, 255); } else if (PrimPurple == 1) { strip.setPixelColor(i, 102, 0, 204); } else { strip.setPixelColor(i, 255, 255, 255); } } strip.show(); }

If it asks you to install the Adafruit NeoPixel library do this by going to Sketch > Import Library > Adafruit NeoPixel.

Step 4: Build the Bluetooth App

Now let's get into the interesting part, building your app! I decided to use a third-party software called MIT App Inventor 2 to do this. If you want to download the project files (.aia) and make changes to the app, you can download it below. But you can also download the app itself (.apk) right away without having to code anything. You only have to install it on your device.

Step 5: Build the Box

In this step, we will build the box/frame for the infinity mirror.

The Outer Frame

First, cut the thick lath for the outer frame (see above pictures). You will need two pieces of length 27 cm (for top and bottom) and two pieces of length 25 cm (for left side and right side). Now nail them together by driving nails to the corners of the box (4 for each side), but make sure that the edges will fit perfectly. You can also choose to glue them together, but that's up to you.

The Inner Frame

Next, cut the thin lath for the inner frame (see above pictures again). You will need two pieces of length 25 cm (for top and bottom) and two pieces of length 24 cm (for the left and right side). Now you want to nail these to about 0.5 cm below the top of the outer frame by using 2 nails for each side. I also applied some wood glue here to make them sturdier. NOTE: make sure that the one-way mirror fits inside the frame perfectly!

Drilling The Microphone Hole

Since the microphone is a sensitive object, it must be free of coverage. That's why I drilled a hole into the top of the frame from which the microphone head will stick out. Don't make the hole too big, because you don't want your microphone to completely fall out of the frame.

Painting Your Frame

I decided to paint my frame almost matte black to give it some kind of dark, mysterious effect. If you also decide to paint it, make sure that there are no thick blobs of paint remains on the frame. To prevent this, you have to gently paint the frame with a small to medium brush. Additionally you can paint it for a second time if it's not covered enough. Let it dry for a day or so.

Step 6: Solder the Electronics to a PCB

In this step we will solder the electronics to a PCB which we will later on install on the back of our mirror. Soldering is not mandatory, but I highly recommend doing it to keep the electronics safe in place. I soldered everything step by step per "component" to the grid to prevent any mistakes. So I first soldered the sound module to the board, then the bluetooth module, and lastly the LED strips. I recommend to leave some blank space between the components which are not allowed to directly touch each other, such as the +5V input wires and the GND input wires (see above pictures).

Once you have your components soldered to the board, start making bridge connections by applying some tin between the components underneath the board. Alternatively you can strip some wires and solder these to the components to make a bridge connection.

Now you want to test the circuit by simply connecting the wires to the Arduino. Make sure that you have also plugged in the power supply! If the LEDs turn on successfully, then well done! If they don't turn on however, then you might want to double check the circuit and look for faulty connections.

Step 7: Install the Electronics on the Back

The next step is to install the electronics on a piece of wood, which we will also use for the back of the mirror. I attached the electronics to the board with some screws and glued two blocks on the right and left side of the back which are used to screw the back of the box to the box itself.

Step 8: Assemble the Mirrors With the Box

Now it's time to assemble the mirrors, stick the LEDs to the frame and put the sound detection sensor in place.

One-Way Mirror

The one-way mirror will be placed on the frame itself, with the tinted side faced downwards to the mirror and LEDs. To make this mirror yourself, you will need the glass plate and the tinted window film. First cut the window film in the right size, but leave about 2-5 cm extra space on every side. Next you want to completely clean the window and remove all dust remains. Then cover the window with some water and soap and carefully remove the plastic from the window film (you can place tape on each side to easily remove it). Now you also want to cover the sticky side of the window film with water and soap to prevent it from sticking to itself. All that you have to do now is place it on top of the glass and tightly sweep it in place (see above pictures). Let it dry for about a day and remove the remaining window film.

Stick the LEDs to the Box

The next step is to stick the LEDs to the box which can be done by removing the sticky paper. I also recommend to apply some fast glue to the back of the strip to prevent it from detaching.

Place the Mirrors and Finish it Up!

The final step is to put both the one-way mirror and the normal mirror in place. The normal mirror goes behind the LED strip and the one-way mirror goes in front. Glue them in place with some fast glue and screw the back plate with the electronics to the back of the box. Put the sound detection sensor in place, connect all the wires, and voila, you are done!

Step 9: Test Your Infinity Mirror!

All you have to do now is test if everything works. And that's it! Now you have built your own Bluetooth Controllable and Sound Reactive Infinity Mirror! :D

Don't hesitate to ask in the comments section if you have any questions.

Thank you and have fun!

First Time Author Contest 2018

Participated in the
First Time Author Contest 2018

Arduino Contest 2017

Participated in the
Arduino Contest 2017

Remote Control Contest 2017

Participated in the
Remote Control Contest 2017