The other day, I created the hardware and incorporated it into the alarm clock.
This time, I will be programming and completing the clock.
Set up WiFi from your smartphone
Get the exact time from NTP
This clock uses an ESP32 microcontroller, so it can be connected to a wireless LAN.If you are connected to the network, you can retrieve the time from the NTP server and display the exact clock.
Basically, it's a program similar to the Nixie tube clock I made earlier.
By appropriating this program, we have largely created a program that always shows the exact time.
How to get them to connect to the access point
In order to connect to the wireless LAN, you need the SSID of the access point and the password. In the last Nixie tube clock, I wrote the SSID and password directly in the program, assuming that the SSID and password would not be changed for home use.
But in this case, when you give this watch to someone, you can't make them connect to an access point in their home.
You will need a system that allows you to set up your SSID and password later so that anyone can use it.
Allows you to configure WiFiManager from your smartphone
So, I found a library called WiFiManager.
This library builds a server in ESP32 and allows you to access its web screen from your smartphone and set SSID and password.
It's super easy to use.
#include "WiFiManager.h" void setup() { ... WiFiManager wm; wm.autoConnect("NixieClock", "password"); ...
Basically, that's it.
This program makes ESP32 an access point named "NixieClock".
When you connect to that access point on your phone, you will be taken to the login page.
Click on "Access Point Settings" to display the settings page.
On this page, click on the access point that you want to connect to from ESP32 and set its password, and you will be connected to that access point from now on.
The above page is in Japanese, but the original one is in English.To make it easier to understand, I rewrote the appropriate location of the "strings_en.h" file in the library to be Japanese.
Create a program
I wrote the program by mixing and matching the previous program and the WiFiManager program I mentioned earlier.
It's hard to see the source code here, so I'll put the zip file of the program here .
The state when trying to connect to an access point
After powering on, it tries to connect to the access point. This time, I made sure that the numbers were displayed randomly.
At this time, WiFiManager is also running, and if you have not already set the access point, you can set the access point from your smartphone.
If it can't connect
If I couldn't connect to the access point after 10 minutes, I gave up and started flashing 0000.
If the WiFi Manager has been running for a long time, it could be accessed by strangers, so when it goes to blinking 0000, the WiFi Manager is turned off and cannot be accessed from your smartphone.
Show the exact Time
If it can connect to the access point safely, the time is acquired from NTP and displayed.
Along with the time display, we added a pendulum-like expression using the "." built into the Nixie tube.
In the GIF animation above, the movement is jerky, but in reality, it's a smooth pendulum movement dimmed by PWM.
The NTP clock that can be set from the smartphone has been completed
The Nixie tube clock, which has the appearance of an alarm clock but doesn't ring a bell, is now complete.
This time, I used an upright type of Nixie tube called IN-14.This kind of Nixie tube is more like a vacuum tube and it's cool.
The DCDC converter for Nixie tubes that I used this time can be purchased at 👇here👇.