Shop OBEX P1 Docs P2 Docs Learn Events
gps+bs2 — Parallax Forums

gps+bs2

christiandchristiand Posts: 7
edited 2007-12-12 22:10 in BASIC Stamp
Hi!

I would like to know how to extract information (heading, speed, altitude) from a gps with the help from my bs2 and present it in windows hyperterminal or some lcd display.. What I was hoping you could help me with is where I can find code-examples of how to extract the information from my gps receiver? It is a Globalsat BR-355 and i have attached a picture of the pinouts.. Thank´s in advance

regard / Christian
550 x 316 - 37K
400 x 191 - 53K

Comments

  • ZootZoot Posts: 2,227
    edited 2007-12-12 16:58
    The real trick with reading GPS info with a Stamp is setting the GPS to output NMEA stings at a slow enough baud rate that the Stamp can read it in time and extract the necessary data. The rest is just string coding tricks.

    For the former, consult your GPS unit's documentation. For the latter, here are some examples:

    BS2 code for reading NMEA strings (this is for the Parallax GPS, but the theory and code for extracting data from the NMEA string is the same): www.parallax.com/Portals/0/Downloads/src/prod/GPSDemoV1.1.zip

    Sample code (and circuit) for interfacing Stamps to a GPS (again, this may describe different unit(s) than yours, but the theory and code would be similar): www.parallax.com/Portals/0/Downloads/docs/article/GPSReadings.pdf

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • ZootZoot Posts: 2,227
    edited 2007-12-12 17:01
    P.S. -- the wiring will be pretty simple. PRESUMING THAT YOUR UNIT SENDS TTL LEVEL SIGNALS (i.e. 5v) -- wire TX (green) from the GPS to the Stamp pin to be used with SERIN. Put a 220 ohm resistor in line with that wire in case you mis-program the pin to an output. Connect the Stamp power supply ground with the GND (black) wire from the GPS.

    If your GPS outputs signal levels other than TTL 5v, you will need a level-shifter between the unit and your Stamp so you don't fry your Stamp pin. Again, consult your GPS unit's documentation for info about that.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • christiandchristiand Posts: 7
    edited 2007-12-12 17:20
    I´ve found examples ie. where they logg gps location from an rc airplane flight.. http://www.roboeducators.org/downloads/prog inst/Datalogging with a GPS.PDF

    They use a Garmin Etrex and they only seem to use one pin to extract information.. As far as I know I need both Rx and Tx to tell my gps what info I want and for it to send it to me..? It would be nice if I could use the code allready shown in that tutorial..
    583 x 357 - 33K
    Namnl 32.6K
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2007-12-12 17:26
    There are at least 2 examples of parsing GPS strings in the Nuts & Volts Columns on our website. Have a look through that section for more information. Take care.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Chris Savage
    Parallax Tech Support
  • christiandchristiand Posts: 7
    edited 2007-12-12 17:35
    Just noticed they don´t use the bs2 in that project.. [noparse]:([/noparse] but the BS2p24..
  • sylvie369sylvie369 Posts: 1,622
    edited 2007-12-12 19:17
    Here's the site that I used to get the necessary information about the NMEA strings:

    http://home.mira.net/~gnb/gps/nmea.html

    $GPGGA is the one you probably want to look at first.

    Using the Parallax GPS receiver, I just pulled the Raw pin low to get it to send out the raw strings, then used a SERIN·command with·Wait and Skip·to get what I needed. Have it Wait until you get "$GPGGA", then skip through the number of bytes preceding the information you want to look at. For example, if you want the Latitude data, you have to skip the 6 bytes of time data first. Count carefully, and send whatever you're getting to the screen while you're figuring it out so you aren't shooting in the dark.

    Using this, I was able to put together a pretty nifty little GPS receiver thing, sending the Latitude, Longitude, course and speed to a 16x4 LCD that I could prop up behind my steering wheel. Worked great.

    Does your GPS automatically send out NMEA strings when the power is on and it's receiving enough satellites?
    ·
  • christiandchristiand Posts: 7
    edited 2007-12-12 21:14
    The thing is, I dont´t have an idea where to start.. I only got the receiver and a stamp.. the receiver has an Rx pin and a Tx pin..And if I´m not wrong I need to tell the gps receiver what information I want to extract? Other than that I dont know how to get started..?

    Post Edited (christiand) : 12/12/2007 9:24:11 PM GMT
  • ZootZoot Posts: 2,227
    edited 2007-12-12 21:36
    Read up on some of the articles folks have posted here. NMEA strings basically contain all the relevant GPS info, you just need to parse out (and possible derive) what you want. You don't need to tell the GPS anything. I can't speak to your unit, but the various GPSs we've tried out, you can generally set the device itself to send out NMEA strings on it's serial connection (vs. whatever other protocols and/or proprietary formats may be available). On our Garmins, for instance, this is a kind of user preference, and the setting stays that way until we change it. On some the other GPSs, you can change this setting via standard serial connection to a PC -- once -- then not worry about hooking up the RX.

    Will greatly simplify your code and hookup headaches. If you are not sending to the GPS, then you just need to tie the grounds together and hook up the TX pin of the GPS to the pin of the Stamp you will use to read the serial info -- TAKING INTO ACCOUNT POSSIBLE DIFFERENCES IN VOLTAGE/CURRENT between the two devices (if any).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • christiandchristiand Posts: 7
    edited 2007-12-12 21:47
    So it could be possible that I can use my gps unit as others have done with the Garmin Etrex for example? Just connecting one pin (Tx) and ground and vcc.. and programming the whole thing as the others do..
  • ZootZoot Posts: 2,227
    edited 2007-12-12 22:06
    Yes, I would think so. The NMEA format is a standard -- presuming your GPS can be set to output in this format, and presuming you double-check the serial voltage levels and baud rate it outputs, the code would be the same -- theoretically. And once you understand some of the tricks involved in waiting and parsing through a long serial string, you'll be able to change the parsing code to suit your particular needs (i.e. throwing away code that deals with info you don't need and/or deriving additional info from gathered data to suit your needs).

    The only change you might need to make is to the SERIN parameters if the serial from your unit is different (inverted, non-inverted, etc).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    When the going gets weird, the weird turn pro. -- HST
  • christiandchristiand Posts: 7
    edited 2007-12-12 22:10
    ok thanks alot for your help! I´ll get back here if I run into problems [noparse]:D[/noparse]

    cheers / Christian
Sign In or Register to comment.