Comparing iPhone GPS Against NEO-6M (GY-GPS6M) GPS Module with Arduino
Global positioning systems (GPS) were conceptualized after scientists realized they could track satellites using the doppler effect. In the 1960s and 1970s, the United States began work on a system of satellites that would geolocate submarines that carried nuclear weapons (NASA). By the mid 1990s, the government released a full-scale GPS system that consisted of 24 satellites to the public. The NEO-6M GPS module uses available satellites to track its location in real-time. In this tutorial, I cover the steps that I used to compare the NEO-6M module to the iPhone location service that acquires GPS data.
Parts and Wiring
There are three main components needed for this project:
Arduino Uno - $11.86 [Amazon]
HM-10 Bluetooth Module - $7.96 [Amazon]
NEO-6M GPS Module - $15.66 [DIYmall on Amazon]
The important thing to remember is that I only cover wiring and coding the transmitter. The user will need to program a smartphone or another type of receiver to record the data. I used an iPhone app that I wrote (not covered here), so the user will need to do something similar. The wiring for the HM-10 and NEO-6M is show below:
Wiring for GPS and Bluetooth
Now, in order to read the data from the NEO-6M we will need to decode the National Marine Electronics Association (NMEA) data into information that is easy to read [read more about NMEA data here]. The data received from the GPS satellites can be decoded using a simple Arduino Library called TinyGPS [link here]. The TinyGPS library parses out the latitude, longitude, number of satellites used, time of day, etc. It's a simple library that takes away a lot of the hassle of sifting through the raw GPS data (which you can also access directly via the serial communication. However, below I am assuming the user has downloaded the TinyGPS library and is using SoftwareSerial to communicate with both the GPS and Bluetooth modules.
#include <SoftwareSerial.h> #include <TinyGPS.h> TinyGPS gps; SoftwareSerial ss(9,10); SoftwareSerial ble(6,7); static void smartdelay(unsigned long ms); void setup() { ss.begin(9600); ble.begin(9600); } void loop() { float flat, flon; unsigned long age; char ble_dat[10],flat_str[4],flon_str[4]; strcpy(ble_dat,""); ss.listen(); gps.f_get_position(&flat, &flon, &age); if (flat<=90 and flat>=-90 and flon>-180 and flon<180){ dtostrf(flat,1,4,flat_str); strcat(ble_dat,flat_str); ble.write(ble_dat); delay(80); strcpy(ble_dat,""); // clear bluetooth variable dtostrf(flon,1,4,flon_str); strcat(ble_dat,flon_str); ble.write(ble_dat); delay(80); strcpy(ble_dat,"\r\n"); // send \r\n or any ending to tell your receiver the data is finished being transmitted ble.write(ble_dat); } else{ } smartdelay(1000); } static void smartdelay(unsigned long ms) { unsigned long start = millis(); do { while (ss.available()) gps.encode(ss.read()); } while (millis() - start < ms); }
Results
I conducted several walks throughout New York City to test the accuracy of both the iPhone's GPS location service and the NEO-6M's onboard satellite GPS capabilities. Below I show four different walks of varying difficulty to test the error between the two GPS methods.
Results indicate that the NEO-6M GPS module outperforms the iPhone's GPS location service in nearly every case
There are several conclusive results that I feel compelled to note:
I used both the highest accuracy and navigation modes for the iPhone's location services. Neither outperformed the NEO-6M
The routes were almost identical to the NEO-6M. As such, I didn't feel the need to map each route on top of the two GPS records.
Neither GPS device was perfect with mapping the route, but the NEO-6M was very close.
At times, both devices were showing the route atop a building - something completely unphysical.
The error on the iPhone was much greater than that of the NEO-6M.
The iPhone updated its location less than the NEO-6M, despite my selecting the highest location accuracy and asking for location updates every time a NEO-6M point was recorded.
Conclusion
This experiment ended with a unanimous victory by the NEO-6M. Now, it is true that the iPhone is not a dedicated GPS device, so it is possible that the poor quality is due to a smaller antenna, whereas the NEO-6M has a very large antenna. Nonetheless, the NEO-6M was able to provide higher resolution updates, better approximations of location, and more consistent readings. The iPhone tended to produce erratic location estimates when the route was difficult (see the zig-zag pattern above), and it did not update its location frequency enough to pick up on sharp trends in movement.
Through my observations made here, I can conclude that the iPhone is a perfectly suitable device for navigation and imprecise location events, which is why it is so ubiquitous in apps like car shares, foot navigation in cities, and geolocation with static locations. However, for situations where higher accuracy is needed for irregular navigation, fast speeds, or complex routes - I recommend a GPS-dedicated device like the NEO-6M.
See More in GIS and Arduino:
Time.