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 unused GPS module with serial output so I thought it would also be cool to use that for syncing the time and thus avoiding setting the clock manually. The final clock has the following features and characteristics:
16 digit 7-segment LED display
Date/Time display EPOCH format (seconds elapsed since 1970-01-01)
Date/Time display ISO-8601 format ((YYYY.MM.DD.HH.MM.SS)
Adjustable brightness (setting retained with power-cycle)
Programmable UTC offset from -12hrs to +12hrs (setting retained with power-cycle)
RTC with battery back-up to retain time with power-cycle and/or absence of GPS signal.
The main components for this project include: /catalog/product/view/sku/
- AVR Atmega328p microcontroller (I actually used the 32-pin TQFP package in the final product).
- DS3234 SPI Real-Time Clock (RTC) Module.
- 2x MAX7219 LED Display Drivers (I actually used the 24-pin SO package in the final product).
- 4x 4x7-Segment LED Displays for 16 digits total.
- U-blox NEO-7 GPS module.
- 12mm Coin Cell Battery Holder (SMD).
- CR1225 12mm 3V Coin Cell Battery.
- 2.1mm DC Barrel Power Jack/Connector.
- 5V DC 2A Fixed 2.1mm Tip Appliance Plugpack.
- Various resistors and capacitors.
- Various pin headers.
- Push-buttons.
The KiCAD files (schematics and PCB layouts) as well as all the firmware code (in C) can be found on the github repository: https://github.com/Clewsy/gps_clock
Date/time data is parsed from the RMC NMEA string output by the GPS module over the 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 github repository.
This project served as my first attempt sourcing boards from a fabricator (previously I have etched them myself). 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 and at lower cost).
The project is actually an iteration on a similar project (rev_1) created in 2014. Rev_1 used single-sided hand-etched PCBs and a much more "rustic" enclosure. Rev_2 has a number of newer features and improvements, particularly in firmware.
Design and Construction:
The circuit schematic was designed with KiCAD and prototyped with a breadboard.
The circuit boards were also designed with KiCAD and the files were sent to OSH Park for fabrication.
Once received, the boards were assembled into a funcioning clock module.
I wanted to use the clock in a nicer enclosure so I fabricated one from some spotted gum.
Once the box was made, I installed the electronics including some panel-mount buttons and DC jack.
By default it boots into a date/time display mode in format YYYY.MM.DD. HH.MM.SS.
But it can also display the UNIX Epoch time (seconds elapsed since 1970.01.01 00.00.00).
This project is actually an iteration on an old project created about four years ago. Here is a comparison of the final product: