GPS Mouse - GP-808G Hookup Guide

Pages
Contributors: Joel_E_B
Favorited Favorite 3

Arduino Example

Now that we have everything connected, lets get started with some code. Before we start writing code though, we do need to install a library to parse the GPS messages. If you haven't downloaded Arduino libraries before or you just need a quick refresh, check out our tutorial on installing Arduino libraries. The library we need is called TinyGPSPlus from Mikal Hart. You can download and install the library from the link below.

Now that we have the library installed, let's look at the code. In Arduino, open the example sketch by clicking File -> Examples -> TinyGPSPlus-version -> DeviceExample.

In the example, you will need to change one line of code. Change the variable GPSBaud to 9600 with the following line:

language:c
static const uint32_t GPSBaud = 9600;

The rest of the example sketch should work as is. Upload the sketch to your Arduino board. Once uploaded, open the Serial Monitor set to 115200 baud. You should see GPS serial data streaming by. If the location says INVALID, wait several minutes for the GPS unit to get a lock. If you do not see GPS data after several minutes, see the troubleshooting section below.

GPS data out

Note: While the GPS uses 9600 baud on the software serial pins, the serial UART for the serial monitor is set to 115200 baud.

Troubleshooting Tips

  • If you're testing your GPS inside, make sure you're next to a window. One of the problems with GPS is that radio waves have a difficult time passing through roofs and ceilings. So the closer the GPS is to being outside, the better. If you still aren't reading from enough satellites to get a position fix, try pointing the GPS antenna in a different direction.

  • If you see this message print to the Serial Monitor: No GPS detected: check wiring. do just that. Check your wiring and make sure that you have the correct pins connected to the GPS connector.

  • If you place the GPS mouse in a dark room, you will be able to see the onboard GPS LEDs blinking inside the enclosure. If you see a green LED, that means the GPS unit is getting power. If you see a blinking blue LED, the GPS unit has a lock. If you see the blinking blue LED and aren't getting any serial data printed to the Serial Terminal, check your wiring and check that you have the correct pins defined at the top of your code.