A GPS clock for the car that survives tunnels
Car clocks drift or reset after battery changes, and setting them is a chore. NANO-GPSClock-I2C-2XTM1637 solves it permanently: an Arduino Nano listens to a GPS module, keeps perfect time, shows it on two bright 7-segment TM1637 displays, and survives tunnels by design.
The hybrid timekeeping trick
GPS gives you time accurate to nanoseconds — but only when the module can see satellites. In a tunnel or parking garage, it sees nothing. So the sketch uses a DS3231 real-time clock (a temperature-compensated crystal accurate to a couple of minutes per year) as the primary time source, and corrects it from GPS whenever a fix is available. Boot in a garage? The RTC resumes instantly. Drive into the open? The RTC quietly re-syncs. The displays never blink 00:00.
What is on the two displays
- Module 1: hour and minute, large.
- Module 2: alternates between month/day and cabin temperature, measured by a 10K NTC thermistor — the same 3D-printer spare part, read through a voltage divider and the Steinhart–Hart approximation.
Code structure and dependencies
The .ino is organised as GPS parsing (TinyGPSPlus), display drivers
(TM1637TinyDisplay), RTC (RTClib/DS3231) and the NTC math. It vendors
StringHelpers from
ESP8266-Functions-Common.
Wiring.txt has every connection. This remains one of my most-used daily devices —
updated as recently as this year.
Repository: github.com/bobhuang1/NANO-GPSClock-I2C-2XTM1637