In my last tutorial
, I showed you how to upgrade from the 12-sat Parallax GPS module to the much better (and cheaper) 20-sat EM406
. Unfortunately, my instructions weren't compete and I've spent a frustrating week actually trying to get it to work properly. I've now diagnosed the problem and fixed it, so this tutorial will help you avoid the problems I ran into.
Just to remind you, the main difference between the Parallax GPS board and the EM406 is that the EM406 is a bare module that you've got to wire properly onto your Basic stamp dev board, and the EM406 outputs raw NEMA "sentences" that you need to parse rather than specific requested data fields as is the case of the Parallax board (trust me, the slight hassle of working with the 406 is more than made up for by its great performance).
In my instructions last time, I advised you to follow this tutorial
that was in Servo Magazine this month. Unfortunately it has a serious error in the diagram of the EM406 pins--it actually has the Rx and Tx pins reversed. This took me days to work out, and eventually I went to the manufacturer's datasheet
for the EM406 to get it right.
The only three wires you need are 1, 2 and 4. That's ground, V+ and Tx. (pin 5 is another ground, which I've also connected to pin 1 in the picture, but I don't think that's actually necessary).
If you click on the photo above, you can see that I've soldered those wires onto a header strip, plugged it into the Basic Stamp dev board's breadboard, and connected the Ground, V+ and Tx wires. I connected the Tx wire (the white one in the picture) to the Basic Stamp's pin 9, although you can choose any unused pin you want.
the Basic Stamp code that will test the setup above. As always, change it if you're using a different pin for the GPS Tx 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 EM406 should get a sat lock (LED starts blinking) in less than a minute, indoors or out. When you run the above code, your debug screen on your PC should start showing NEMA sentences with lat, lon, and a few other data points. You can then decide what data fields you want in your autopilot and write your code accordingly, or incorporate a full GPS parser as discussed in this series
Previous posts in this series:
Tutorial 1 -- Servos
Tutorial 2 -- Reading the Rx
Tutorial 3 -- Adding GPS
Tutorial 4 -- Upgrading your GPS