This is what got me into Arduino's. I came accross Nick's LED Word Clock, and thought I want to make that.
Since downloading his code, I've modified it to include extra sensors and buttons as well as adding an ESP01.
The BH1750 is used to auto dim the display, depending on light conditions, and it can turn the display off at night. The BME280 shows the temperature, humidity and pressure. The ESP01 is used to get the time from pool.ntp.org.
The extra buttons are there to make it easy to adjust settings. You can adjust light sensor settings using the buttons, as well as change fonts and NTP/DST/UTC settings.
Six new fonts have been added, I made the fonts using: http://dotmatrixtool.com/.
I've made quite a bit of change to the word clock, it has more words now and have moved quite a bit to PROGMEM to save RAM.
Nick's project page: https://123led.wordpress.com/mini-led-clock/
My code: https://github.com/Ratti3/miniclock
The code is now complete, apart from uknown bugs and a tweak here and there, I will make a case for it.
You will need to adjust the light sensor code to match your light conditions, I coded this during bright sunlight sitting next to a window.
An ESP01 is used to get time via NTP, the ESP01 is coded to sleep (wifi off) when not needed, and is woken up via serial to get the time in UNIX format. The SSID name and password is passed via the Arduino code for convinience.
This version also has DST/UTC and BST calculations. These settings can be adjusted or disabled via the menu.
Settings are saved to EEPROM, this means if you power off and back on your changes made via the menu are saved.
These are the code files on Github:
Code on Github [https://github.com/Ratti3/miniclock]: Arduino LEDClock32x8.ino ProgmemData.h Arduino ESP-01_NTP.ino LEDClock32x8_ESP01-NTP.ino ProgmemData.h
When the ESP01 is running the Arduino Serial will show this:
Arduino : Sent NTP request to ESP01 ESP01 : NTP request received from Arduino [attempt 1 of 3] Connecting to SSID: TheInternets....connected SSID: TheInternets, IP Address: 192.168.0.135 Signal Strength (RSSI): -42 dBm Sending NTP packet to: 22.214.171.124 [attempt 1] Sending NTP packet to: 126.96.36.199 [attempt 2] UNIX1562848457 Disabling WiFi....ok
More pictures and instructions to come...
Putting it all together:
DS3231, BH1750 and BME280: SCL PINS = A5 SDA PINS = A4 VCC = 3.3v LED Matrix: CLK = D11 CS = D10 DIN = D12 VCC = 5v Switches: D2 - Menu D3 - Date / + D4 - Temp / - D5 - Display options ESP01 - Optional D7 - TX pin of ESP01 D6 - RX pin of ESP01
These are the global variables you can change:
// Global variables (changeable defaults), numbers in  brackets are the EEPROM storage location for that value // Clock settings //  Default intensity/brightness (0-15), can be set via menu byte intensity = 2; //  Default clock mode. Default = 0 (basic_mode) byte clock_mode = 0; //  Define random mode - changes the display type every few hours. Default = 0 (off) bool random_mode = 0; //  Define font random mode - changes the font every few hours. 1 = random font on bool random_font_mode = 0; //  Define 12 or 24 hour time. 0 = 24 hour. 1 = 12 hour bool ampm = 0; // Light settings //  Default display on/off mode, used by light sensor. 0 = normal, 1 = always on, 2 - always off, 3 - 5 = defined by hour_off_1,2,3 byte display_mode = 5; //  Default auto light intensity setting bool auto_intensity = 1; // These three define the hour light sensor can turn off display if dark enough, format is 24 hours, the routine for // this checks between 8.00 and one of these values byte hour_off_1 = 21; byte hour_off_2 = 22; byte hour_off_3 = 23; // Font settings - these are set via the setup Font menu, see set_font_case() routine for all default values: //  Default clock large font style byte font_style = 2; //  Default clock large font offset adjustment byte font_offset = 1; //  Default clock large font columns adjustment byte font_cols = 6; // DST NTP and UTC settings //  Enable DST function, 1 = enable, 0 = disable bool dst_mode = 1; //  Enable NTP function, 1 = enable, 0 = disable bool ntp_mode = 1; // Number of seconds to adjust NTP value before applying to DS3231, takes a few hundred milliseconds to process the ESP01 data byte ntp_adjust = 1; //  UTC offset adjustment, hours int8_t utc_offset = 0; // The hour daily NTP/DST sync happens, should be left at 2am if using DST mode byte ntp_dst_hour = 2; // Number of time to retry NTP request 1 = 35 seconds(ish) in total, values 1 - 9 byte ntp_max_retry = 3; // Used to calculate when to quit ntp() when it's not receiving data, value in seconds, it is multiplied by ntp_max_retry byte ntp_timeout = 45; // Global constants - SSID and password for WiFi, passed to ESP01 via SoftwareSerial // The combined SSID and password length cannot exceed 72 characters // The length of your SSID name, e.g SSID = MyWifi, ssid_len = 6 const byte ssid_len = 8; // Your SSID name, e.g MyWifi const char ssid = "YourSSID"; // The length of your SSID password, e.g password = password, pass_len = 8 const byte pass_len = 12; // Your SSID password, e.g password const char pass = "YourPassword";