Introduction: Infinity Mirror Clock With Potentiometers

I came across infinity mirror and I found it to be a really cool. This inspired me to make a infinity mirror, but I needed it to have a purpose. So, I decided to make a functioning infinity mirror clock. This is a infinity mirror that allows you to change the modes, speed and colors using potentiometers. (Note: This is my first time making something like this)

Supplies

Let's dive into what you need to make this thing!

You will need...

1) 1 Arduino Uno

3) 1 Breadboard

4) 1 Slide Switch

5) 3 Potentiometers

6) 1 9V battery

7) 5 meter WS2811 LED Strip

8) Jumper Cable Wires

9) A Clock (The Clock I used --> 12 inch Large Modern Clock)

10) Flexible Mirror Sheet (The one I used --> Mirror Sheet)

11) Privacy Film (The one I used --> One Way Mirror)

12) Soldering might be required this depends on what you materials you have

Step 1: Wiring

The wiring is quite simple

- The SPST Switch turns on and off the LED's (A0)

- The left potentiometer controls the light (A1)

- The middle potentiometer controls the modes (A2)

- The right potentiometer controls the speed (A3)

Step 2: The Code

#include

#define PIN 6

#define NUM_LEDS 54

#define A0 A0

#define A1 A1

#define A2 A2

#define A3 A3

// Parameter 1 = number of pixels in strip

// Parameter 2 = pin number (most are valid)

// Parameter 3 = pixel type flags, add together as needed:

// NEO_KHZ800 800 KHz bitstream (most NeoPixel products w/WS2812 LEDs)

// NEO_KHZ400 400 KHz (classic 'v1' (not v2) FLORA pixels, WS2811 drivers)

// NEO_GRB Pixels are wired for GRB bitstream (most NeoPixel products)

// NEO_RGB Pixels are wired for RGB bitstream (v1 FLORA pixels, not v2)

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

void setup() {

strip.begin();

strip.show(); // Initialize all pixels to 'off'

}

void loop() {

if(analogRead(A0)>=512){

if(analogRead(A2)>=768){

if(analogRead(A3)>=768){

rainbowCycle(80, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}else if(analogRead(A3)>=512){

rainbowCycle(60, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}else if(analogRead(A3)>=256){

rainbowCycle(40, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}

else{

rainbowCycle(20, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}

} else if(analogRead(A2)>=512){

if(analogRead(A1)>=768){

CylonBounce(random(255), random(255), random(255), 4, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}else if(analogRead(A1)>=512){

CylonBounce(random(255), 0, 0, 4, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}else if(analogRead(A1)>=256){

CylonBounce(0, random(255), 0, 4, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}

else{

CylonBounce(0, 0, random(255), 4, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}

}else if(analogRead(A2)>=256){

if(analogRead(A1)>=768){

byte r, g, b;

r = random(255);

g = random(255);

b = random(255);

meteorRain(r,g,b,10, 20, true, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}else if(analogRead(A1)>=512){

byte r, g, b;

r = random(255);

g = 0;

b = 0;

meteorRain(r,g,b,10, 20, true, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}else if(analogRead(A1)>=256){

byte r, g, b;

r = 0;

g = random(255);

b = 0;

meteorRain(r,g,b,10, 20, true, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}

else{

byte r, g, b;

r = 0;

g = 0;

b = random(255);

meteorRain(r,g,b,10, 20, true, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}

}

else{ if(analogRead(A1)>=768){

RunningLights(random(255),random(255), random(255), analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}else if(analogRead(A1)>=512){

RunningLights(random(255),1, 1, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}else if(analogRead(A1)>=256){

RunningLights(1,random(255),1, analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}

else{

RunningLights(1,1,random(255), analogRead(A0),analogRead(A1),analogRead(A2),analogRead(A3));

}

}

}else{

setAll(0,0,0);

}

}

void rainbowCycle(int SpeedDelay,int oldA0, int oldA1, int oldA2, int oldA3) {

byte *c;

uint16_t i, j;

for(j=0; j<256*5; j++) { // 5 cycles of all colors on wheel

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

for(i=0; i< NUM_LEDS; i++) {

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

c=Wheel(((i * 256 / NUM_LEDS) + j) & 255);

setPixel(i, *c, *(c+1), *(c+2));

}

showStrip();

delay(SpeedDelay);

}

}

byte * Wheel(byte WheelPos) {

static byte c[3];

if(WheelPos < 85) {

c[0]=WheelPos * 3;

c[1]=255 - WheelPos * 3;

c[2]=0;

} else if(WheelPos < 170) {

WheelPos -= 85;

c[0]=255 - WheelPos * 3;

c[1]=0;

c[2]=WheelPos * 3;

} else {

WheelPos -= 170;

c[0]=0;

c[1]=WheelPos * 3;

c[2]=255 - WheelPos * 3;

}

return c;

}

void CylonBounce(byte red, byte green, byte blue, int EyeSize,int oldA0, int oldA1, int oldA2, int oldA3){

int SpeedDelay;

int ReturnDelay;

if(analogRead(A3)>=768){SpeedDelay=80;ReturnDelay=120;}

else if(analogRead(A3)>=512){SpeedDelay=60;ReturnDelay=100;}

else if(analogRead(A3)>=256){SpeedDelay=40;ReturnDelay=80;}

else{SpeedDelay=20;ReturnDelay=60;}

for(int i = 0; i < NUM_LEDS-EyeSize-2; i++) {

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

setAll(0,0,0);

setPixel(i, red/10, green/10, blue/10);

for(int j = 1; j <= EyeSize; j++) {

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

setPixel(i+j, red, green, blue);

}

setPixel(i+EyeSize+1, red/10, green/10, blue/10);

showStrip();

delay(SpeedDelay);

}

delay(ReturnDelay);

for(int i = NUM_LEDS-EyeSize-2; i > 0; i--) {

setAll(0,0,0);

setPixel(i, red/10, green/10, blue/10);

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

for(int j = 1; j <= EyeSize; j++) {

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

setPixel(i+j, red, green, blue);

}

setPixel(i+EyeSize+1, red/10, green/10, blue/10);

showStrip();

delay(SpeedDelay);

}

delay(ReturnDelay);

}

void RunningLights(byte red, byte green, byte blue, int oldA0, int oldA1, int oldA2, int oldA3) {

int Position=0;

int WaveDelay;

if(analogRead(A3)>=768){WaveDelay=80;}

else if(analogRead(A3)>=512){WaveDelay=60;}

else if(analogRead(A3)>=256){WaveDelay=40;}

else{WaveDelay=20;}

for(int j=0; j

{

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

Position++; // = 0; //Position + Rate;

for(int i=0; i

// sine wave, 3 offset waves make a rainbow!

//float level = sin(i+Position) * 127 + 128;

//setPixel(i,level,0,0);

//float level = sin(i+Position) * 127 + 128;

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

setPixel(i,((sin(i+Position) * 127 + 128)/255)*red,

((sin(i+Position) * 127 + 128)/255)*green,

((sin(i+Position) * 127 + 128)/255)*blue);

}

showStrip();

delay(WaveDelay);

}

}

void meteorRain(byte red, byte green, byte blue, byte meteorSize, byte meteorTrailDecay, boolean meteorRandomDecay, int oldA0, int oldA1, int oldA2, int oldA3) {

setAll(0,0,0);

int SpeedDelay;

if(analogRead(A3)>=768){SpeedDelay=80;}

else if(analogRead(A3)>=512){SpeedDelay=60;}

else if(analogRead(A3)>=256){SpeedDelay=40;}

else{SpeedDelay=20;}

for(int i = 0; i < NUM_LEDS+NUM_LEDS; i++) {

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

// fade brightness all LEDs one step

for(int j=0; j

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

if( (!meteorRandomDecay) || (random(10)>5) ) {

fadeToBlack(j, meteorTrailDecay );

}

}

// draw meteor

for(int j = 0; j < meteorSize; j++) {

if(oldA0!=analogRead(A0)||((oldA1-256)>analogRead(A1))||((oldA1+256)analogRead(A2))||((oldA2+256)analogRead(A3))||((oldA3+256)

break;

}

if( ( i-j =0) ) {

setPixel(i-j, red, green, blue);

}

}

showStrip();

delay(SpeedDelay);

}

}

void fadeToBlack(int ledNo, byte fadeValue) {

#ifdef ADAFRUIT_NEOPIXEL_H

// NeoPixel

uint32_t oldColor;

uint8_t r, g, b;

int value;

oldColor = strip.getPixelColor(ledNo);

r = (oldColor & 0x00ff0000UL) >> 16;

g = (oldColor & 0x0000ff00UL) >> 8;

b = (oldColor & 0x000000ffUL);

r=(r<=10)? 0 : (int) r-(r*fadeValue/256);

g=(g<=10)? 0 : (int) g-(g*fadeValue/256);

b=(b<=10)? 0 : (int) b-(b*fadeValue/256);

strip.setPixelColor(ledNo, r,g,b);

#endif

#ifndef ADAFRUIT_NEOPIXEL_H

// FastLED

leds[ledNo].fadeToBlackBy( fadeValue );

#endif

}

// *** REPLACE TO HERE ***

void showStrip() {

#ifdef ADAFRUIT_NEOPIXEL_H

// NeoPixel

strip.show();

#endif

#ifndef ADAFRUIT_NEOPIXEL_H

// FastLED

FastLED.show();

#endif

}

void setPixel(int Pixel, byte red, byte green, byte blue) {

#ifdef ADAFRUIT_NEOPIXEL_H

// NeoPixel

strip.setPixelColor(Pixel, strip.Color(red, green, blue));

#endif

#ifndef ADAFRUIT_NEOPIXEL_H

// FastLED

leds[Pixel].r = red;

leds[Pixel].g = green;

leds[Pixel].b = blue;

#endif

}

void setAll(byte red, byte green, byte blue) {

for(int i = 0; i < NUM_LEDS; i++ ) {

setPixel(i, red, green, blue);

}

showStrip();

}

Step 3: Creating the Clock

I would recommend getting a glass clock that is flat on the inside. When I was applying the flexible mirror to the inside of the clock there was a problem due to the the numbers inside the clock popping out, the mirror was bending resulting into the infinity mirror effect not happening. You need to have the flexible mirror sheet and the Privacy Film to be as flat as possible. If you are getting a clock make sure you can place the LED inside without a problem.

Step 1: Open up the clock and remove the front glass

Step 2: Put on the Privacy Film on the front glass (This video shows you how to do it)

Step 3: Apply the the flexible mirror on the inside of the clock (Remove the clocks hands before doing this)

Step 4: Make a hole in the middle for the clock hands to be placed back in

Step 5: Place the LED strip around the inside walls of the clock (I used a hot glue gun for this step)

Step 6: Turn on the LED strip and place the glass on top of the clock to see if the infinity mirror effect is there

Step 7: Once you are done with everything put the clock together and let the wires pass through to the back

Step 8: Congrats you have completed the project and everything should work fine

If you have any questions please comment them below(Know that I might not be able to respond, but I will do my best)