ESP8266 NTP clock β timing, power and failure modes
Where the accuracy actually comes from, what the power budget is, and what this design does when each part of it fails.
Timing chain
NTP over a domestic link gives a few milliseconds of offset. Between syncs you are running on the ESP8266βs crystal, typically Β±20 ppm β about 1.7 s of drift per day β so a resync interval of an hour keeps the error well under a second.
Power
The radio pulls roughly 70 mA average with peaks near 300 mA on transmit; the OLED adds 10β20 mA depending on lit pixels. A 500 mA supply is adequate and a 1 A one has margin. Brownouts during transmit peaks present as random reboots. (Broadly true: The general process is documented; details vary by manufacturer.)
IΒ²C bus
The SSD1306 tolerates 400 kHz fast mode. Most modules carry their own pull-ups, so stacking several devices can drop the effective pull-up resistance far enough to round off the edges. (Broadly true: The general process is documented; details vary by manufacturer.)
Failure modes
Wi-Fi lost: keep counting on the crystal and mark the display as unsynced. NTP unreachable: back off rather than hammering, and never fall back to a compiled-in time. Display bus wedged: reinitialise rather than assuming the first init held.
What this design does not do
There is no battery-backed RTC, so a power cut plus a dead network means it does not know the time β correctly. Adding a DS3231 changes that and adds a second time source to reconcile.
Where this comes from
Espressif ESP8266EX datasheet; RFC 5905 β Network Time Protocol version 4. Every stage above is marked with how confident we are in it, and an uncertain one says so rather than reading like the rest.
- Difficulty: beginner.
- Time: an evening.
- Rough cost: Β£15β25.
- Parts: 4 in the bill of materials.
- Written for: engineer β Tolerances, materials, formulae, and the failure modes.
Questions
How is esp8266 network clock made?
A Wi-Fi clock that sets itself from the internet: a microcontroller, a small display, and a power supply that is already safe. The stages above set it out at the engineer level.
Can I build this myself?
Yes β the bill of materials lists 4 parts and roughly what they cost. Anything on the refusal list is not here at any depth.