Introduction: MediaTek LinkIt One - Build a PipBoy Part 2: GPS and Objective Points
In Part 2 of the series, we will work on getting the GPS up and running, as well as creating an array of way-points, being able to select them, and then getting the details for heading to that point (Just how map markers work in the fallout universe).
For this we'll have to do the following:
- Ensure that the GPS is at least marginally accurate (we will compare the results of our location findings to that of Google Maps)
- Have a way of displaying data
- Be able to edit a set of way points, even if only at a software level
- Be able to interface with the data outside of the development environment
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: What Do We Need?
For this part of the project, we'll need the following:
• MediaTek LinkIt One Board and GPS antenna
• A Laptop, preloaded with the required software
It would be nice to have got the LCD screen working to output the data to, but unfortunately I didn't have access to one at the time of writing this. I imaged this part of the project with an LCD screen and rotary encoder, but alas, it was not meant to be.
Step 2: Ensuring the GPS Works
- For this step, we're just going to use the example included in the LinkIt One Library.
Start up the Arduino IDE (having installed the LinkIt One libraries as detailed in my previous 'ible).
Navigate to File -> Examples -> LGPS -> GPS
Connect your board, and upload the sketch.
If everything works, cool bananas! We're good to go to the next step. If you're like me though, you find yourself with this error:
C:\Users\\AppData\Local\Arduino15\packages\LinkIt\hardware\arm\1.1.17\cores\arduino/LTask.h:18:19: fatal error: vmsys.h: No such file or directory.
So this was just one error, followed by a n more. Turns out there are a bunch of these, but thankfully it's a quick fix. I started by replacing them individually, but soon gave up. The easiest thing to do is just to use the LinkIt One Studio (which has everything sorted out), available here: https://github.com/Seeed-Studio/LinkIt-ONE-IDE
Using that IDE instead should get it working A-Okay.
Now for the fun stuff!
Step 3: Code Code Code Code
We've seen that Seeed Studio provided us with a GPS test code. We'll use this to create a new library.
We also need http://www.movable-type.co.uk/scripts/latlong.htm...
This revision is not for the final product, it is simply to work with and estimate calculations.
It will find your current location, and print out the distance and angle to the White House (a man can dream, right?).
I've added two functions for calculating distance: Spherical law of cosines, as well as the haversine formula. The Haversine is considered more accurate, but it is more intensive.
The results I got did not seem to match the results of the calculations you can do via the link provided above, but I feel that is due to (possibly) precision of the processor in use. Larger distances seem to have larger errors.
If anyone feels they are able to improve the code, please do so. I have uploaded it here:
Step 4: Where to Next?
There are definitely improvements that can be made to this system. Besides resolving accuracy issues, it would be nice to have an array of destinations/waypoints, which the user can select from.
It would also be nice to have a rotary encoder and have the data outputted to a 16*2 LCD screen.
Keep a look out for the next one in the series, where I'll most likely try to delve into those issues.
Or who knows, it might be something entirely different :D