Infinity Mirror Clock using Arduino

Ever since my addressable RGB LED strips (WS2812B) came from Aliexpress, I’ve been fascinated with LED projects. Following up on my success with my Charlieplexed LED clock, I wanted to create something with more Jazz..

While browsing google images, I came across an instructable for an Arduino Infinity Mirror and the brain cells started working in overdrive. Why shouldn’t I make an infinity mirror, that’s also a clock !!


  1. Works like a clock – the colours of the hands are user-programmable over bluetooth
  2. Has an IR sensor to sense if someone is coming near the mirror. Switches off the LEDs, so that this can be used as a normal mirror 🙂
  3. Shows a rainbow effect every 15 minutes (time is user adjustable)
  4. Has a touch button to toggle between clock and rainbow effects
  5. Switches to night mode between midnight and 7:00 AM – can be changed in the code.
  6. Can be programmed over bluetooth – so you do not need to take it off the wall if you need to update the code

Infinity Mirror Clock using Arduino

Step 1: Electronics

  1. A Standalone Arduino:… OR Arduino mini pro:…
  2. RTC Module – DS1302:
  3. LM2596 Step Down Adjustable Power Supply Module 1.3V-35V:…
  4. 1m 60LEDs/M Addressable RGB LED Strip (WS2812B):…
  5. HC-05 Bluetooth module:…
  6. IR Proximity Sensor:…4 IR LEDs; 1 IR LED detector:…
  7. Touch Pad:…
  8. 9V – 2A Adapter
  9. CP2102 USB-to-TTL (the RST pin on the CP2102 is not for resetting the arduino – you have to solder a wire to the DTR pad on the PCB – which sends a reset signal to program the arduino. This has to be connected to the DTR pin on the Arduino

Step 2: The Circuit

The circuit is very simple:

  1. LED Strip – Connect power to the LM2596 Step Down Adjustable Power Supply Module – ensure you adjust the pot so that the output is 5V; Connect the ground to the common ground; Connect data to pin D5 of the Arduino
  2. Touch Sensor – data to pin D2 of Arduino
  3. RTC Module – SDA and SCL to the A4 and A5 of the Arduino respectively
  4. Bluetooth Module – Connect RX to Arduino’s TX and TX to Arduino’s RX. You will have to break-out pin 32 on the module to the DTR pin on the Arduino (This allows you to program the Arduino over bluetooth)
  5. IR Proximity Sensor – create the sensor as per this instructable:… – connect the photo-diode to A1 (A0 on the instructable schematic) and the IR LEDs to D13 (D2 on the instructable schematic)
  6. Connect the Power 9V 2A Power supply to the input of the 7805 and the LM2596

To setup the bluetooth programming circuit, please follow this link:…

Step 3: The Code

This clock uses the following libraries (and all thanks to the authors of these libraries):

The latest version of the code can be downloaded from the project github:…

#include <Wire.h>
#include "RTClib.h"
#include "FastLED.h"
#include <SoftwareSerial.h>
#include <SerialCommand.h>
#include "EEPROM.h"
#include "TimerOne.h"

#define NUM_LEDS 60
#define DATA_PIN 5
#define SWITCHPIN 2

// Variables for IR Proximity

int IRpin = A1;               // IR photodiode on analog pin A1
int IRemitter = 13;            // IR emitter LED on digital pin 4


CRGBPalette16 currentPalette;
TBlendType    currentBlending;

CRGB leds[NUM_LEDS],minutes,hours,seconds,l,bg,lines;
RTC_DS1307 rtc;
SerialCommand sCmd;
boolean missed=0, ledState = 1, lastsec=1, multieffects = 0;
byte lastsecond, rain;
int light_low, light_high;
DateTime now;

void(* resetFunc) (void) = 0;

void setup() {
  digitalWrite(IRemitter,LOW);             // turning the IR LEDs off - as a precaution - they don't have current limiting resistors
  FastLED.addLeds<WS2812B, DATA_PIN, GRB>(leds, NUM_LEDS);
  currentPalette = RainbowStripeColors_p;
  currentBlending = NOBLEND;

  // ******** Setup the default values for parameters (if not set before)
  if ( != 1){               // Check if colours have been set or not
    EEPROM.write(0,255);                   // Seconds Colour - R-G-B - White
    EEPROM.write(3,255);                   // Minutes Colour - R-G-B - Red
    EEPROM.write(6,0);                     // Hours Colour - R-G-B - Green
    EEPROM.write(9,0);                     // BG Colour - R-G-B - Black
    EEPROM.write(12, 0);                   // Light sensitivity - low
    EEPROM.write(13, 55);                  // Light sensitivity - high 
    EEPROM.write(14, 15);                  // Minutes for each rainbow   
  // Else read the parameters from the EEPROM
  else {
    seconds.r =;
    seconds.g =;
    seconds.b =;  
    minutes.r =;
    minutes.g =;
    minutes.b =;
    hours.r =;
    hours.g =;
    hours.b =;
    bg.r =;
    bg.g =;
    bg.b =;
    light_low =;
    light_high =; 
    rain =; 

  // ********** Setup the serial commands

  sCmd.addCommand("MULTI", set_multi);
  sCmd.addCommand("STAT", clockstatus);
  sCmd.addCommand("SETRAIN", set_rainbow);
  sCmd.addCommand("HOUR", set_hour);
  sCmd.addCommand("MIN", set_minute);
  sCmd.addCommand("SEC", set_second);
  sCmd.addCommand("BG", set_bg);
  sCmd.addCommand("LIGHT", set_light);
  sCmd.addCommand("TIME", set_time);
  sCmd.addCommand("MISSED", missedCall);
  sCmd.addCommand("MISSEDOFF", missedOff);
  sCmd.addCommand("RAINBOW", effects);
  sCmd.addCommand("MISSED", missedCall);
  sCmd.addCommand("MISSEDOFF", missedOff);

  // ********** Set all LEDs to background colour
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = bg;

  pinMode(IRemitter,OUTPUT);  // IR emitter LED on digital pin 2
  digitalWrite(IRemitter,LOW);// setup IR LED as off
  attachInterrupt(1, set_multi, FALLING);
  Timer1.attachInterrupt(state, 500000);

void loop() {
  if(readIR(10) > 50){            // Switch off LEDs if someone is near the mirror - so that it can be used as a mirror. Switch off LEDs between 12:00 and 6:00 to save energy and cool down the LEDs and power supplies
    for (int i = 0; i < NUM_LEDS; i++) {
      leds[i] = CRGB::Black;
    ledState = 1;
  else {
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = bg;
  if(multieffects){                 // Check if the button for multi-effects has been pressed
    uint8_t secondHand;
    secondHand = now.second();
    if( secondHand ==  0)  { currentPalette = RainbowColors_p;         currentBlending = BLEND; }
    if( secondHand == 30)  { currentPalette = RainbowStripeColors_p;   currentBlending = BLEND;  }
    static uint8_t startIndex = 0;
    startIndex = startIndex + 1;
    FillLEDsFromPaletteColors( startIndex);;
  else if(ledState){                	// Main clock code
    // Setting brightness to light_high
    int x = light_high; 		// analogRead(IRpin);
    now =;        
    if(( now.minute() % rain == 0 && now.second() == 0)){
    for(byte i=0; i<=now.minute();i++){
      leds[i] = minutes;
    for(byte i = 0; i<60; i+=5){
    for(byte i=(now.hour()%12)*5; i<=((now.hour())%12)*5+(now.minute()/12);i++){
      leds[i] = hours;
    if(now.hour() < 7) LEDS.setBrightness(constrain(light_low,0,100)); 		// Set brightness to light_low during night - cools down LEDs and power supplies.
    else LEDS.setBrightness(constrain(light_high,10,255));
      leds[now.second()] = seconds;
      lastsecond = now.second();
      lastsec = 0;
      // Serial.println("ON");
    } else {
      leds[lastsecond] = l;
      if(missed) all_off();
      // Serial.println("OFF");
      lastsec = 1;
    ledState = 0;
  if(multieffects) FastLED.delay(1000 / UPDATES_PER_SECOND);

void FillLEDsFromPaletteColors( uint8_t colorIndex)
  uint8_t brightness = 255;

  for( int i = 0; i < NUM_LEDS; i++) {
    leds[i] = ColorFromPalette( currentPalette, colorIndex, brightness, currentBlending);
    colorIndex += 3;

void set_multi(){
  static unsigned long last_interrupt_time = 0;
  unsigned long interrupt_time = millis();
  if (interrupt_time - last_interrupt_time > 200) 
      for (int i = 0; i < NUM_LEDS; i++) {
        leds[i] = bg;
    multieffects = !multieffects;
  last_interrupt_time = interrupt_time;

void set_rainbow(){
  rain = atoi(;
  Serial.println("RAINBOW TIME SET");

void clockstatus(){
  Serial.println("Status: ");
  Serial.print("BG: ");
  Serial.print(" ");
  Serial.print(" ");
  Serial.print("SEC: ");
  Serial.print(" ");
  Serial.print(" ");
  Serial.print("MINUTE: ");
  Serial.print(" ");
  Serial.print(" ");
  Serial.print("HOUR: ");
  Serial.print(" ");
  Serial.print(" ");
  Serial.print("Ambient Light: ");
  Serial.print("Light set - High:");
  Serial.print("Light set - Low:");
  Serial.print("Date: ");
  DateTime now =; // DateTime(2014,5,2,22,30,0); 
  Serial.print(, DEC);
  Serial.print(now.month(), DEC);
  Serial.println(now.year(), DEC);
  Serial.print("Time: ");
  Serial.print(now.hour(), DEC);
  Serial.print(now.minute(), DEC);
  Serial.print(now.second(), DEC);
  Serial.print("Distance: ");

void state(){
  ledState = 1;

const int colorWheelAngle = 255 / NUM_LEDS;

void effects(){
  for (int j=0; j<3; j++){
    for (int i = 0; i < 60; i++) { 
  lastsec = 1;

void missedCall()
    missed = 1;

void missedOff()
    missed = 0;

void all_off(){
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = CRGB::Black;

void set_hour(){
  hours.r = atoi(;
  hours.g = atoi(;
  hours.b = atoi(;
  Serial.println("HOUR COLOUR SET");  

void set_minute(){
  minutes.r = atoi(;
  minutes.g = atoi(;
  minutes.b = atoi(;
  Serial.println("MINUTE COLOUR SET");  

void set_second(){
  seconds.r = atoi(;
  seconds.g = atoi(;
  seconds.b = atoi(;
  Serial.println("SECOND COLOUR SET"); 

void set_bg(){
  bg.r = atoi(;
  bg.g = atoi(;
  bg.b = atoi(;
  Serial.println("BG COLOUR SET");
  for (int i = 0; i < NUM_LEDS; i++) {
    leds[i] = bg;

void set_light(){
  light_low = atoi(;
  light_high = atoi(;
  Serial.println("LIGHT SET"); 

void set_time(){
  String set_date, set_time;
  set_date = (String) + ' ' + (String) + ' ' + (String);
  set_time = (String);

int readIR(int times){
  int ambientIR;                              // variable to store the IR coming from the ambient
  int obstacleIR;                             // variable to store the IR coming from the object
  int value[10];                              // variable to store the IR values
  int distance;                               // variable that will tell if there is an obstacle or not
  for(int x=0;x<times;x++){     
    digitalWrite(IRemitter,LOW);              // turning the IR LEDs off to read the IR coming from the ambient
    delay(1);                                             // minimum delay necessary to read values
    ambientIR = analogRead(IRpin);            // storing IR coming from the ambient
    digitalWrite(IRemitter,HIGH);             // turning the IR LEDs on to read the IR coming from the obstacle
    delay(1);                                 // minimum delay necessary to read values
    obstacleIR = analogRead(IRpin);           // storing IR coming from the obstacle
    value[x] = ambientIR-obstacleIR;          // calculating changes in IR values and storing it for future average

  for(int x=0;x<times;x++){                   // calculating the average based on the "accuracy"
  digitalWrite(IRemitter,LOW);                // turning the IR LEDs off
  return(distance/times);                     // return the final value

Step 4: Assembling the Clock

Infinity Mirror Clock using Arduino schematic

The clock is primarily made up of the following:

  1. 2 pieces of 8mm plywood (600mm x 600mm) – needs to be cut as per the schematic above
  2. 1 piece of 18mm block-board (600mm x 600mm) – needs to be cut as per the schematic above. Please be careful with the circle – the circumference needs to be exactly 1000mm so that the 60 LEDs fit properly. I got it cut from a carpenter and he rounded up the radius from 159.23 to 160 – so I had to use double sided foam tape to get the LEDs to fit properly
  3. 1 circular 6mm mirror – 400mm dia
  4. 1 circular 6mm glass – 400mm dia. You need to put silver sun-control film on this – you can get this either from auto-accessories vendors or from window / glazing installers. 3M has a very good film that you should be able to get from 3M dealers
  5. 1 small round steel plate (100mm dia)
  6. N45 Silicon adhesive
  7. Black Paint
  8. Black Vinyl – you can get this from auto-accessories vendors or sticker manufacturers. We used a slightly sparkling matt black – similar to this:…


  1. Join the pieces of plywood and block-board together, keeping the block-board in the center – you should use Fevicol (or similar) as well as nail it down
  2. Paint the interior portion Black
  3. Stick the LED strip to the interior of the circular cutout in the block-board. Ensure that the first LED is at the 12 o’ clock position
  4. Wire up the Arduino as per the circuit in the previous step and hot-glue it to the square cutout
  5. Mount the touch-sensor on one of the sides using hot-glue (you will have to drill the block-board slightly so that the wires fit and don’t show)
  6. Stick the mirror on the back side (facing up) using N45 silicon glue
  7. Stick the steel plate at the center of the mirror
  8. Stick the glass on the front side (film inside) using N45 silicon glue
  9. Test the circuit by plugging it in
  10. Troubleshoot 🙂
  11. Fix the black vinyl on the front side – you will have to cut a circle in the center (~380 mm dia) so that the joint between the glass and the wood gets hidden.

I’m an architect, a project manager, a photographer, a rock climber, an origami enthusiast, a gymnast, a skater, a dramatist, a paraglider, a sky-diver, a karate expert and a million other things. How does someone define himself / herself? To me I’m just ‘me’, to others I’m“you”, “brother”, “friend”, et al.

So I’ll make things simpler by saying what I did and not what I am.

architecture from ChandigarhProfessionally I completed my architecture from Chandigarh in 2002, went on for a masters’ programme in project management from Delhi and finally took up a job with Cushman & Wakefield in Mumbai. Worked for a couple of years and started my own project management practice in Mumbai.

I completed an MBA in Finance and Strategy from the Indian School of Business and am currently working for EC Harris in the renewable energy space.

Personally I believe in taking things to the extreme – I have a list of dreams that I intend to fulfill and that too as fast as possible so that I can enhance that list with many more things. Till date some of the things I have done include Karate (National level player), Gymnastics (State level player), Para-gliding (P1), Sky-Diving (3 jumps), Rock Climbing (Basic Course), etc. I have my own photo-blog which I update and intend to do many more things . . .


This Post / Project can also be found using search terms:

  • led project
  • arduino project mirror clock
  • clock infinity mirror
  • diy arduino clock
Clip to Evernote

Leave a Comment

(Spamcheck Enabled)

Read previous post:
Arduino PIP-Boy
How to Make a PIP-Boy using an Arduino

So what exactly is a PIP-Boy, you ask? For those unfamiliar, a PIP-Boy is a device used by the protagonist...

Scroll to top