Introduction: Creating a Stylish Triangular Pixels LED Clock Using WS2812 Leds and Wemos D1 Mini Module

Clocks are an essential part of our daily routine that help us manage time effectively and stay on track. Clocks can help regulate our sleep patterns and ensure that we meet our deadlines. They not only serve a functional purpose but also enhance the decor of our homes. In the next article, I will explore the construction of a LED clock, which combines functionality and style, making it a fun DIY project for those interested in electronics and design.

I wanted to make a special gift for our dear family members, and I searched extensively for something beautiful and unique. And since every home needs a special clock, I finally found exactly what I wanted. I know that my project won't be very original, but I really liked Mukesh Sankhla's two projects: RGB Hex Matrix | IOT Clock and RGB Hex Matrix | IOT Clock 2.0, and I decided that a clock based on his idea would be a perfect gift.

However, I wanted to make everything a little more in line with my style. I redesigned the casing, the matrix, the display mode, and used WS2812 LED strips. I also made everything slightly larger and slimmer so that the clock can be used either as a table clock or a wall clock and last but not least, a completely different software. But more about the construction in the following steps.

I hope you'll have the patience to go through them until the end :)

Step 1: Parts and Components

  • 3D printed components: LED base, grid, body, fixing and support elements, Wemos D1 Mini box

  • WS2812 LED strip, 60led/m, 96 LEDs
  • Wemos D1 Mini, ESP8266, module
  • Smoked acrylic plate, 3mm thick
  • 5.5mmx2.5mm Female DC plug with cable
  • 5v/3A power source
  • Mini screws (12 mm length, 2 mm thread diameter, 5 mm head diameter)
  • Wires, Heat Shrinkable Tubes, Hot Glue

Step 2: The Assembly of the Clock

I started building the clock by 3D printing the LED base. (While I started mounting the LEDs on the base, I continued to print the rest of the components.) The order of mounting the LEDs is according to the diagram in the image above. I cut the required number of LEDs from the LED strip and pushed them onto the base. Unfortunately, the adhesive on the strip pieces wasn't very strong, so after a while, the pieces came off, and I had to intervene with some drops of super glue. Pay attention to the direction of the strips, i.e., the direction in which the data flows, as shown in the electronic diagram above. After gluing all the pieces, I cut the hexagonal shape from smoked acrylic according to the dimensions on Tinkercad (I attached the SVG file, at the end of the step). I cut the same shape from a high-quality white copier paper.

When I had all the 3D printed components ready, I proceeded with the actual assembly. I placed the smoked acrylic piece in the body, followed by the paper piece. I positioned the grid over the LED base and neatly arranged the connection wires alongside the grid so that the LED base and the grid assembly fit nicely into the body. Then I fixed the hanger with mini screws, the two side fixing pieces, and the support foot.

Next, I made the connections between the LEDs, the Wemos module, and the power cord according to the electronic diagram. I then mounted the Wemos module (using a few drops of hot glue) in its own box, put the cap on, and fixed the box to the back of the clock (also with hot glue).

You can follow all these steps in the above pictures.

The last step was uploading the program to the Wemos module."

Step 3: The Software

The software consists of 2 parts: the web config interface, which is responsible for retrieving the exact time from the internet, and the second that is responsible for displaying the exact time on the clock display.

1.The web config interface is based on John Lassen's excellent ESP8266 Arduino IDE WebConfig, which has been modified, adapted and improved by BVB_WebConfig_OTA_V7 by Andreas Spiess. This framework is very stable, easy to configure, works perfectly on all mobile devices, whether iOS or Android, and your own HTML pages can be easily defined. I have used this code in many of my projects here on Instructables, for example the Cistercian Clock.

I had to make a small modification. In the house where the clock will function, there is no router, but everyone who lives there has phones with access to mobile data. So, I configured a preset connection in the program. On one of the phones, I configured a hotspot according to the connection in the program, and the clock connects to the hotspot at startup and retrieves the exact time through that hotspot. In my code, the hotspot is named "TPLedClock" and the password is "asdfg12345". Of course, you can change this in the code and configure your phone accordingly.

2.I achieved displaying the exact time on the display with triangular pixels by using the palette crossfade effect of the FastLED library. I used a "classic" example from github here (thanks to Mark Kriegsman). Every minute, i.e. at zero seconds, both the palette of colors in which the digits are displayed and the palette of colors for the background change. I borrowed some palettes from the example of colorvaweswithpalette here for the background and I chose some palettes from cpt-city for the digits so that they would be as contrasting as possible. Having 32 color palettes for the background and 16 palettes for the digits results in one of the 512 random color combinations being displayed every minute. As you will see in the video material, the color effects are very attractive, at least I think so :) .

A few observations:

  • Even on the first start of the program right after the first upload to the Wemos module, the clock cannot connect to the hotspot. At first, the connection data is saved, but on the second startup, the connection takes place normally.
  • Also, some variables in the program need to be changed depending on the geographical region where you live: the NTP server, the time zone, and whether daylight saving time is applicable in your region. These variables are located in the main part of the program "Triangular_Pixels_LED_Clock.ino", on lines 87, 89, and 90.
  • If you do not want to use the hotspot connection, there is no problem, the web config interface continues to work as in my Cistercian clock project.
  • You can add more color palettes using PaletteKnife for FastLED, the list of color palettes must be updated, and the range of variables BgIndex and TimeIndex (random selection of color palettes) will be modified accordingly.
  • If you use the clock without a router, after about two months, the clock will be delayed or will run faster by about a minute. Start the hotspot, restart the clock, and the program will reinitialize the exact time.

You can find the source code on Github.

I compiled everything with Arduino IDE 1.8.19, ESP8266 Framework 2.7.4 and FastLED 3.5.0

Bellow, you can watch in the following video how the clock works.

Step 4: The Video

Step 5: Some Final Words

In conclusion, building this clock was a fun and rewarding project. I think anyone can create a beautiful and functional clock like the one described in my tutorial. Whether you're an experienced maker or a beginner, this clock project can help you expand your knowledge in the areas of 3D printing, electronics, and programming. Plus, you'll have a unique and eye-catching clock to display in your home or office!

I hope this tutorial has been helpful and inspiring. Don't hesitate to share with us your own triangular pixels clock construction. Ask any questions you may have I will try to answer. Happy making!

For the Home Contest

Finalist in the
For the Home Contest