SparkFun has quite a few
GPS modules, but I prefer the EM406
, because it uses the standard 5v power we're using on the dev board (as opposed to the EM408, which needs 3.3v) and has a handy red LED to show sat acquisition status (the 408 doesn't).
There are two difference between using the Parallax GPS module and a third-party one like the EM406. The first is that you've got to wire up a connector so the EM406's cable can plug into our Basic Stamp breadboard. The second is that while the Parallax GPS module has a "smart mode", where you can query the GPS module for a specific data field (lat, lon, # sats, etc) and it will return just that, most other modules such as the EM406 continuously output all their data in "NEMA sentences" that you have to parse.
The connector you need to wire up looks like this (right), and
is simply made by cutting off one end of the connector cable and soldering (and covering with heat-shrink tubing) the wires to a six-pin segment of break-away headers
. You can plug the header pins straight into your breadboard (we'll actually only be using three of the first four pins--ground, V+and tx--so if you want to use just a three-pin header you can.)
If you're planning to place the GPS module at some distance from the autopilot (like on the top of your plane's fuselage or on a wing, which is always a good idea to ensure the best reception), the cable construction process is a good time to splice longer wires on, too. Or, since we just use three of the six pins, you can use a standard servo extension cable, which fits the header strip and can plug into the Basic Stamp development board's servo port, just as easily.
All this is covered in more detail in this very handy tutorial
. (The full series on that and code files are here
). [UPDATE: that tutorial has an error in the EM406 pin diagram. The actual pins you need are 1 (ground), 2 (V+) and 4 (Tx). The proper instructions can be found here.]
's some Basic Stamp code I wrote that will test your GPS, displaying the NEMA sentences on your PC debug terminal. As always, change it if you're using a different pin for the GPS Tx (this code has it on pin 9) or if you're using a Stamp other than the BS2p (by modifying the "GPSBD CON 500" as instructed by the comments on that line)
The second thing you need to do is write a GPS parser to extract the data you need from these NEMA sentences for your autopilot code. Fortunately many have come before you, so you can just modify the code you need from this
series of tutorials, or just roll your own. I haven't modified our own autopilot code yet to use this GPS module, but I'll get to that in the next week or so. [UPDATE: here it is
Previous posts in this series:
Tutorial 1 -- Servos
Tutorial 2 -- Reading the Rx