Out of the numerous features the Linkit ONE board has, GPS is one of them! When I first started trying to use GPS on the Linkit, it took me WEEKS to get it working because:
- I was unfamiliar with the working of GPS
- The code example didn't have many comments explaining how it worked
- The code used funny functions I'd never seen before
- Not many concise tutorials on the net.
Fortunately, after a lot of perseverance, I finally came up with a very simple GPS, eqipped with an Li-ion battery and an LCD screen. I thought I'd make it into an Instructable, so that beginners with the Linkit ONE board wouldn't have to face all the troubles I did!
Step 1: Project Details:
Prerequisites: You should have set up your Linkit Board and installed all necessary software (see my guide)...
Time required: 2-3 hours
- LinkIt ONE board
- RGB LCD (or any alphanumeric LCD you like, recommended if you use an I2C or Serial LCD for simplicity)
- Battery and GPS antenna (included in Linkit box)
Step 2: How GPS Works...
Now before proceeding, it'll probably be helpful to know a little bit about how the Global Positioning System actually works. Here is a short video giving the very basic idea behind its working...
LinkIt ONE GPS:
The GPS on the Linkit is taken care of by a dedicated chip (named MT3332). A GPS Antenna has to be used so that the chip can receive signals from satellites, thousands of miles away. The Linkit SDK offers an excellent working Arduino sketch for using this GPS feature; all the dirty (code) work is handled by the LGPS library. A jist of how to use the received GPS data is shown in a later step...
Step 3: Set Up the Hardware (Alphanumeric LCD)...
Follow the pics above
Step 4: Understand the Code...
I recommend going through this so that you can troubleshoot with greater ease (yes if this is your first GPS project, then problems are unavoidable).
Basically the GPS chip on the Linkit gives out a String message, an example of which is shown below:
Now, there's a lot of different data in this string which is separated by commas. Let's analyse each piece of data:
- GGA - Global Positioning System Fix Data
- 123519 - GPS fix taken at 12:35:19 UTC *
- 4807.038,N - Latitude 48 deg 07.038' N *
- 01131.000,E - Longitude 11 deg 31.000' E *
- 1 - Fix quality (0 means invalid, 1 means SPS GPS fix, other numbers refer to other advanced stuff we don't need to care about)
- 08 - Number of satellites being tracked *
- 0.9 - Horizontal dilution of position *
- 545.4,M -Altitude, Meters, above mean sea level *
- 46.9,M -Height of geoid (mean sea level) above WGS84 ellipsoid
- (empty field) - time in seconds since last DGPS update
- (empty field) - DGPS station ID number - (we would never use this so don't care)
- *47 - the checksum data, always begins with an asterisk
In most of our projects using the GPS, we would only have to care about some some pieces of data (all of which are marked with an asterisk):
- UTC time: Appears in the hhmmss format. (UTC time is anoter name for GMT)
- Latitude and Longitude: Note that these appear in the format ddmm.mmm (d = degrees, m = minutes, in decimals)
- No of satellites: The more, the better.
- Horizontal Dilution: Basically refers to the accuracy of your GPS location.
- <1 - Very accurate fix
- >1 and <2 - Good enough fix
- >5 - Can be improved
- Altitude: Self explanatory?
*How does my code work?
After obtaining the GPS data string, the code parses out the comma-separated data pieces and to obtain all necessary information like latitude, longitude, UTC time etc.
Step 5: Upload Code...
Below is the code, for using the Grove RGB LCD screen. Before compiling, download the library from here.
For help on how to upload sketches to your Linkit Board, check out this tutorial.
Step 6: Go Outside and Play!
This GPS will not work indoors because the satellite signal is too weak, even when using the antenna. So go outside where you have a clear few of the sky. Even a balcony will do. The first time, the GPS will take a loooong time to get a satellite fix (15 minutes to 1 hour), so don't lose hope! Just be sure that the antenna faces enough open sky.
After a while you'll see that the Linkit has got your coordinates. Wait for them to stabilise , and then input those coordinates into google maps to verify your location (as shown in the last picture above).
Note: Because the space on the LCD screen is very limited, and there's so much important information to display, the Linkit will change the display every few seconds. In that way you can view -
- Latitude and longitude
- No of satellites and horizontal dilution.
- Altitude and UTC time
See the pictures above for an idea of how that works...