Clocks with no Knobs
This digital clock has no setting or control knobs because the date and time are automatically set using the accurate internet time. Email parts@robotsforfun.com to get the parts for this project.
Before you attempt to do this, you need to first know how to work with the ESP8266 WiFi module.
| Parts needed:
- ESP8266-12
- Jumbo 7-segment common cathode LED displays 5x
- MAX7219 controller
- UDN2981A
- 9V to 3.3V converter
- 9V power supply
- Wires
- Soldering iron
|
|
|
1
| Connect the MAX7219 to the 7-segment displays as follows:
- DIG0 to DIG4 to each of the display's common cathode
- SEGA to SEGG and SEGDP to the eight inputs of the UDN2981A
- The eight outputs of the UDN2981A to the display's segments
|
2
| Here's the code. It's real long!
/*
* 5 digit x 7 segment LED with NO colon display clock using the MAX7129
* Digits: Common cathode
* D0 is the leftmost digit
*
* Connections:
* MAX7219 ESP8266
* DIN pin 1 to pin D14
* CLK pin 12 to pin D12
* CS pin 13 to pin D13
*
* After uploading this program to the ESP8266-12 module,
* open the serial monitor and restart the ESP8266 module to
* see what IP address is assigned to this webserver,
* then browse to this IP address.
*
* or
*
* Connect your WiFi to the default ssid
* "WiFi setup ESP8266-xxxx"
* or to the one you provided, then browse to the IP address
* 1.2.3.4
* for the main page or
* 1.2.3.4/setup
* for the WiFi setup page
*
* If the WiFi is not connected then you will have to go to
* 1.2.3.4/setup to setup the ssid and password
*
* Copyright 2020 Enoch Hwang
*/
//////////////////////////////////////////////////////////////
//// VCC voltage stuff
ADC_MODE(ADC_VCC);
//////////////////////////////////////////////////////////////
//// status LED stuff
#define statusLed 2 // for ESP8266-12
//////////////////////////////////////////////////////////////
//// NTP clock stuff
#include "DateTime_RobotsForFun.h"
//////////////////////////////////////////////////////////////
//// WiFi stuff
#include "WiFi_RobotsForFun.h"
// Do delay without using the delay() function
void nonblockingDelay(int wait) {
unsigned long timesUp;
timesUp = millis() + wait;
while (millis() < timesUp) {
// flashActivityLed();
server.handleClient();
yield(); // must have this to give time to handle wifi background stuff
}
}
//////////////////////////////////////////////////////////////
//// HTML webpage
void indexHTML() {
String msg = "";
msg += "";
msg += "";
msg += ""; // keep fonts consistent between devices
msg += ""; // auto refresh page every 1 second
msg += "LED Clock";
msg += " ";
msg += "";
msg += "";
msg += "Jumbo LED Network Clock ";
msg += "Real time clock for the 5x7 segment LED display using the MAX7219 controller";
msg += " " + formattedTime() + "";
msg += "";
msg += " ";
if (!isTimeValid()) {
msg += "";
msg += " ";
}
// wifi setup and info links
msg += "IP address: ";
if (wifiIsConnected) {
msg += "" + WiFi.localIP().toString() + "";
msg += " Wifi setup and info: ";
msg += "" + WiFi.localIP().toString() + "/setup";
} else {
msg += "1.2.3.4";
msg += " Wifi setup and info: ";
msg += "1.2.3.4/setup";
}
msg += "";
msg += "
|