Project tutorial
Infinity mirror clock

Infinity mirror clock © CC BY-NC-SA

Make your own infinity mirror clock!

  • 34,612 views
  • 32 comments
  • 98 respects

Components and supplies

About this project

We are in a wonderful design that you can offer both as a gift for yourself: Infinity Mirror Clock. Do not you want the mirror you possess to have an endless appearance and be used at the same time hour? We are very happy to share with you this project which is prepared with RGB LEDs which are widely used today. You can learn how to make an infinite mirror clock by watching your video.

Code

Arduino CodeArduino
#include <Adafruit_NeoPixel.h>
#include <stdio.h>
#include <DS1302.h>

#ifdef __AVR__
  #include <avr/power.h>
#endif

#define PIN            8
#define NUMPIXELS      60
Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUMPIXELS, PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel strip = Adafruit_NeoPixel(60, PIN, NEO_GRB + NEO_KHZ800);
namespace {


byte ysaat;
byte ydak;
byte saat;
byte dak;
byte sn;
byte kontrol=0;
 const int kCePin   = 5;  // Chip Enable
const int kIoPin   = 6;  // Input/Output
const int kSclkPin = 7;  // Serial Clock
 
DS1302 rtc(kCePin, kIoPin, kSclkPin);
 

}
 
void printTime() {
  // Get the current time and date from the chip.
  Time t = rtc.time();
  saat=t.hr;
  dak=t.min;
  sn=t.sec;
  if(saat>=12){saat=saat-12;}
  pixels.setPixelColor(5*saat, pixels.Color(25,25,255));
  pixels.setPixelColor(dak, pixels.Color(0,200,10));
  pixels.setPixelColor(sn, pixels.Color(255,0,0));
  
  pixels.show();
  //Serial.println(t.sec);
  //pixels.setPixelColor(t.hr, pixels.Color(0,0,0));
  //pixels.setPixelColor(t.sec-1, pixels.Color(0,0,0));
  
  pixels.show();
  if(sn==0)
   { 
    pixels.setPixelColor(dak-1, pixels.Color(0,0,0));
    pixels.setPixelColor(dak, pixels.Color(0,200,10));
     pixels.show();
    for(int i=1;i<60;i++)
      {
    pixels.setPixelColor(i, pixels.Color(0,0,0));
      }
    }

   if(dak==0)
  { 
    pixels.setPixelColor(59, pixels.Color(0,0,0));
    }
}


void animasyon()
{
  colorWipe(strip.Color(255, 0, 0), 25); // Red
  colorWipe(strip.Color(0, 255, 0), 25); // Green
  colorWipe(strip.Color(0, 0, 255), 25);
    theaterChase(strip.Color(127, 127, 127), 50); // White
  theaterChase(strip.Color(127, 0, 0), 50); // Red
  theaterChase(strip.Color(0, 0, 127), 50);
  for(int i=1;i<60;i++)
      {
    pixels.setPixelColor(i, pixels.Color(0,0,0));
      }
  
 }
 void colorWipe(uint32_t c, uint8_t wait) {
  for(uint16_t i=0; i<strip.numPixels(); i++) {
    strip.setPixelColor(i, c);
    strip.show();
    delay(wait);
  }
}
  void theaterChase(uint32_t c, uint8_t wait) {
  for (int j=0; j<10; j++) {  //do 10 cycles of chasing
    for (int q=0; q < 3; q++) {
      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, c);    //turn every third pixel on
      }
      strip.show();

      delay(wait);

      for (uint16_t i=0; i < strip.numPixels(); i=i+3) {
        strip.setPixelColor(i+q, 0);        //turn every third pixel off
      }
    }
  }
}


  void yenisaat()
  {
 //kontrol=0;
    saat=ysaat;
    dak=ydak;
     Time t(2018, 2, 23,ysaat, ydak, 0, Time::kFriday);
    rtc.time(t);
    
    }
  
 
 int clockSet =10;
 int up=11;
 int down=12;
void setup() {
  Serial.begin(9600);
#if defined (__AVR_ATtiny85__)
  if (F_CPU == 16000000) clock_prescale_set(clock_div_1);
#endif
strip.begin();
  strip.show();
pixels.begin();

pinMode( clockSet,INPUT);

 
  rtc.writeProtect(false);
  rtc.halt(false);
}
 
void loop() {

  
  if (kontrol==1)
  {
    pixels.setPixelColor(5*ysaat, pixels.Color(25,25,255));
    pixels.show();
  delay(100);
  pixels.setPixelColor(5*ysaat, pixels.Color(0,0,0));
  pixels.show();
  delay(100);
if (digitalRead(up)==HIGH)
{
  ysaat++;
  while(digitalRead(up)==HIGH);
  if(ysaat==12){ysaat=0;}
}
if (digitalRead(down)==HIGH)
{
  ysaat--;
  while(digitalRead(down)==HIGH);
  if(ysaat==255){ysaat=11;}
}
 
  pixels.setPixelColor(5*ysaat, pixels.Color(25,25,255));
  pixels.show();
  delay(100);
  pixels.setPixelColor(5*ysaat, pixels.Color(0,0,0));
  pixels.show();
  delay(100);
  yenisaat();
  if(digitalRead(clockSet)==HIGH)
  { 
  while(digitalRead(clockSet)==HIGH)
  { pixels.setPixelColor(kontrol, pixels.Color(255,255,255));
   pixels.show();
   }
   pixels.setPixelColor(kontrol, pixels.Color(0,0,0));
   pixels.show();
   kontrol++;
   ysaat=saat;ydak=dak;}
  
    }
 if (kontrol==2)
  {
    if(digitalRead(clockSet)==HIGH)
  { 
    kontrol++;
  while(digitalRead(clockSet)==HIGH)
  {    }
   
   ysaat=saat;ydak=dak;
   }
   
  if (digitalRead(up)==HIGH)
{
  ydak++;
  while(digitalRead(up)==HIGH);
  if(ydak==60){ysaat=0;}
}
if (digitalRead(down)==HIGH)
{
  ydak--;
  while(digitalRead(down)==HIGH);
  if(ydak==255){ydak=59;}
} 
  pixels.setPixelColor(ydak, pixels.Color(0,205,10));
  pixels.show();
  yenisaat();
  delay(100);
  pixels.setPixelColor(ydak, pixels.Color(0,0,0));
     pixels.show();
     delay(100); 
    }
  if (kontrol==3)
  {
    kontrol=0;
     yenisaat();
  }
  while (kontrol==0)
  {
    if(digitalRead(up)==HIGH)
  {
    animasyon ();
  }
    if(digitalRead(clockSet)==HIGH)
  { 
    kontrol++;
  while(digitalRead(clockSet)==HIGH);
  ysaat=saat;ydak=dak;}
  printTime();
  }
}

Custom parts and enclosures

dscn6767_gAlwC8CJ6h.JPG
Dscn6767 galwc8cj6h
dscn6764_rvXpiGXZeg.JPG
Dscn6764 rvxpigxzeg
dscn6766_2_hpc9JFfozt.jpg
Dscn6766 2 hpc9jffozt

Schematics

Schematic
Devre sema 2 acxzph1iit

Comments

Similar projects you might like

Infinity Mirror VU Meter Music Equalizer

Project showcase by TheTNR

  • 8,569 views
  • 5 comments
  • 38 respects

Arduino Infinity Mirror LED Clock

Project tutorial by Mirko Pavleski

  • 3,389 views
  • 2 comments
  • 3 respects

Kaleidoscope Infinity Mirror

Project tutorial by Lucas Ainsworth

  • 23,925 views
  • 3 comments
  • 89 respects

Italian Word Clock

Project tutorial by Tittiamo

  • 6,411 views
  • 5 comments
  • 15 respects

Clock Set Date Time

Project tutorial by Tittiamo

  • 60,636 views
  • 54 comments
  • 79 respects

Arduino Clock with Neopixel Ring Animation

Project tutorial by Alexander

  • 53,284 views
  • 44 comments
  • 78 respects
Add projectSign up / Login