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.

Here's 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

Views: 1253


Developer
Comment by Jordi Muñoz on January 12, 2008 at 7:22pm
Great, if you need help to add waypoint navigation, tell me, i already did that but with arduino. You will need like 4 kbs of flash:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1199022761

3D Robotics
Comment by Chris Anderson on January 12, 2008 at 7:35pm
Jordi,

Thanks for that, but I had problem with the URL. This one seems to work better:

http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1197693328

3D Robotics
Comment by Chris Anderson on January 12, 2008 at 7:46pm
BTW, Ardunio looks like a very interesting alternative to the Basic Stamp family. Jordi, any chance of posting a quick tutorial on how to use Ardunio for an autopilot? Or even just the pros and cons of switching from Basic Stamps to Ardunio for autopilot applications?

(His how-to on his own site for a heli autopilot looks great, but it's in Spanish!)

3D Robotics
Comment by Chris Anderson on January 12, 2008 at 8:52pm
Jordi,

One more thing: we do have a very crude waypoint navigation already implemented on the Basic Stamps. It's the "navigation" subroutine discussed in this post:
http://diydrones.ning.com/profiles/blog/show?id=705844%3ABlogPost%3A625

Developer
Comment by Jordi Muñoz on January 12, 2008 at 9:27pm
Yes, well.. arduino is better for hobbie peoples like us, try to put this number "1199022761" to the final of the URL:
"http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=".
Read this:
"http://todbot.com/blog/2006/09/25/arduino-the-basic-stamp-killer/"
But is not updated, the last arduino have 16kb of flash! and you have the arduino stamp version:
"http://www.arduino.cc/en/Main/ArduinoBoardMini"
This is my first test with Boarduino (shipper version of arduino), controlling servos an using an acceleromter from nintendo wii:
"http://www.youtube.com/watch?v=7xkJseQyhJA"
Right now im using Gyros and kalman filters:
"http://gizmobits.com/wp-content/uploads/2008/01/cimg0132.JPG".
I even wrote a code to read PMM signals, the gps is finish and working pretty well, the IMU is in beta, and i developing and altimeter using I2C tecnology of arduino and high quiality pressure sensors. And is super easy im 21 years old :P and im not an expert.Try to search in Youtube the word "Arduino" for a lot of examples.
The IDE works in WIndows, linux, and MAC (is the only one that works with mac). To read all about enter here:
http://arduino.cc/, the board cost 35 dlls in sparkfun.com

Developer
Comment by Jordi Muñoz on January 12, 2008 at 9:37pm
Tutorial to use a GPS device with arduino:
http://www.arduino.cc/playground/Tutorials/GPS

Ping sensor from parallax :P:
http://www.arduino.cc/playground/Main/UltrasonicSensor

Controlled RC transmitter:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1193927390

Nintendo Wii NunChuck:
http://www.windmeadow.com/node/42

3D Robotics
Comment by Chris Anderson on January 12, 2008 at 11:03pm
Jordi,

I turned your comments into a proper post:

http://diydrones.com/profiles/blog/show?id=705844%3ABlogPost%3A19556
Comment by Jason Striegel on January 13, 2008 at 11:30pm
Chris,

At what frequency are the NMEA sentences output by the EM406 versus the time it takes to poll the Parallax GPS module?

This is probably a naive question, but I'm only familiar with interfacing with an old Garmin 12. Without multi-threading capabilities, the application needed to wait a half-second or so for the coordinate sentence to get spit out. Even at higher baud rates, the NMEA output was only sent once a second. It just came down the wire really fast, but at second intervals.

Do either of these modules cache the location data and output the last-known coordinates, allowing your guidance loop to continue and not block while waiting for the update?

3D Robotics
Comment by Chris Anderson on January 13, 2008 at 11:35pm
I'm getting 1Hz, which is the fastest that module can read. In other words, the time it takes the Stamp to read and display the NEMA sentence is less than the time it takes the GPS module to generated a new one.

Comment

You need to be a member of DIY Drones to add comments!

Join DIY Drones

© 2017   Created by Chris Anderson.   Powered by

Badges  |  Report an Issue  |  Terms of Service