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

14K17562

Intro: 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!

47 Comments

It's so beautiful yet simple-looking. I actually built it myself and modified it a bit, although the 3D printed parts are still the same and the case is no different. So sadly, I am facing issues with the cables fitting inside. It's 20AWG... what size of wires are you using ?

Hi. I use AWG 24 wires with very soft silicone insulation that are excellent to work with. I also have some AWG 24 wires with PVC insulation, but they are extremely rigid, so I use them less often.

I am not very experienced with coding micro Controllers. Could you possibly give a tutorial on how to set it up or send a video on how to do it in a similar project.

Thanks for your comment! I understand that coding microcontrollers can be new and challenging. While I can't offer a full tutorial in the comments, there are some great resources online that can get you started.

Getting Started:

  1. "Wemos D1 Mini Arduino IDE Setup" on Wemos Documentation: This official guide walks you through setting up the Arduino IDE for your Wemos D1 Mini.
  2. "Wemos D1 Mini Blink LED" tutorial on Instructables: This beginner-friendly project by Instructables teaches you how to blink an LED with your Wemos.

Learning the Basics:

  1. "Wemos D1 Mini Digital Pins" by DIY Projects Lab: This tutorial explains digital pins and their functionalities on the Wemos D1 Mini.
  2. "Wemos D1 Mini Analog Pins" by Random Nerd Tutorials: This guide by Random Nerd Tutorials dives into using analog pins for reading sensor data.
  3. "Wemos D1 Mini Control LED with Button" on YouTube by TheEngineeringGuy: This video tutorial demonstrates controlling an LED with a button using your Wemos.
  4. "Wemos D1 Mini Serial Communication" by How to Electronics: This tutorial from How to Electronics explains serial communication for debugging and data transfer.

Taking it Further:

  1. "Wemos D1 Mini with DHT Sensor" by Circuits by Geeks: This guide by Circuits by Geeks shows you how to connect and use a DHT sensor (temperature & humidity) with your Wemos.
  2. "Wemos D1 Mini WiFi Connection" on Random Nerd Tutorials: This comprehensive tutorial by Random Nerd Tutorials teaches you how to connect your Wemos D1 Mini to WiFi.
  3. "Wemos D1 Mini Blynk App Control" by IoT Starters: This guide on IoT Starters explains how to control your Wemos project with the Blynk app for remote control.
  4. "Advanced Wemos D1 Mini Projects" on Hackster.io: Hackster.io is a great platform to explore a wide variety of advanced Wemos D1 Mini projects with tutorials and code examples.

Remember, these are just a starting point so these resources will teach you the basics you need to understand my project.

Happy learning!

Hi,

I want to make this clock.

Where do I get the .stl for the case?


Ahh, i got it, its on tinkercad.

I will report, when I finished the project.


к получить доступ к web интерфейсу настроек? когда я запуская скетч, в мониторе порта у меня появляется следующее
Connection Failed! activating the AP mode...
Wifi ip:(IP unset)
Setting AP mode default parameters
Writing Config
Wifi ip:192.168.4.1
HTTP server started
Printing Config
DHCP:1
DayLight:1
NTP update every 3 sec
Timezone 35
IP:192.168.1.100
Mask:255.255.255.0
Gateway:192.168.1.254
SSID:TPLedClock
PWD:123456789
ntp ServerName:0.europe.pool.ntp.org
Device Name:Triangular Pixels LED Clock
FastLed Setup done


сеть wifi я вижу, но пароль у меня не принимает, замена пароля в скетче не помогает, подключиться не могу
спасибо за очень крутой проект. я его повторил. все работает, но у меня 3 вопроса
1. что именно и где поменять в скетче, что бы часы подключались к домашней wifi сети к роутеру. при замене в скетче логина и пароля, у меня нет подключения к роутеру
2. когда часы работаю, на световые эффекты накладывается мигание белого цвета, как стробоскоп. никак не получается избавиться от этого
3. что и где поменять в скетче, что бы световой эффект менялся не каждую минуту, а скажем каждый час.
Привет. А из чего лучше сделать рассеиватель? Не могу подобрать что бы и диоды не видно было и не тускло горело)
Discussions about the best diffusers for LEDs are abundant online, I can tell you what I use, exactly what I used in the project: a sheet of white paper and a smoky plexiglass plate.
The white paper I use is thicker than the standard copier paper found everywhere in stationery stores, you should look for something thicker and with a uniform texture.
Of course, the distance between the paper and the LED matters too, around 1 cm at least, and the LED brightness you use also matters... experiment...
я рассеиватели делаю просто. прозрачное оргстекло или любой отражать от светильников для подвесных потолков, на изнаночную сторону наношу хороший слой карандашного клея (ТОЛЬКО БЕЗ КОМКОВ) и наклеиваю слой кальки или 2 слоя - по желанию. главное ровно наклеить до момента высыхания клея.
  • If you want to connect the clock to your home router, you need to know the SSID of the router and the password. If you place these two variables where needed and they are written correctly - lines 71 and 72 (see GitHub) - then the clock should connect without any problems, but in two steps. First, you turn it on, it doesn't connect, then you restart it, and it should connect. However, the clock also has a web server where you can configure many other things, including the connection to the router. I wrote about this in the article.
  • If white flashes accidentally appear on multiple LEDs, the problem could come from various sources: poor-quality or defective LEDs, a low-quality power supply, or even issues with the Wemos module. In general, it's a hardware problem. You can try placing a resistor of several hundred ohms (330 - 470 ohms) between the output pin of the Wemos and the input pin of the first LED. You can also try modifying the first line of code "#define FASTLED_INTERRUPT_RETRY_COUNT" from 0 to 1 or delete the line completely, but I don't think that's the issue.
  • You modify: 16 int temp_hour = 0; 181 if (temp_hour != DateTime.hour or temp_hour == 0) { 182 temp_hour = DateTime.hour *All line numbers refer to "Triangular_Pixels_LED_Clock.ino" on GitHub.
  • *появление белых вспышек это не аппаратная проблема, поскольку заливая другие скетч, для проверки, все работает нормально. сопротивление не помогает.
    *про остальное буду пробовать. я нечайно спалил wemos, заказал на алиэкспресс, идти будет долго, как придет буду пробовать.
    If there had been a software issue, I would have experienced the same problem, wouldn't I? The software loaded onto the Wemos is exactly what I posted on GitHub. The clock I built, following the article and as shown in the video material, is currently working fine. What else can I say? I'm sorry I can't provide more assistance.
    Получил новый контроллер. залил прошивку. все работает, вспышки как были так и остались. Но данную проблему я решил. у меня светодиоды были подключены к D3 (все остальные скетчи работают без проблем на этом пине), поэтому я в скетче менял #define LED_PIN D2 на D3. потом просто перепаял провод на контроллере с D3 на D2 и все заработало.

    Еще вопрос. где можно и что поменять, что бы цифры не меняли, а были только одного цвета?
    If you want a specific color for the numbers, you can try commenting out lines 270 and 271 in Display_Functions.h and add a line like bellow
    // leds[i] = ColorFromPalette( currentPaletteTime, colorIndex + sin8(i*16), 200);
    // colorIndex += 1;
    leds[i] = CRGB(150, 0, 0);
    for a more... pastel red color... experiment."
    Hello. Good project. But as a newbie, I have two questions.
    1. Why do the triangles highlighted in red on the model hang in the air on the LED holder? After printing, they easily fall off.
    2. I did not figure out where to get the firmware for wemos. Could you please upload ready firmware for Arduino IDE download?
    At first glance, I didn't understand your initial question, but I noticed the mistake in the project and corrected it. Thank you for pointing it out (Although, as you can see, the triangles on the LED mount printed well and haven't fallen off, and my clock is functioning at this hour :) ). As for the firmware... I don't have that. You need to download the source code, compile it in the Arduino IDE, and upload it to the Wemos module. Since you're a beginner, you should familiarize yourself with this process. Generally, source codes are provided rather than pre-compiled binaries.
    Thank you. You correctly understood and corrected the first point. But in the second I can not figure out the firmware of the module. Сould you describe in more detail the process of uploading firmware to Wemos? What and where to take?
    More Comments