This project describes how to build led clock synchronized with NTP server or GPS signal. The clock equiped with four 2.4” led indicators allowing to see the time from a long distance. You can put the clock on the wall of your room or put to other convenient place you wish. The photo sensor on the top side of the clock allows to adjust the led brightness depending on ambient light. The clock has no button to setup. To adjust the parameters, you can connect to the clock via web interface, The clock activates own web-server for the very first 30 minutes after startup allowing to connect using web brouser and adjust necerrary parameters.
UPDATE HISTORY
2023 DEC 08, release 1.02
- Fixed bug of always summer time timezone returned
How the clock works
By default, after startup the clock checks the signal from the GPS module on its UART port. If GPS-module is present, this module will be used to get accurate time signal and no NTP routines activates. In this case it is not necessary to setup other parameters such as your home Wi-Fi Access Point parameters or NTP server URL. If the GPS module not detected at startup or disabled by configuration, the clock tries to connect to your home Wi-Fi Access Point. After the clock successfully connected, it sends the NTP request to the NTP server. As soon as the time synched, the clock keep the connection to your home Wi-Fi for 30 minutes and starts own web server alllowing you to adjust necessary parameters via web browser. You have to check the IP address assigned to the clock inside your Access Point. After 30 minutes, the clock stops web server and disconnects from your home Wi-Fi. In a while (usually once per day) the clock will reconnect to the Wi-Fi Point and tries to resync with NTP clock.
The synchronize period would change depending on time difference between local clock and NTP server during next synchronization. This period can be greater than 6 hours and lower than 48 hours. Yet, the clock tries to perform synchronization at 3:00 am local time, at night. If your home Access Point is not available at this time, the clock will sync at any other time.
If the clock failed to connect to your home Wi-Fi Access Point or when the clock parameters are not correctly setup, the clock starts its own Wi-Fi Access Point having "esp8266" SSID and no password. This allows configure the clock for the very first time. Connect your mobile device to this Access Point, then open web browser and enter IP address of the clock web server, 192.168.4.1, to the URL string.
The clock has a big timeout period to reconnect to the home access point: when the Access Point was discovered to be available for the very first time you power-up the clock, the clock would retry to reconnect to this Access Point for a day then it will give-up and assumes the Access Point is no more accessible and starts its own Access Point for reconfiguration.
When the clock is synched successfully, the little dot between hour and minute would blink slowly, when the clock failed to resync with NTP source, all 4 little dots would blink in the display. Yet and ‘S.XXX’ message would be displayed periodically indicating the seconds remaining to next reconnect attempt to the Access Point.
Let's build the clockThe clock schematics and PCB are available on easyeda site. On the picture blow you can see the schematics. The component list can be investigate in BOM list at easyEDA project site.
As you can see the max7219 IC driver is used to control the LEDs and the photo-resister is used to check the ambient brightness and adjust the LED brightness accordingly.
Start building the project from the voltage regulators ams-1117-3.3 + ams -1117-5.0 and capacitors C1, C3. C4 and C14. Then solder the power led indicator to ensure the power is ok. Then solder the DC-DC step-up IC SX1308 (U3) that makes 10 volts. As soon as all the components will be soldered successfully, apply the external power source and check all the voltages, 3.3 volts, 5.0 volts and adjusting the resistor R13 setup 10 volts on C6. Adjusting the 10 volts voltage is important to make sure the LED indicators should start working correctly at first startup. Then solder the remaining components.
Flashing the firmware
After the soldering work will be accomplished, connect the USB-to-UART adapter to the JP3 connector, and upload the LittleFS data and the firmware sketch. Before flashing the firmware, remove the J1 jumper and turn off the SW1 dip switch (all elements). When uploading the firmware files, wait the Arduino IDE finished compiling the project, press and hold the flash button, then shortly press the reset button and release the flash button. The firmware file should start dowloading.
Perhaps, you wish to update the configuration file in the data directory before flashing it into the controller. Otherwise you can use default configuration and tailor the clock later on via the WEB.
After uploading firmware, put the J1 jumper on. If optional GPS module installed, turn on the SW1.
Hardware watch dog timer
The clock has hardware watch dog timer preventing the micro-controller hang-up. The timer is build on NE555 IC, it would reset the esp8266 micro controller if no "clear" signal would not received from esp8266 vie HEARTBEAT wire for several seconds (see the schematics). The period of this timer is about 5 seconds. The J1 jumper implemented to disable watch dog timer reset during firmware flashing procedure.
Optional GPS module
The NEO6MV2 GPS module can be installed to the clock. In this case it will be used for clock synchronization, no NTP request would be sent if this module detected at startup. The dip switch SW1 used to enable signal from the GPS module to UART port of esp8266. This switch should be off during firmware flashing.
Configure the clockWhen the clock started for the first time it will fail to connect to your home Wi-Fi Access Point. In this case the clock starts its own Wi-Fi Access Point having "esp8266" SSID and no password. This allows you to configure the clock parameters. Connect your mobile device to the clock Access Point (esp8266) then open web browser and enter IP address of the clock web server, 192.168.4.1, to the URL string.
You should see the setup screen.
You have to enter the following information:
- Name of the clock (used to connect to your home Access Point)
- SSID of your home Wi-Fi Access Point and the password
- Name of the NTP server to synchronize. You can use something like pool.ntp.org.
- The altitude of your home place (used to display the atmosphere pressure at the ocean level)
- The ambient brightness minimum and maximum values scroll bars.
- DST time rule set for summer and winter period.
It is not necessary to describe the obvious fields of the setup screen, except the brightness bar and DST rule setup.
Brightness. The clock supports 16 levels of the LED display brightness. To manage the LED brightness, the clocks has the photo-resistor sensor that checks the ambient brightness. Depending the ambient brightness clock changes the led brightness by the following rules:
- If the ambient brightness value is less than the minimum value setup by first scroll bar, the clock LED brightness is minimum.
- If the ambient brightness value is greater than the maximum value setup by the second scroll bar, the clock LED brightness is maximum.
- In any other case, the LED brightness approximates by the ambient brightness.
The DST rule. If your Country does not change the clock twice a year, you have to setup the only one parameter, the value of the clock shift from the UTC for summer and winter rules. You have to put the same value for both rule lines. Other fields should keep blank. Otherwise you have to accurate setup the DST time rules. You can select a date and month when the rule applies. Or you can select day of week and week number of the month when the rule applies. Then select the local time when the clock arms should be changed and setup the time shift from UTC.
As soon as all the setup fields will be filled correctly, press “Apply” button and power-cycle the clock.
Note: If the “check GPS” checkbox is unselected, the clock will never tries to listen to the GPS module data on UART port during startup and will sync the time from external NTP server.
Comments
Please log in or sign up to comment.