[UPDATE: We no longer recommend this GPS module, since it's incomptible with GPS simulators. The module we do recommend, the EM406, is described here.]

Now you've got the hang of connecting components to the development board, you'll be pleased by how easy it is to include GPS. Parallax sells a pretty inexpensive ($70) GPS module that has a simplified "smart" mode that only sends the data fields requested. It's not the best GPS chip (only 12 sats), so you'll need a pretty clear view of the sky and it probably won't work indoors (but a little balsa or foam in your plane shouldn't be a problem). This is the easiest GPS module to use with the Basic Stamp board, but if you think you're going to want a more advanced module with better reception, skip to the next tutorial

I had a little trouble when I first tried to get the Parallax GPS working, so this tutorial will help you avoid my mistakes.

First, DON'T place the GPS board right on your development board's breadboard. For some reason the GPS reception is terrible there, due to noise from other components. Instead, use another female-to-female servo connector cable (at least ten inches long; one of these is fine) and with it connect the three GPS pins other than /RAW to one of the dev board's servo ports that you're not using, as I've show in the picture.

Second, you're going to have to modify the demo code for the particular BASIC Stamp chip you're using. This took me forever to discover and it's definitely a shame that neither the manual or demo code mention this. You'll see in the code that there is this line:

T4800 CON 188

It tuns out that that 188 is just for the BS2, BS2e, and BS2pe chip. If you've got one of the other chips (I've got the BS2p) you need to change it. For the BS2sx and BS2p the number should be 500. For the BS2px it should be 813. (This info is buried in the BASIC Stamp Editor's help file in the SEROUT entry)

Also, change this line:

Sio PIN 15

To reflect whichever pin you've actually connected the GPS's SIO pin to.

Once you've made those modification the demo should run and you'll be able to copy the relevant code from that to your autopilot program.

If you're finding that this GPS just doesn't give you reliable enough performance, you may want to upgrade to a more advanced GPS module based on the 20-sat SIRFIII chipset. A good choice is this one from SparkFun, which is $10 cheaper than the Parallax module but offers much better reception. It's a bit trickier to interface with the Basic Stamp chip, so that's what we'll look at in the next tutorial.

Previous posts in this series:

Tutorial 1 -- Servos
Tutorial 2 -- Reading the Rx

Views: 4795

Comment by James Hall on January 6, 2008 at 7:41pm
I am having the worse luck with the GPS I purchased from Parallax. I download the demo code, with the baud rate changes you mentioned Chris, the light blinks and goes out but I never get any data back from it. I had it work once, for a bit. Then after shutting it off and coming back the next day...nothing. Either I am missing something or the GPS satellites just get zapped by aliens. How is the SIRFIII chipset working out for you?

3D Robotics
Comment by Chris Anderson on January 6, 2008 at 8:02pm
When you say the light blinks and goes out, it should blink (looking for sats) and stay ON (found them). Other GPS modules do the opposite. But none should go out.

The SIRF III modules lock on within 15 seconds and stay locked on.
Comment by James Hall on January 6, 2008 at 8:28pm
Sorry. I meant it blinks and then stays on. I also noticed that the ceramic square does heat up a little. Is this normal?

3D Robotics
Comment by Chris Anderson on January 7, 2008 at 9:19pm
I haven't noticed any heating. I do know that it's hard to get a lock on the module unless you're outdoors with a clear view of the sky. You are testing this outdoors, yes?
Comment by rad man on January 8, 2008 at 6:25pm
well im guessing that that james hall might have misplaced some wires and should disconnect his power right away because he might have raw power going to the receiver i did that once and it started smoking!! but i quickly changed the power and switched a wire around
Comment by James Hall on January 9, 2008 at 4:53am
So far I have attributed the problem to some bad futaba wires. I will have to replace them this weekend and take the little gem out on the road to a better clearing to see if that helps my situation. If not, sounds like the SIRFIII chipset is a better solution.
Comment by James Hall on January 9, 2008 at 7:52am
Update. I took my system along for a ride in the car this morning on my way to work and picked up 8 satellites and coordinates, altitude never did come through. I take it altitude is now very realiable as is my experience with GPS devices I have owned in the past. I wonder if the EM406 does a better job of receiving altitude.
Comment by James Hall on January 10, 2008 at 8:54pm
UH OH! I ran my programming through its hitches which is very similiar to the version Chris put up a while back. Looks like when I have my stamp baud set to allow pass through to the servo controller it works fine, but when I flip the gear switch to turn control over to the GPS and back again, the serial commands out to the servos stop. The servo controller must be reset by pushing the little black button on itself.

I certainly hope the propeller chip can offer servo control by its own accord with the need for a servo controller of some sort. Can the proto board for the propeller suppor the required volt and current draw for 5 servos?

Comment by wayne garris on January 10, 2008 at 10:23pm
you have to make sure you add a line someware to periodicly set the baud to 38k4 but you have to send it in its default 2400 baud mode . if the controller is reset for some reson it goes back to this default baud mode . hope this helps
Comment by James Hall on January 11, 2008 at 4:42am
Like this? ignore the fact they are commented out.

' DEBUG "Finding PSC", CR
' SEROUT Sdat, Baud+$8000, ["!SCVER?", CR]
' SERIN Sdat, Baud+$8000, 500, FindPSC, [STR buff\3]
' DEBUG "PSC Ver:", buff(0), buff(1), buff(2), CR

' DEBUG "Setting Baudrate", CR
' SEROUT sdat, Baud+$8000, ["!SCSBR",0,CR]
' SERIN sdat,Baud+$8000,500, SetBaud, [STR buff\3]
' DEBUG "Baud reply: ", buff(0), buff(1), DEC1 buff(2), CR

'DEBUG "Setting Baudrate", CR
'SEROUT sdat, Baud+$8000, ["!SCSBR",1,CR]
'SERIN sdat,Baud,500, SetBaud2, [STR buff\3]
'DEBUG "Baud reply: ", buff(0), buff(1), DEC1 buff(2), CR
'DEBUG CLS 'clear debug screen


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