Maintenance notice: These forum archives are read-only, and will be removed shortly. Please visit our forums at their new location, https://www.evilmadscientist.com/forums/.

Alpha Clock 5 - GPS support

wbpwbp
edited January 2013 in Clock Kits
My newly built Alpha Clock 5 sets itself!  I added an Adafruit "Ultimate GPS" module, connected to the second serial port (J5) and a convenient 5V line.

The GPS module runs at 9600 bps. Normally with an Arduino I have to use an interrupt routine to capture the serial data reliably, but the processor in this clock is so fast it has no trouble keeping up with a simpler approach of just checking the port each time through the main loop.

I need to polish the code a bit, including adding setting the time zone to the menu.  Once I've got everything done I'll post the mod on Github.

Next on my list: Automatic DST support!

William

Comments

  • Nice!  We have some of those GPS modules, and have considered adding this as a "standard" feature--  the one thing that we're really not sure about is how reliable it will be for people to get a good GPS fix indoors.  We'll look forward to seeing it on Github. :)
  • The "Ultimate GPS" module is incredibly sensitive. In my 1 story wood frame house, there is no location where it will not pick enough signal to set the clock.  I would guess that in an apartment building it would have to be near a window though.  Another approach is to put the GPS receiver in a separate box, and use a pair of radios to link the two.  I've done this with Zigbee's and it's pretty easy.

    I've thought about using a WiFly and syncing with a time server over the 'net, but the GPS receiver is a lot less effort, all you have to do is parse the GPRMC message and you've got accurate time and date.

    I'd like to add an indication that the time has been set from the GPS.  One thought I had was to blink the colon differently depending on if a GPS update had been received within some period of time.  Maybe alternate the dots if no signal, or only blink if the clock has been synced within the past n minutes.  Any thoughts?

    William
  • I like both of the ideas-- about alternating the dots, or not flashing them.  

    Another (more severe) idea would be to go into what we call "VCR mode," where the whole clock flashes as though it has lost power and does not know what time it is. 

    Another (less severe) idea would be to use the "nightlight" as an indicator.  If it's in the slow-fading sleep mode, it's had sync within the last 6 hours, if on steady, within the last 24 hours, and if blinking, not in the last 24 hours.

    The lower-right dot is a little underused; it indicates AM/PM in the mode with the second spinner, and could be repurposed as well.
  • I decided to use the upper right dot, at least as a temporary indicator.  Easier than figuring out how to start/stop the blinking colon, but I do like that idea the best as it give and immediate and continuous indication that the clock's time is accurate.

    The upper right dot is turned on when the clock's time & date are updated, then turned off again the next time a valid GPRMC message is received; usually this is about 1 second later.  The code is designed such that it tries to do the GPS update at the beginning of each minute if it can.  If the GPS is working properly, you should see a the LED come on at the top of each minute, then go off again 1 second later.

    William
  • edited February 2013

    In our project "Doomsday Atomic Alpha Clock Five Project" we also used the Ultimate GPS, along with Wifi and a WWVB Atomic Clock.

    Link: http://forum.pjrc.com/threads/17369-Doomsday-Atomic-quot-Alpha-Clock-Five-quot-Project-using-the-Teensy-3

    The Ultimate GPS proved to be very sensitive but we also added Adafruit's active remote GPS antenna.

    For auto DST, we used an internet projected 10 year table for DST time changes. This way, with no GPS signal, the
    clock knows when to change on the projected DST date. We had this luxury because we used a pre-processor
    Teensy 3 ARM stamp.

  • "evilandy" - That's quite a project, a lot more than I think I'd ever need!

    I'm not sure I get your point about auto DST though - it sounds like you are saying there is some relationship between having the GPS signal and adjusting the time for DST.  The two are independent.  The clock keeps time reasonably well without the GPS, but you have to set it and once in a while adjust it.  Adding the GPS module means the clock sets itself - all you have to do is set your time zone.  Are you trying to compute DST time changes based on the GPS coordinates?

    I thought about getting the time from the 'net using a wifi adapter, but the Ultimate GPS works so well, and it doesn't have to be configured with SSID, password, etc.

    William
  • edited February 2013

    Quote "it sounds like you are saying there is some relationship between having the GPS signal and adjusting the time for DST."

    I tried to state, indirectly, that by not having a GPS signal or fix is not necessary for DST.

    Question "Are you trying to compute DST time changes based on the GPS coordinates?"

    No, we are using a RTC present date to compute for the "projected" DST dates using a DST table.
    When the date arrives (spring forward or fall back) we adjust the RTC +- 1 hour.

    Quote "I thought about getting the time from the 'net using a wifi adapter, but the Ultimate GPS works so well, and it doesn't have to be configured with SSID, password, etc."

    The Electric IMP uses a "LCD screen blink-up" from an Android or IOS device. The Wifi settings are set in this ARM SD cardin about one minute. No programming is necessary.

    Using the Atomic clock, GPS or Wifi, we found the Wifi the easiest to implement, reliable and somewhat precise. Above all, the Wifi provided the best cost solution.


     

     

     

     

     

     

  • I have seen other logic where the date/time was checked as you say, "when the date arrives ... we adjust the RTC...".  That works great if the clock is running during this event, but not so great when someone builds a clock and powers it up (or powers it back up after some time) and the transition to DST has already occurred.  The original DST code for Adafruit's Ice Tube clock worked this way.  This is why I decided to rewrite the DST logic so it can be called at any time, and then check for DST transitions once a minute.  It could also be done when the clock is booted, but doing it this way has the advantage that one can play around with the date and time settings and see the clock adjust itself...

    The GPS has the advantage that it works without any configuration at all, and pretty much anywhere (assuming it can get signal).  As for cost, the Ultimate GPS is less money than the IMP and it's adapter, so I don't see that as an advantage either...

    I'm glad you are happy with the IMP, it does look like an interesting device, but for my money (and time) it's not the right choice for this application.
  • The only major downside to the IMP is when their server "cloud" goes down you lose your GMT time.

    As for the Ultimate GPS, we had "chicken wire plaster" in our homes and the the reception of the GPS signal was stopped dead in its tracks.  So we had to purchase the active GPS antenna Adafruit provided for the GPS.
    Having multiple precision clock sources does help alot.


      
  • Quote  "As for cost, the Ultimate GPS is less money than the IMP"

    Ultimate GPS = 40
    Antenna        = 13
    Antenna adapter = 4
    ==================
                   $57 USD

    Most GPS time applications will require, in most cases, the sensitive active, external, remote
    antenna and antenna adapter for inside use. Buyer beware. 


    Electric IMP = 30
    IMP breakout = 13
    Level shifter = 4
    ======================
                   $47 USD

    Note: The Electric IMP "cloud" server could disappear at any time.

    One requested feature for the Electric IMP was for their servers to
    generate automatic DST local time. x = time(PST or PDT) for west coast users.
    So all you would need to do is add or remove the WIFI SD card to the
    Alpha Clock Five with absolutely no firmware changes.


  • FWIW, we've had pretty good luck with just the ultimate GPS breakout, without any external antenna.
Sign In or Register to comment.