Getting location data

Detailed GPS Test


Now that we know it basically works, we'll try to get 'fix data' from the GPS. For this, you will have to have the GPS outside. It cannot be inside a building, even if its right at the window. The silver antenna must be pointing up with a clear view of the sky!

Wire up the GPS module according to the hookup

Check your board and serial port settings and upload this sketch to your Flora using the Upload button in the IDE.

Place the GPS module (still connected to the Flora)  outside. Once the GPS has located the satellite data, the red LED on the GPS will stop blinking.

If you see the LED blinking once a second, it does not yet have a fix!

It can take many minutes to get a fix if it doesn't see any satellites immediately.

Once it has a fix, you can check the serial monitor for the GPS data, which includes the current date and time in UTC. It will also give you your latitude, longitude and approximate altitude with the Serial monitor

GPS modules will always send data EVEN IF THEY DO NOT HAVE A FIX! In order to get 'valid' (not-blank) data you must have the GPS module directly outside, with the square ceramic antenna pointing up with a clear sky view. In ideal conditions, the module can get a fix in under 45 seconds. however depending on your location, satellite configuration, solar flares, tall buildings nearby, RF noise, etc it may take up to half an hour (or more) to get a fix! This does not mean your GPS module is broken, the GPS module will always work as fast as it can to get a fix.
Now we know where we are. According to the GPS, my location is 4043.5715 N (Latitude 40 degrees, 43.5815 minutes North) & 07400.2783 W. (Longitude 74 degrees, 0.2783 minutes West) To look at this location in Google maps, type +40° 43.5715', -74° 00.2783' into the google maps search box . Unfortunately gmaps requires you to use +/- instead of NSWE notation. N and E are positive, S and W are negative.
People often get confused because the GPS is working but is "5 miles off" - this is because they are not parsing the lat/long data correctly. Despite appearances, the geolocation data is NOT in decimal degrees. It is in degrees and minutes in the following format: Latitude: DDMM.MMMM (The first two characters are the degrees.) Longitude: DDDMM.MMMM (The first three characters are the degrees.)
This guide was first published on Nov 08, 2012. It was last updated on Nov 08, 2012. This page (Getting location data) was last updated on Jul 20, 2019.