Main Content

Use an ESP32, an RTC, and a flexible LED Matrix panel to build this large clock that gets NTP time from the Internet.

I’ve built several clocks. I like the ones that connect to the Internet and set themselves. This one should be educational since it combines a bunch of different technologies to produce an very interesting clock.

First, we are using an ESP32 processor which comes with built-in WiFi and a lot of powerful features. With its WiFi capabilities, we get NTP or Epoch time from the Internet and use it to configure a DS3231 RTC (real time clock) module.

We are combining it with a 32x8 flexible WS2812B LED Matrix display and using the FastLED library to control the programmable LEDs. I wrote my own matrix routine - i.e. a routine that handles the conversion from the single strand of programmable LEDs (which this display actually is) to a matrix of LEDs addressed by their XY coordinates.

Technically, since the ESP32 is 3.3 volt logic and the LED matrix is 5 volts, we should be using a level shifter for the data line, but I found it unnecessary. The LED display responded fine to 3.3 volt logic signals.

Finally, to display the time on our LED matrix, we need a font suitable for our 32 x 8 LED matrix. And we need software to get the numbers up on the display. So there is a lot going on in our clock software to make this simple clock tick!

Speaking of ticking, our display is only big enough to display hours and minutes. So I am handling seconds in two ways. First, a blinking colon shows seconds. Also, the color of the display tells us approximately where we are in seconds. At the beginning of a minute, the display is green. During the first 30 seconds, it gradually changes from green to blue. During the second 30 seconds, it gradually changes from blue to red, changing back to green when the minute changes. These color changes are accomplished using 256 rainbow hues, a feature built into the FastLED library.

Power is supplied by a small 5 volt wall brick, but we also need 3.3 volts for the ESP32 and RTC. That is derived from an LM2596 adjustable buck regulator module. It needs to be adjusted and set to 3.3 volts out.”

Link to article