Main Content

NTP synchronized dot matrix clock showing temperatures and humidity.. Optionally the time source can be GPS.

That is what some readers may think, what? Another dot matrix clock?

In order to combine inside/outside thermometers with a nice and precise clock I began designing the first version of this clock in 2014. Those days it was controlled by an Arduino Mini and received the time from a DCF receiver. DCF77 is the local time transmitter here in Germany, but using this technology limited the use of this device to Central Europe.
Once I discovered the fantastic options that the ESP32 provides I decided to change the design to a WLAN connected NTP clock. It supplies a web interface where the local time zone as well as the NTP server to be used can be configured. Like that this clock can be used anywhere in the world where a WLAN is available and even if there is no WLAN you can hook up a GPS receiver module and synchronize from the sky.

Features of my project
Two temperature sensors DS18B20 or DS18S20 connected via cables to measure inside and outside temperatures
One humidity sensor DHT22 to measure the inside humidity
An LED dot matrix display of 56x32 dots which makes it a total of 1792 LEDs (28 Max7219 modules)
Configurable language for date string in German, English or French
Configurable temperature display in °F or °C.
Built-in WLAN access point for initial configuration of all settings (especially WLAN)
Optional GPS input in case of no available WLANSupply by an external adapter 12V, 1, 5A

The circuit
The 12V power supply is connected to the system via DC jack J1. It supplies the switching DC/DC converter via fuse F1 (1A).
The usage of a switching regulator (buck converter, NOT a linear regulator) is required to avoid excessive heating of the device, the regulator must at least be able to supply 2, 5A at 5V. Measure the correct voltage FIRST before you hook up the display and the ESP, make sure you have 5V!
This is sufficient to run the 28 Max7219, the NodeMCU ESP32 and the driver IC 7408.
The NodeMCU has a built-in voltage regulator that supplies 3, 3V on pin1 of the MCU, this is used to run the DHT22 humidity sensor and the two one-wire sensors for the inside and outside temperature. These two derive their power directly from the data line (“parasite power”) and a 10m cable for the outside sensor is no problem. The parasite power comes via resistors R1 and R2.
The photo transistor SFH300 measures the environment brightness and feeds this back to IO36 of the MCU via a low pass R3/C1. This one is optional and a different type of photo transistor will also do the job, use the potentiometer to adjust the brightness as desired.
The 7408 in this circuit is used as a level shifter and driver for the signals to the Max7219 chain. It usually works without such a driver, but only up to a certain length of the chain. For the 28 modules I use it would not work without it during my tests.
IO16 is prepared to receive GPS data from an external GPS module in case no WLAN is available or supposed to be used. This one is optional.

The display
There are 28 LED matrix modules (8x8) that are controlled by 28 Max7219 driver ICs. They are daisy-chained and the setup is four rows with 7 blocks each.
Initially I bought modules with 4 blocks and connected those (one block was cut off in every row). But I was not happy with the result because of the spaces between the blocks.
So I designed my own PCBs that hold 7 blocks side by side with no spaces and the option to combine 4 of these so that my display is now without spaces.
But it can be done with the standard modules that are available anywhere, maybe you find a supplier where the LED blocks sit shoulder to shoulder. And you will cut off one block in every row, so you have four spare LED blocks in case one fails later.
The wiring is standard with the first module receiving the data being in the bottom right position, data flows always from bottom to top, right to left.

The software
For the software design I used the freely available Platform IO under Visual Studio Code. The framework is Arduino, but the VS Code IDE is much more user friendly than the Arduino IDE. There are multiple tutorials how to install VS Code with Platform IO and ESP32 IDE on the internet.
When the system starts up it tries to connect to the preconfigured WLAN displaying its own IP address for a couple of seconds until it succeeds reaching the NTP server. On first startup there is nothing of course, so WLAN access will fail. In this case it switches to access point (AP) mode and acts as a WLAN AP on that you can connect to with a smart phone or a laptop. The AP is called “MatrixClock”, the password is 123456789.
To open the configuration site navigate with a web browser to the IP address that the display showed. It allows to configure what is required including the WLAN settings where the clock will connect to. Save the settings and click on “Restart”.
The time is displayed in big numbers, temperatures, humidity and date in smaller text. The date scrolls continuously from right to left showing the day, month, year and day of the week.
The temperatures internal and external together with the internal humidity switch from one to the other while the transition includes random animations.
The positions where time, date and temperatures are displayed change randomly every 10 minutes .

The hardware
As I mentioned before I had special PCBs made that accommodate 7 driver ICs with 7 matrix LED blocks. The resistors at the Max7219 drivers defining the brightness were chosen as 39K, pretty high, my blue modules were too bright otherwise, even at lowest brightness. If you use OTS modules you may want to change the default resistors (there is only one per LED block, easy to locate). The photo transistor is “looking” into the direction of the viewer, with more ambient light brightness will increase.
The 8x8 LED modules are available in different colours, I found red, green and blue ones, I am not sure if there are other colours. Important: There are two different pin-outs available for the LED blocks. The basic difference is the location of the row and column pins and which ones are cathodes and anodes. Be sure to use the right ones according to the supplied schematics if you are going with my PCBs and not with OTS modules.
This is a bad trap, follow the instructions to avoid failure and tears!
The whole circuit disappears behind a large Plexiglass in the colour of the LEDs, it is mounted in a hand made plywood box, just a rectangle back plane with four side walls. The NodeMCU and the 7408 were soldered on a piece of breadboard together with the 5V voltage regulator and the fuse. The temperature sensors are connected via 3, 5mm jacks and cables, I left the DHT22 away in this clock (but I tested its functionality).”

Link to article