GPS and Arduino UTC Clock Boxing

IMG_0870.JPG

After sitting (and running) on my desk in a breadboard for forever, the GPS and Arduino powered UTC clock is finally getting properly housed in a project box. Now just waiting on a couple connector blocks and some wire for the harness.

Advertisements

Satellite UTC Clock Powered by Arduino and Adafruit GPS

It works!  I recently blogged about getting the Ultimate GPS Breakout up and running while doing some validation of my iOS app, and I was delighted when a four digit display module I ordered arrived in the mail this past week.

After a bit of soldering and tinkering with the example code, I was able to get the UTC time reported by the GPS Breakout to display on the LED display module (including blinking the colon on alternating seconds.)

Complete details on how to wire it up are included in the source code, which is available on GitHub.

There’s Nothing Quite Like Validating Software Using Actual Spacecraft

I’ve been working on a satellite orbit prediction app for iOS and wanted to validate that the satellite positions it was reporting were, in fact, correct. I’ve compared against the calculations made by other web apps, but then I thought, “What if I could use actual signals from GPS satellites do this?” It turns out there are relatively inexpensive hardware modules designed to work with Arduino that I could use.

As one might expect, these modules can tell you the current UTC time (which I will use later for a satellite powered wall clock project) and your latitude and longitude, and many of these modules can also output the raw data about which specific satellites it is receiving from, where they are located, and even relative signal strength.

So – tl;dr – I set up a GPS receiver and antenna here at the house and successfully used that to validate the predictions my app is generating.

I looked at a few options and settled on the Ultimate GPS Breakout from Adafruit. I wanted a unit that could output NEMA GSV sentences – since they are the ones with the GPS satellites’ details, a unit that could be connected easily to an Arduino, and a unit with an external active antenna option (in case I couldn’t receive adequate signal strength indoors.)

I ordered the Adafruit module, uFL to SMA adapter cable, and active antenna. Some minor soldering is required to attach the header pins and backup battery holder to the module, but otherwise assembly just involves connecting the antenna, connecting the Arduino, and firing up the provided sketch. I didn’t even bother putting the antenna outdoors. I just left it facing up on my workbench.

arduino-and-receiver

receiver-and-antenna

On opening the Arduino serial monitor (and setting it for 115200 baud), I was pleasantly suprised to see the GPS module was already outputting satellite details like these:

$PGTOP,11,3*6F
$GPGGA,151630.000,4754.0370,N,12159.5428,W,2,08,1.04,112.6,M,-17.0,M,0000,0000*5C
$GPGLL,4754.0370,N,12159.5428,W,151630.000,A,D*4D
$GPGSA,A,3,29,25,12,21,05,02,31,13,,,,,1.62,1.04,1.25*0F
$GPGSV,3,1,11,29,83,335,44,05,51,077,37,25,40,196,30,48,33,194,29*7E
$GPGSV,3,2,11,21,32,252,28,02,22,068,23,12,11,169,25,31,10,271,29*7E
$GPGSV,3,3,11,13,07,100,29,10,06,037,,26,03,117,*45
$GPRMC,151630.000,A,4754.0370,N,12159.5428,W,0.05,329.93,241214,,,D*7D
$GPVTG,329.93,T,,M,0.05,N,0.09,K,D*36

The interesting lines here are the ones that start with $GPGSV – they are the GNSS Satellites in View details, and with 11 satellites in view, it takes three lines to dump all the details.

I opened my Look Alpha App in the iOS simulator and set set to work comparing the satellites it reported “nearby” to the lines from the receiver.

prn21

The first satellite in the first line has PRN 21 at Elevation 82 deg and Azimuth 342. On my iOS simulator I tapped on the satellite nearest Seattle. It showed GPS BIIR-9 (PRN 21). Huzzah! The PRN matches! On the App the satellite appeared NNW of Snohomish, which is pretty close to 342 degrees Azimuth. Huzzah! (Once I add pertubations and geoid shape irregularities to the library, I expect to be able to get exact agreement there.) And with the pin so close to Snohomish, the high elevation angle and strong signal make sense.

The next satellite (PRN 18) made sense too!

And the next one (PRN 15) too!

But the next one (PRN 51) didn’t make sense. I thought PRNs were supposed to be in the range of 1 to 32, but here was a 51. A little quick Googling revealed that PRN 51 is a special PRN assigned to a WAAS satellite, Anik F1R. Woot! I’ll need to add that satellite’s TLE to the app.

Checking through the other satellites we were locked onto I was excited to see I was receiving signals from satellites located just West of Hawaii, over the middle of the Atlantic, another near the Philippines and another Northeast of Venezuela. All from a GPS receiver I put together in less than half an hour.

Here’s what the simulator and receiver data look like side by side:

Next steps? Software: Improve the accuracy of the library by taking pertubations and geoid irregularities into account. Hardware: Build an Arduino powered GPS synced UTC clock with big red seven segment displays, and with a USB interface to send the raw satellite data to the Mac.