Skip to content

Part 4. GPS Usage

Rachel edited this page Jul 23, 2016 · 2 revisions

The Fona is already hooked up to your Pi, and we already know that the serial connection is good, so testing the GPS is very easy. The only difficulty I ran into was figuring out that my version of the Fona didn't use "GPS" commands, it used "GNS"! The Fona 808 v1 uses GPS; the Fona 808 v2 uses GNS.

Make sure that the PPPD connection is turned off:

sudo poff fona

And start screen:

sudo screen /dev/ttyAMA0 115200

Make sure it's working by typing AT and waiting for the "OK" response. Like I mentioned above, my Fona was v2, so commands used GNS. Substitute GPS if using a v1. You can find a list of GNS/GPS commands here.

Now enter AT+CGNSPWR?. This asks if the GPS is on. It should return a 0 because it's off. To turn it on, enter AT+CGNSPWR=1. You should see an "OK" response.

With the GPS on, we can try to fetch some info. GPS takes forever to find satellites (and actually forever if you're indoors), so we probably don't have a fix yet, but we can still see some info. Enter AT+CGNSINF. You should see +CGNSINF followed by a long line of comma-separated numbers. These correspond to, in order, <GNSS run status>,<Fix status>,<UTC date & Time>,<Latitude>,<Longitude>, <MSL Altitude>,<Speed Over Ground>,<Course Over Ground>,<Fix Mode>,<Reserved1>,<HDOP>,<PDOP>,<VDOP>,<Reserved2>,<GNSS Satellites in View>,<GNSS Satellites Used>,<GLONASS Satellites Used>,<Reserved3>,<C/N0 max>,<HPA>,<VPA>.

The important number to pay attention to is the second one. This indicates if you have a GPS fix (1) or not (0).

We just proved that your GPS is functional, but if you want to get a fix before moving on, take your setup outside!

<< Part 4: Reading from the GPS - Part 5: Streaming GPS Data >>