More on my 8 digit clock, now with GPS synchronization…

June 5, 2015 | Arduino, Teensy | By: Mark VandeWettering

Yesterday I just had a few minutes to hack around, and I decided to marry a sketch that used the TinyGPS++ library to the clock display that I had working the other day. I’ve been hopping back and forth between the Arduino and the Teensy LC as a development platform. Since I still had the display hooked up to an Arduino (actually the Sparkfun RedBoard, my favorite compatible) I decided to hook up the GPS to the RedBoard as well, to serve as the time source: the Arduino would wait until the GPS acquired a lock, and would then begin displaying the time.

Because the Arduino Uno (and RedBoard) have only a single dedicated serial port, the usual way to connect a GPS is to create a SoftwareSerial port using (say) pins 5 and 6. So, that’s what I did initially. It worked, but I found that whenever you did a Serial.read(), it caused a minor glitch in the timing of the refresh. At the beginning of each second, when the GPS squirts a substantial amount of text to be received, the entire clock display noticeably flickers since the Serial.read() messes with the timing of interrupts (presumably, by blocking them for a short but significant period of time). Bleh.

In the end, I ended up hooking the GPS pins to the hardware serial port on pins 0 and 1. The problem is of course that then the pins are unavailable for other uses, such as printing status back to your USB port, or (notably) downloading new code. I had to disconnect the GPS, flash the software, and then hook up the GPS again. The result was nice and smooth, no flicker.


A much better solution is to use a small board like the Teensy LC or Teensy 3.1. They each have three dedicated hardware serial ports in addition to the normal Serial device which can communicate back through the USB port. The Teensy 3.1 even includes hardware FIFO buffers, which will enable even more flexibility.

When I get some free time, I’ll probably include intermittent display of both latitude and longitude. Because I can, that’s why.