gps_clock

The final clock, epoch time display mode.

I read somewhere about UNIX Epoch Time and thought, wouldn't it be neat to have a clock that showed time in this format? This project developed from that idea.

I had a disused GPS module with serial output so I thought I could use that for syncing the time and thus avoiding setting the clock manually.

The final clock has the following features and characteristics:

  1. 16 digit 7-segment LED display (in cold white, though the photos below give it a blue tint).
  2. Date/Time display in EPOCH format (seconds elapsed since 1970-01-01T00:00:00).
  3. Date/Time display ISO-8601 format (YYYY.MM.DD.HH.MM.SS).
  4. Adjustable brightness (setting retained with power-cycle).
  5. Programmable UTC offset from -12hrs to +12hrs in 0.5 hour increments (setting retained with power-cycle).
  6. RTC with battery back-up to retain time with power-cycle or loss of GPS signal.

The date/time data is parsed from the NMEA sentence output by the GPS module via the ATmega's USART. This is converted to local time according to an adjustable UTC offset. This offset is stored in eeprom so that it is retained after a power-cycle. The offset can be adjusted in half-hour increments from -12hrs to +12hrs.

After a sync, the time is set in the DS3234 RTC module which is referenced whenever the display is refreshed. The RTC has a battery back-up so that the time is retained with no power. The RTC is only re-set after a "successful" time sync from the GPS, so if there is no signal, the current time is not changed.

The schematic and PCB CAD files were developed with KiCad. The code was written in C and developed using Atom. All these files are included in the gitlab repository.

Assembled with new display board.

This project served as my first attempt at sourcing boards from a fabricator (previously I have etched using the toner transfer method). This meant I was able to use SMD components (also a first) to reduce board size. I used OSH Park for board fab due to user-friendlieness. Next time I will try a different supplier (hopefully more local or at lower cost, preferably both).

The enclosure was made on the fly from some spotted gum. The back panel is just stained plywood.

The project is actually an iteration on a similar project (rev_1) created in 2014. Rev_1 used single-sided hand-etched PCBs and was finished with a much more "rustic" enclosure (stained pine). It also had an internal power supply which made the enclosure significantly bulkier. Rev_2 has a number of newer features and improvements, notable better firmware, hardware and woodwork (i.e. everything).

By default, the clock boots into a mode that displays date/time in human-readable ISO-8601 format. The EPOCH time display mode isn't super intuitive and was really just implemented to amuse myself.

The epoch time variable is stored as an unsigned 32-bit integer, so this clock should not suffer the year 2038 problem which is an affliction of devices that use a signed 32-bit integer. The down-side is that it cannot show time/date prior to the 1st of January 1970, but that's not a feature needed for a clock anyway.

More recently, I had some additional display board PCBs fabricated, this time with a correction. The previous iteration had a de-coupling capacitor on one of the MAX-7219 chips that wasn't grounded. I also tried out an alternative fabricator, this time going with JLCPCB and having the boards fabricated in slick black.


Gallery