Shop OBEX P1 Docs P2 Docs Learn Events
GPS on LCD display! — Parallax Forums

GPS on LCD display!

electrosyselectrosys Posts: 212
edited 2010-02-18 13:03 in BASIC Stamp
Hello everyone

I have a GPS·PMB-648 module,·Board of Education + BS2 & 4x20 LCD display,·(all from Parallax)·I would like to make LCD to display GPS data "NMEA"·or at least·"Lat/Lon" data, any help would be appreciate·it, if anyone has done·something like that before, I would be happy to have a link.
I come from a good electronics background, but I am not very good at programming BS2, &·I need help, mostly by coding.

Thanks·

Comments

  • stamptrolstamptrol Posts: 1,731
    edited 2010-02-16 15:17
    Welcome to the forums.

    So, what have you done so far to achieve your goal?

    Its always easier for us to help you get over individual hurdles rather than try to imagine what problems you might run into.

    In general, you'll do three things:

    1. Hook up the GPS and get the data to read out on the the Debug screen.

    2. Hook up the LCD and prove to yourself you can put data onto the screen.

    3. Now combine the two previous steps by reading the GPS and put its data onto the LCD.

    Cheers,

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Tom Sisk

    http://www.siskconsult.com
    ·
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-16 15:32
    It's not just a matter of programming. A BS2 will have problems handling the raw NMEA data strings because of the limited variable storage (26 bytes). That's why the GPS modules that Parallax sells for use with a BS2 have an on-board SX controller to decode the NMEA data and present it in simplified form to the BS2. You could use pretty much any of the other BASIC Stamp modules (BS2e / BS2sx / BS2p / BS2pe / BS2px) to do this since they have additional storage (Scratchpad RAM) that can be used for receiving strings of data that can then be decoded.

    You might be able to handle just the latitude and longitude information. Read the chapter in the "BASIC Stamp Syntax and Reference Manual" on the SERIN statement, particularly the portions showing the WAIT item.
  • electrosyselectrosys Posts: 212
    edited 2010-02-16 15:57
    Thank you Tom & Mike, great help, I think first of all I would try to do all that (1-2 & 3) what Tom wrote & then I'll try to handle only Latitude and longitude as Mike mention it, that would be enough for the first part of mig project and then later on, maybe I go on to handle more NEMA data to display on LCD, that would be by using one of (BS2e/BS2sx/...) module.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    At the end, everything will became Electron...!
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-16 17:37
    The general idea is that the Stamps are not fast enough to decode the NMEA strings on-the-fly using ordinary statements (IF / FOR / DO / etc.) If the NMEA statements can be broken into a few small manageable pieces on-the-fly, then it might be doable. It would be helpful to slow down (reconfigure) the GPS module to 2400 Baud from the default of 4800 Baud. Particularly for the BS2, that would help a lot. You can use the WAIT item to look for markers in the character stream. To pick off the 3rd item in the NMEA position string (up to 10 characters), you could do:

    SERIN <pin>,<Baudmode>,[noparse][[/noparse] WAIT("!GPGGA"),WAIT(","),WAIT(","),STR stringValue\10\"," ]

    This would wait for "!GPGGA" and the comma following it, skip to the next comma, then accept up to 10 characters terminated by a comma. stringValue is declared as a byte array and, if the string is shorter than 10 characters, would be terminated by a zero byte. Once you have the string in a byte array, you can pick it apart for display.
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-02-16 18:16
    Mike Green said...
    SERIN <pin>,<Baudmode>,[noparse][[/noparse] WAIT("!GPGGA"),WAIT(","),WAIT(","),STR stringValue\10\"," ]

    This would wait for "!GPGGA" and the comma following it, skip to the next comma, then accept up to 10 characters terminated by a comma. stringValue is declared as a byte array and, if the string is shorter than 10 characters, would be terminated by a zero byte. Once you have the string in a byte array, you can pick it apart for display.
    I think you meant "$" where you have "!", right? The raw NMEA strings are prefaced with a "$GP", for example "$GPGGA", "$GPWPL", etc.

    I did once upon a time manage to parse out quite a few of the parts of the $GPGGA string with a BS2pe Mobo, though not all at once. You can read the string once to get the time, read it again to get the longitude, and again to get the latitude, and so on. You WAIT for "$GPGGA", then SKIP X number of bytes (the commas separating the string elements, and the data in the elements you're not looking for) to get to the bytes that make up the element that you're trying to read. You read those bytes into your variable, and display it, and then WAIT for it to come around again (...on guitar...) to get the next element.

    You'll have to reuse your variables, because of the limited variable space in a BS2, but you can still do a lot with it. You're not getting simultaneous lat, long, time, etc., but you're getting them within a few seconds of each other, which is fine for playing around with GPS.

    Post Edited (sylvie369) : 2/16/2010 6:21:56 PM GMT
  • Mike GreenMike Green Posts: 23,101
    edited 2010-02-16 18:23
    @sylvie369 - Yes, thank you, I meant "$".

    The BS2pe has the advantage of having scratchpad RAM which can save on variable space. I think the latitude and longitude items total less than 26 bytes in length, so you could read both, then break them apart. It would also work to read the latitude first then the longitude and process them separately.
  • sylvie369sylvie369 Posts: 1,622
    edited 2010-02-16 19:52
    Yes, I believe that including the "N" and "W" (or whatever hemisphere you're in), the lat and long together come to 19 bytes, assuming you don't bother with the decimal point. 21 if you do.

    I didn't know enough to use the scratchpad RAM when I put together my little gizmo - it was one of the first things I played around with. I was pretty amazed at being able to build a GPS that displayed time, lat, long, heading, and speed on a 4x20 LCD on my car's dashboard - and a little less pleased at how it sucked batteries dry in no time.
  • electrosyselectrosys Posts: 212
    edited 2010-02-16 23:03
    Thank you·Mike and Sylvie369,
    I have find a short (few pages) pdf. file - Easy GPS Reading for Basic Stamp Chip (BS2),·and program code for BS2,·which I have attached·the pdf file here.
    The code was developed to read in GPS data from a NMEA 0183 statement using the BS2 chip. I guess that is something I could start from, for now on, however the programmig code is for·typical debug window in the Basic Stamp Software Package, not for LCD display.


    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    At the end, everything will became Electron...!

    Post Edited (electrosys) : 2/16/2010 11:09:27 PM GMT
  • Carey BallCarey Ball Posts: 7
    edited 2010-02-18 00:00
    I did that with no trouble. Used the GPS and 4x20 LCD that I bought right here. Limited RAM is not a problem because only one byte at a time is being processed. I used the processed messages from the SX on the GPS, not the raw data.

    Just serial in from the GPS, and serial out to the LCD.

    cb
  • electrosyselectrosys Posts: 212
    edited 2010-02-18 12:18
    (Carey Ball·said)
    I did that with no trouble. Used the GPS and 4x20 LCD that I bought right here. Limited RAM is not a problem because only one byte at a time is being processed. I used the processed messages from the SX on the GPS, not the raw data said...
    Great, would you please tell us more about your project?
    Thanks

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    At the end, everything will became Electron...!
  • hover1hover1 Posts: 1,929
    edited 2010-02-18 12:58
    Carey,
    It sounds like you were using a Parallax 28146. Is that correct? The GPS (GPS·PMB-648) that electrosys is using does not have a "Smart Mode" setting on it.
    Jim
    Carey Ball said...
    I did that with no trouble. Used the GPS and 4x20 LCD that I bought right here. Limited RAM is not a problem because only one byte at a time is being processed. I used the processed messages from the SX on the GPS, not the raw data.

    Just serial in from the GPS, and serial out to the LCD.

    cb
  • PJAllenPJAllen Banned Posts: 5,065
    edited 2010-02-18 13:03
    Fear & Passivity, Fear & Passivity.· So many people expect to be spoon-fed.· Where's the participation?· Get off your butt and fill your boots already.

    Using the Forum 'Search' (upper right button), entering "$GPGLL" and 'Any Date', I found:
    http://forums.parallax.com/showthread.php?p=597444
Sign In or Register to comment.