In my continuing quest to pay Verizon less money, I got rid of my cable box in my bedroom, which, while saving me money, removed the digital clock display from the room. Wanting to create a project that used the ESP8266, I created a WiFi based clock which set its time through NTP, and updated daylight savings time automatically. You plug the clock in, it sets and maintains the time without any user input, just like the clock on the cable box. The firmware communicates with a Raspberry Pi running Node Red through MQTT. It features the ability to do OTA updates, and can become a WiFi access point that hosts a web page to configure the WiFi network information.
The hardware is fairly straightforward. The display is made up of some eBay specials 1.5" blue 7 segment LEDs where each segment contains 2 blue LEDs. To get across 2 blue LED voltage drops, the clock is supplied with a 7.5V wall wart, and and off the shelf adjustable switching buck module drops the voltage to 3.3v for the logic chips. The LEDs are driven by some NPIC6C596 open drain shift registers controlled by some GPIOs on the ESP-12 version of the ESP8266. A couple of discrete blue LEDs make up the colon and another, the PM indicator, and a TEPT-4400 phototransistor is used to detect the ambient light and dim the display accordingly. A couple of buttons provide reset and OTA flash and a DS18B20 temperature sensor gives the ESP8266 something to do when it is not updating the display. The full schematic is here. The PCB is home made using photosensitive boards as described here.
The software is based on the Sming framework , which provides the ability to do Over The Air firmware updates through the RBoot bootloader, the MQTT connectivity, the Network Configuration web pages, and basic Arduino-like access to various resources of the microcontroller. I setup my development environment using Eclipse. The time display is bit-banged through the shift registers before they are latched in. The display is dimmed with a PWM signal on the enable pin of the shift registers controlled by the value of the ADC reading the phototransistor. Time zone information is broadcast through the MQTT topic by some javascript running on Node Red (because I could not find a good, simple way to get TZ info through an IP Location web service). The TZ message is an MQTT retained message so that the correct TZ is available on the MQTT topic whenever the clock boots up. MQTT also provides a control channel where clock can be put into config mode, start an OTA flash, or the clock can be restarted through an MQTT message. The values from the DS18B20 are published on an MQTT topic every 30 seconds, where Node-Red picks up those messages and publishes to tinamous.com for graphing. Full source code for the firmware is located here.
The project is encased in a 3D printed enclosure made from PETG with the display protected by a transparent blue acrylic cover. The OpenSCAD files for the case are here.