GPS Disciplined RTC

I2GPS

The power packed I2GPS board (photo by Brian Krontz)

Here is a sneak preview into a product we are working on: the I2GPS.  The I2GPS is a slightly modified I2SD.  The only difference is that Anool added an interface to the hacker friendly Fastrax UP501 GPS reciever.  We think we have found a winning combination: for processing an arduino compatible ATMEGA328, a micro SD for massive amounts of storage, the ChronoDot (macetech.com) compatible DS3231 real time clock and finally the UP501 GPS module.  This board also has on board voltage regulators for both 3 and 5 volts and plenty of break out pins for hackablity.

The initial application is a GPS disciplined timing reference that acquires and maintains 1 microsecond timing accuracy.  This even works in the basement of my house!  When the GPS signal is lost, the RTC maintains 1 millisecond / hour accuracy on its own.  I know that for many DIY apps this is overkill, but we are building a race timing system that requires this level of accuracy.

But why stop there?  With GPS in hand, we can determine the timezone!  This sounds like a piece of cake, but turned out to be a pretty tricky problem.  There are literally thousands and thousands of individually defined timezones!  In fact there are 27,732 defined in the generously provided shape file by Eric Muller at http://efele.net/maps/tz/world/.

The good news is that I found a Java library that looks up time zone by GPS fix, the bad news is that they wanted $2000 for it!  With Eric’s shape file in hand, and an open source shape file library written in Python only one more piece of information was missing: the list of GMT offsets which was thankfully provided by Wikipedia.

We had an internal debate here at WyoLum.  Kevin Osborn found an elegant solution based on zip codes that worked for the United States but was not easily extendable to the rest of the world.  While driving to work last week, I realized that we could easily store the timezone for every  single latitude and longitude in a fine grid over the Earth on the SD card.  And why not?  With a measly 1GB SD card, the I2GPS has way more memory than processing power.

Within an hour I had a function (albeit non optimized) that could look up the timezone for any latitude, longitude pair.  I guess that answers the make/buy decision that the propriety code begged me to consider.  Within 5 hours I had a database of latitude, longetude, timezone, daylight time that was about 22 MB in size.  Large for a micro, but fits with ease onto a 1GB card.  I used 1 degree latitude bins and 0.1 degree longitude bins for about 648000 points.

For implementation reasons I broke the large file up into manageable chunks by latitude and put them on the micro SD card.  Finally I wrote a lookup routine for the micro controller that looks up the timezone by latitude and longitude.

Aahhh setting your awesome word clock for daylight savings time is so yesterday…

Code and hardware will be available soon.