Introduction: Easy - Infinity Mirror Clock

I've had a love-love relation with clocks and LEDs. Over the years, I've made quite a few clocks, but keep coming back to the Infinity Mirror Clock that I first made a few years back. However, with each iteration, the results have become better and easier to use. This latest iteration has the following features:

  1. The electronics are really simple now:
    • One ESP8266 module (Wemos D1 Mini)
    • WS2812B LED Strip with 60 LEDs - you can use different densities, and those would impact the overall size of the clock
  2. Open Source - source code available on GitHub and can be modified as required
    • Over-the-air updates
    • Has a web interface to change colors, time zones (if wanted) and other settings
    • Has a night mode - to either dim the lights or switch them off completely
    • Uses WiFi to get your time zone and time - so your clock is always synced and shows the correct time
    • Easy to set up the wifi
  3. Uses off-the-shelf photo frames to get a great finish
  4. The inner portion can be made using 3D printing, laser cutting, or at a stretch even using a simple saw - since this portion is hidden, it doesn't need to be very finished

Supplies

Electronic Hardware:

As mentioned previously, the electronic portion of this clock is very simple:

  1. Wemos D1 Mini (or other ESP8266 module): https://www.aliexpress.com/wholesale?SearchText=w...
  2. WS2812B LEDs: https://www.aliexpress.com/wholesale?SearchText=W...
  3. USB Cable: https://www.aliexpress.com/wholesale?SearchText=U...
  4. USB Charger (2Amp): https://www.aliexpress.com/wholesale?SearchText=U...

Options for internal structure include

  • 3D Printing (STL and editable model available)
  • Laser-cut MDF (SVG files included)
  • Plywood / MDF / Cardboard - the inner circle needs to be cut with some accuracy - so you need some way to do that
  • Convex Mirror (optional, but recommended)

The frame:

  • I'm partial to Ikea frames - but you can use any that are available in the size you decide
  • One-way mirror film https://www.aliexpress.com/wholesale?catId=0&Sear... - you can also buy this from auto accessories vendors or window manufacturers
  • Mirror / Mirror Tile so that it fits in the chosen frame

Step 1: What Is an Infinity Mirror

An infinity mirror is a set of parallel reflecting surfaces (one reflecting partially) with lights inside. The two mirrors create an effect where the lights vanish off to infinity due to multiple internal reflections.

The effect is made more interesting (at least I think so) by adding a convex mirror in the center.

More details at https://en.wikipedia.org/wiki/Infinity_mirror

Step 2: Choosing the Frame Size

As mentioned in the introduction, the size of the clock is dependant on the LED strip that you buy - and you need to find a frame based on that size. You get four kinds of LED strips easily:

  1. 30 LEDs / m - this would result in an inner size of 650mm x 650mm
  2. 60 LEDs / m - this would result in an inner size of 320mm x 320mm
  3. 100 LEDs / m - this would result in an inner size of 200mm x 200mm
  4. 144 LEDs / m - this would result in an inner size of 135mm x 135mm

The frame you need to choose would have to be larger than the size of the inner circle - for example, for a clock with 60 LEDs / m - I would suggest using a frame of size 500mm x 500mm

Step 3: Programming the ESP8266

I chose the Wemos D1 Mini, as it can be simply programmed using the USB port on the microcontroller. I would suggest using PlatformIO, but you can use the Arduino IDE as well. If you've never done this before, there are a few steps that need to be followed before you can program the ESP8266

PlatformIO

  1. Download and install Microsoft's free IDE - VSCode: https://code.visualstudio.com/download
    • Open VSCode Extension Manager
    • Search for official PlatformIO IDE extension
    • Install PlatformIO IDE.
  2. Open PlatformIO home and click on Platforms
    • Seach for Espressif 8266 and download the platform

Arduino IDE

  1. Download and install the Arduino IDE: https://www.arduino.cc/en/Main/Software
  2. Open the IDE and go to Tools -> Boards -> Boards Manager...
  3. Search for ESP8266 and click install

The Code

The source code for the project can be downloaded from github (for the latest version): https://github.com/dushyantahuja/SmallInfinityMirr...

Click on "Clone or Download" and then "Download Zip" (see image for reference) and extract it.

You can now open this in PlatformIO or Arduino. PlatformIO will download the required libraries automatically, however you will have to download these manually if you're using the Arduino IDE:

  1. IPGeolocation
  2. FastLED
  3. NTPClient
  4. Time<
  5. ArduinoJSON
  6. ESPAsyncTCP
  7. ESP Async WebServer@1.2.2 - make sure you download version 1.2.2 - the newer version seems to error out while compiling - and I haven't really looked into it
  8. ESPAsyncWifiManager

IP Geolocation

The clock is designed to locate your time zone using your IP address (geolocation). To use this feature, you need to register at https://ipgeolocation.io/signup.html and create an API Key. Then replace the Xs in Line 21 to the API Key that you have generated

String IPGeoKey = "XXXXXXXXXXXXXXXXX";
In case, you do not want to use geolocation, or if you want to set the clock to a different time zone, you will have to make the following modifications to the code:
Comment out lines 20 and 21
#include <ipgeolocation.h>
String IPGeoKey = "XXXXXXXXXXXXXXXXX";
Comment out lines 102 to 105
IPGeolocation IPG(IPGeoKey);
IPGeo I;
IPG.updateStatus(&I);
timeClient.setTimeOffset(I.offset*3600);
Modify line 40 to set your time zone
NTPClient timeClient(ntpUDP, "europe.pool.ntp.org", 0, 360000);
The third parameter (0 in the line above) is the timezone offset in seconds. So if the offset is one hour, put in 3600 instead of zero. Please note, in case there you will need to change this for daylight savings, or if you move to a different timezone.

Uploading the Code

  1. Make sure you have the correct USB driver (the Wemos D1 mini has a CH340g chipset for the USB interface)
  2. Attach the Wemos D1 mini using the USB cable
  3. Open the downloaded project and
    1. On platform IO: click on Upload and then Upload File System Image
    2. On Arduino IDE: click on Upload and then Tools -> ESP8266 Sketch Data Upload

Step 4: Electronics

As mentioned previously, the electronic portion of this clock is very simple:

  1. Wemos D1 Mini (or other ESP8266 module): https://www.aliexpress.com/wholesale?SearchText=w...
  2. WS2812B LEDs: https://www.aliexpress.com/wholesale?SearchText=W...
  3. USB Cable: https://www.aliexpress.com/wholesale?SearchText=U...
  4. USB Charger (2Amp): https://www.aliexpress.com/wholesale?SearchText=U...

You need to connect them as follows:

  • Cut the male end of the USB Cable and solder the red wire to the 5V pin
  • Solder the black wire to the pin marked G
  • Solder the red wire from the WS2812B strip to the 5V pin
  • Solder the black wire from the WS2812B strip to the G pin
  • Solder the Green wire (Data In) from the WS2812B strip to the pin marked D2

Check that the code runs by powering on the Wemos D1 Mini - in a couple of seconds the LED strip should show a dim rainbow, and the module should create a Wifi Hotspot called "SmallInfinityMirror" - more on that later

Step 5: Internal Structure

Structure for LEDs

The internal structure provides a perfect circle for the LED strips - it is sized so that 60 LEDs fit in a complete circle - one for each minute in the hour. You can create the internal structure using a variety of methods:

  1. 3D Printing
  2. Laser Cutting
    • See attached SVGs for 200mm x 200mm Frames using 100 LEDs per m. You need to cut the pieces using 6mm MDF or Ply and then glue them together
  3. Plywood / MDF - You can manually cut a piece of >12mm Plywood / MDF so that the outside dimensions fit the chosen frame, and the inside circle based on the LED strip chosen:
    • 144 LEDs per m: 134.5mm diameter
    • 100 LEDs per m: 192mm diameter
    • 60 LEDs per m: 318.5mm diameter
    • 30 LEDs per m: 637mm diameter
    • This circle needs to be accurate so that the LED strip fills the whole circle and there are no gaps or overlaps.
    • You need some space for the wires and the microcontroller - so those will also need to be cut - see attached photo with dimensions for a 60 LEDs per m strip and a 600mm x 600mm frame for the basic structure - this can be resized to match what the equipment you have on hand

Fixing the LEDs

With the internal structure facing towards you, start sticking the LED strip from the top going towards the right. This is very important because if you stick them the wrong way around, the clock will work backwards and the code will have to be modified to make the clock work correctly. I have done this, so let me know if you get it wrong and I can provide links to the modified code.

  • Put a small piece of electrician's tape on the contacts at the top to ensure the LED strip doesn't short with itself when you stick the whole thing.
  • You can use a thin double-sided tape to ensure the LEDs stick well.
  • Place the Wemos D1 Mini in the small are made for this.

Cardstock/Mountboard

In addition to the above, you need to cut a piece of cardstock/mountboard with the following dimensions:

  • Outside dimensions to fit inside the chosen frame
  • A circle in the center to match the inside diameter of the structure above - you can use the actual structure to mark the circle and then cut it. Alternatively, you can use a laser cutter, or 3D printer to generate this layer

Step 6: Assembling the Clock

Depending on what you have used to create the frame, the actual process would be slightly different for each of you, but the gist of the process is as follows:

  1. Open the frame, and take out the front glass. Stick the One-Way mirror film to the inside of the glass
  2. Place the glass back in the frame
  3. Place the piece of cardstock/mountboard behind the glass
  4. Stick the convex mirror to the flat mirror
  5. Stick the mirror to the Internal Structure
  6. Place the Internal Structure created in the previous step behind the cardstock/mountboard
  7. Cut a small hole in the back of the frame for the wires and close the frame

One-Way mirror film

This part requires a lot of patience as any defects while applying this would be visible in the final product. I would suggest you view a couple of videos on youtube before you apply the film for the first time. One I liked was

Use a lot of soapy water, so that the film floats on the water before you press it down.

You can use acrylic/glass one-way mirrors as well - these are more expensive than the film, but provide a better result in the end.

Step 7: Set-Up

Setting up the WiFi

As the clock uses the internet to get the timezone and the time, you need to setup the microcontroller so that it can connect to your wifi router. When you switch on the microcontroller for the first time, it switches on all the LEDs to a dim rainbow and sets up a WiFi access point called SmallInfinityMirror.

  1. Use your phone or laptop to connect to this access point
  2. In most cases, the device should automatically open a registration page, if not go to 192.168.4.1 in your browser
  3. Click on Configure WiFi
  4. Choose your home WiFi and enter the password

Once you save, the clock should restart and connect to your WiFi.

Clock Settings

This is an optional piece and requires you to connect to the device via the router. You need to find the IP address of the device from your router. I will leave that to you, as each router has a different interface.

Once you find the IP address, put that in your web browser, and you should see the home page. The clock configuration page allows you to change the following settings:

  1. Daytime Brightness
  2. Nighttime Brightness
  3. Time to Switch on
  4. Time to Switch off
  5. Effects Every n minutes

The Choose Colors page allows you to change the colors of the various clock features.

The Load New Firmware page allows you to upload new firmware and web pages.

Step 8: Final Result

I've made multiple versions in the last few months - see attached photos. Hang the clock somewhere prominent and connect it to the 5V adapter.

The clock has been designed to show the hour hand using one color, and a running pattern that increases as the minutes go by. See attached photos.

Step 9: Acknowledgements

I could not have completed this project without all the works by other authors, most notable among them being:

  1. Daniel Garcia & Mark Kriegsman who developed FastLED; without this library, the clock is simply impossible to build
  2. Jason Coon for his ESP8266 FastLED Webserver code
  3. Andreas Spiess for his fantastic Youtube channel and explaining how to build a webserver on the ESP8266
  4. Alan Steremberg for the amazing ESP Async set of libraries

And many more, for the amazing work they've done with the platform.

Make it Glow Contest

Participated in the
Make it Glow Contest