Introduction: Yet Another Clock
As can be seen from my previous uploads I obtained some 7 Segment Display boards from some old weighing equipment.
My previous effort used an Arduino with a Real Time Clock module.
This Instructable uses a ESP8266 D1 Mini connected to an NTP server !
The code is based on an example from the ESP8266WiFi library.
I am not going to go into detail regarding the 7 Segment display wiring as there are dozens of examples on the net. The 2 boards I have, use the MAX7219 decoder driver chip, these only require 3 pins to control up to 8 x 7 Segment Displays.
I also wanted to show the date, so another 3 pins were needed !
I needed another 7 ouputs to display the Day! To get around the lack of output pins, I chose a Neo Pixel display, 1 pin, 7 outputs !
Step 1: The Hardware
Parts required
12 x 7 segment displays (in my case I was very lucky to have a couple of old weighing machine boards which saved an awful lot of wiring.
1 x ESP8266 D1 Mini OR any ESP8266 with 7 or more digital outputs
2 x MAX7129 (Again, I was fortunate to have the weighing machine display boards)
1 x Straight 8 NeoPixel display
2 x level shifters
1 x 5v power supply
Step 2: The DAY Display
For this I used part of an old credit card for the base, some thick card (in my case 300gsm photo paper) and some double sided mounting tape.
Its just 2 strips of the tape with slots cut with a craft knife.The spacing being the distance between the LEDs on the NeoPixel board.
Thin strips of the card are used to create a channel for each day.
The day names are printed on clear tape with a Dymo label maker.
Step 3: Connecting Up & the Software
The ESP8266 product range is excellent maily due to
a) They are dirt cheap
b) They need very few external components
I needed 5v for the displays and 3v for the ESP so I used a couple of level shifters with a 5v power supply.
The MAX7219 only needs 3 pins to control up to 8 displays, these are pins 1 (Din),12 (Load / CS) & 13 (Clock).
These are connected via a level shifter.
The code is as follows :
// inputs: DIN pin, CLK pin, LOAD pin. number of chips
LedControl mydisplay = LedControl(3,2, 1, 1)
LedControl datedisp = LedControl(7,6, 5, 1);
The number of chips is set at 1 because I am treateting the 2 displays as separate items rather than using the DOUT and cascading them.
The NeoPixel is connected to digital output 4
#define PIN 4
#define NUMPIXELS 7 (ignoring 1 of the 8 LEDs)
There are a few #includes all of which can be found on GitHub.
Router SSID & PASSWORD need to be entered and an NTP Server selected,(I Googled free NTP Servers).
Attachments
Step 4: On Power Up
On power up, the NeoPixel LEDs are rippled through, then, the 7 segment displays show alternate 'c' & '8' until a connection is made to the router.
If all segments show a contant c8 it means that a NTP server connection was not established, a reset should solve this.
Once a connection is established, the Time & Date are displayed, the Day is indicated by a blue LED.