Shop OBEX P1 Docs P2 Docs Learn Events
[Guide] Hooking up and Programming the PMB-248 GPS Reciever — Parallax Forums

[Guide] Hooking up and Programming the PMB-248 GPS Reciever

GeorgeLGeorgeL Posts: 131
edited 2010-04-22 08:17 in BASIC Stamp
Bill of Materials:
  • Board Of Education, Stamp Board, Boe-Bot, etc.
  • PMB-248 GPS Reciever
  • Serial Cable/Usb Cable·and Basic Stamp Editor
To hook up the PMB-248 GPS Reciever insert the provided cable so that the two little notches match.
Insulate the tips of the Blue, White, and Yellow cables. You will not be using them for this guide.
Take the Green, Red and Black cables, and insert them into the breadboard.
Using jumper cables/ breadboard cables, connect the GPS's:

Green wire to P15
Black wire to Vss
Red wire to Vdd

boegps1.jpg
This is how I set mine up.

Now connect the board to the computer as you normally would and open the Stamp Editor.

Open a new program.
Enter this code in:

' {$STAMP BS2}
' {$PBASIC 2.5}
'By George Lejnine and parts by Randy Price
'Program to read in GPS coordinates from the NMEA 0183 GPRMC statement
'Many parts have been removed such as time and course direction, for simplicity. They can easily be added.
gpstime VAR Word
N VAR Word
N2 VAR Word
A VAR Word
B VAR Word
WA VAR Word
W VAR Word
NN VAR Word
WW VAR Word
speed1 VAR Word
speed2 VAR Nib
course1 VAR Word
course2 VAR Nib
'Baud rates:
'16572 = 4800 baud
n4800 CON 16572
main:
'The number after SERIN is the Pin to which the Green wire is connected, in our case 15
SERIN 15,n4800,noGPS1,[noparse][[/noparse]WAIT("RMC,"),DEC gpstime, SKIP 3, DEC N, DEC NN, SKIP 3, DEC W, DEC WW, SKIP 3, DEC speed1, DEC speed2, DEC course1,DEC course2]
GOSUB output1
GOTO main
'******************************************* OUTPUT ROUTINE *******************************************
output1:
DEBUG  DEC N,".",DEC4 NN," N "
DEBUG  DEC W,".",DEC4 WW," W ", CR 'Line Break here
'This statement is optional, it is for the BlueTooth Modules.
'SEROUT 1,84 ,[noparse][[/noparse]"TX", 10, DEC NN,10]
RETURN
'************************************** GPS Not Detected Routine ***************************************
nogps1:
DEBUG "no gps",CR
GOTO MAIN



Now run the program.
You should get something like this:
terminal1.png

If you dont then check that:
You are in an open area. Give the GPS a minute or two to connect.
Everything is connected correctly (make sure the green wire is at Pin 15).
The status light (red) should be blinking or solid. If it is not, you are not putting power into it.

Otherwise lets look at our data.
Example Output:
4734.7540 N 12213.3448 W
In order to use this data, we need to convert it. In this example I will be using Google Earth.
In degrees, minutes, seconds; assuming we dont use the symbols (Google Earth allows this)
we will convert these coordinates·to 47 34.7540 N 122 13.3448 W
Typing this into the Fly to Menu
earth2.png
(Note: this image has typo)

and hit enter. This will take you to (in my example) my room.
earth3.png

·Feel free to use anypart of this code, as long as you include my name




Post Edited (GeorgeL) : 5/12/2009 5:48:59 AM GMT

Comments

  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-12 23:25
    Here is a correction and revision to teh old code.
    Go to where there are two DEBUG statements.
    Replace them with:
    DEBUG  DEC N/100," ",DEC N//100,".", DEC4 NN," N "
    DEBUG  DEC W/100," ",DEC W//100,".", DEC4 WW," W ", CR 'Line Break here
    


    Now, you dont have to convert the numbers. You can copy paste the results into Google Earth and it will find you!
  • hover1hover1 Posts: 1,929
    edited 2009-05-14 00:17
    George,

    Nice work! I'm glad I was wrong about the BS2 capturing RAW data. I guess we both learned something.

    Now you just made me purchase the PMB-248 GPS Reciever! I am already doing Goggle Earth logging with a propeller, but now I will try it with a Stamp.

    Jim
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-14 00:21
    If you have a laptop, you can also take the GPS with you! I wrote a small application that outputs the coordinates into a file, then just simply copy paste them into a .kml file (create a simple txt file and rename whatever.kml)
    <?xml version="1.0" encoding="UTF-8"?>
    <kml xmlns="[url=http://www.opengis.net/kml/2.2]http://www.opengis.net/kml/2.2[/url]">
      <Document>
        <name>Paths</name>
        <description>Examples of paths. Note that the tessellate tag is by default
          set to 0. If you want to create tessellated lines, they must be authored
          (or edited) directly in KML.</description>
        <Style id="yellowLineGreenPoly">
          <LineStyle>
            <color>7f00ffff</color>
            <width>4</width>
          </LineStyle>
          <PolyStyle>
            <color>7f00ff00</color>
          </PolyStyle>
        </Style>
        <Placemark>
          <name>Absolute Extruded</name>
          <description>Transparent green wall with yellow outlines</description>
          <styleUrl>#yellowLineGreenPoly</styleUrl>
          <LineString>
            <extrude>1</extrude>
            <tessellate>1</tessellate>
            <altitudeMode>absolute</altitudeMode> <coordinates>
    

    enter coordinates here
            </coordinates>
          </LineString>
        </Placemark>
      </Document>
    </kml>
    
    

    Dont forget to run the .bs2 file attached (in the zip)
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-14 00:22
    hover1 said...
    George,

    Nice work! I'm glad I was wrong about the BS2 capturing RAW data. I guess we both learned something.

    Now you just made me purchase the PMB-248 GPS Reciever! I am already doing Goggle Earth logging with a propeller, but now I will try it with a Stamp.

    Jim
    Right as you say that, I post up the guide for Google Earth interfaces.
  • Tom CTom C Posts: 461
    edited 2009-05-18 00:14
    Hi all,

    I would like to use the Polstar PMB-248 to capture latitude and longitude in decimal angular format using the $GPGLL string.

    Will the following BS2 code capture the values that I want:

    SERIN 10, 16572, [noparse][[/noparse]WAIT ("PGLL,"), SKIP 5, DEC LAT] 'Get LAT data from the GPS (4800 Baud)

    SERIN 10, 16572, [noparse][[/noparse]WAIT (",N,"), SKIP 6, DEC LONG] 'Get LONG data from the GPS(4800 Baud)

    Regards,
    TCIII

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you are going to send·a Robot·to save the world, you·better make sure it likes it the way it is!
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-18 00:30
    The NMEA 0183 strings by default send it in Degree-Minute form. The VB app converts them to coordinates.
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-18 00:37
    I tried out the two SERINS you posted, the Longitude works, and the output is
    47 34.7378 N 122 13.3336 W The time is: 5:3903
    3336 <---- DEC Long

    The other one doesnt work though.

    But in reality do you need it like that, its the same as what I have right now. Just multiply it by 1000 and have that be a new variable?

    Post Edited (GeorgeL) : 5/18/2009 12:45:43 AM GMT
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-18 02:12
    Figured out the issue, you cant use GLL or PGLL
  • Tom CTom C Posts: 461
    edited 2009-05-18 03:06
    Hi GeorgeL,

    I did not write the two code snippets. They are from a BS2 program used to drive a robotic rover from one way point to another until all the way points have been visited.

    I had looked at a $GPGLL sentence example: $GPGLL,3751.65,S,14507.36,E*77 and this example: $GPGLL,4916.45,N,12311.12,W,225444,A

    It is interesting that the LONG code worked as skipping 6 positions from "N" should not be the longitude decimal angular value according to the second example.

    However, skipping 0 positions, not 5 positions, from PGLL (or $GPGLL?) results in a capture of the latitude, 4916.45, which requires starting at $GPGLL in the second example.

    The author of the original BS2 code did not indicate if he was using the original Parallax GPS or some other GPS. The code was written before the Polstar PMB-248 became available.

    Comments?

    Regards,
    TCIII

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    If you are going to send·a Robot·to save the world, you·better make sure it likes it the way it is!
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-18 03:10
    Whats interesting is that it never "recieves" PGLL or GLL. The Correct form is GLL as far as I am concerned. I even tried LL, just incase. Really odd. At the moment I am adding a GGA statement for number of sattelites.
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-18 05:05
    You can also easily add the number of sattelites, and your altitude from sea-floor!

    Add to the list of variables:
    sattelites VAR Word
    alt VAR Word
    

    Comment out the:
    'course1 VAR Word
    'course2 VAR Nib
    

    Edit the SERIN ·statement to:
    SERIN 15,n4800,noGPS1,[noparse][[/noparse]WAIT("RMC,"),DEC gpstime, SKIP 3, DEC N, DEC NN, SKIP 3, DEC W, DEC WW, SKIP 3, DEC speed1, DEC speed2]
    


    Where·you·have the first SERIN add:
    SERIN 15,n4800,noGPS1,[noparse][[/noparse]WAIT("GGA,"),SKIP 7,SKIP 4,SKIP 5, SKIP 6, SKIP 3, SKIP 4, SKIP 5,DEC sattelites, SKIP 5,DEC alt]
    

    Go down to the last of the DEBUG and add
    DEBUG  "Number Of Sattelites: ",DEC sattelites ,CR
    DEBUG  "Altitude(ft): ", DEC alt*3,CR,CR
    

    Now in the terminal you should be getting something like this:



    47 34.7468 N 122 13.3428 W
    The time is: 10:4740
    6
    Altitude(ft): 279
    



    Good luck, and a more functional GPS app is to come!



    Post Edited (GeorgeL) : 5/18/2009 5:47:49 AM GMT
  • DufferDuffer Posts: 374
    edited 2009-05-18 16:12
    From my reading of the documentation for the original Parallax GPS module and looking at the "raw" data from the module, only four NMEA 0183 sentences, $GPGGA, $GPGSV, $GPGSA, and $GPRMC, are output by the Polstar GPS unit. Sample code that you may have seen parsing a $GPGLL sentence may have been for a different GPS module.

    Duffer
  • GeorgeLGeorgeL Posts: 131
    edited 2009-05-18 20:09
    The Polstar is·the "Parralax GPS Module" with a SX microcontroller as far as I remember.·$GPGLL is one of the standard NMEA 0183 sentences. While expiremeting the GGA, I noticed that it could be used in equivalence with GLL sentences for what he wants.
  • henry151henry151 Posts: 8
    edited 2009-08-27 14:59
    Just recieved a PMB-248 GPS REciever + Cable, very excited. I have a Boe bot. I have followed this excelent set of instructions, I am recieving data. But, its just garbage data.

    103 3.0057 N 49 22.0000 W
    103 3.0055 N 49 24.0000 W
    103 3.0053 N 49 26.0000 W
    ...

    The W value keeps increasing by 2 and there is no 103 deg N!

    Any sugestions would be greatly apreciated!
  • GeorgeLGeorgeL Posts: 131
    edited 2009-08-27 15:34
    My first reccomendation would be to double check that you copy pasted the code correctly. The reason it's increasing by two is because your coordinates are getting mixed with the time stamp, as far as I remember. I will double check that I posted the error free code later on today.
  • henry151henry151 Posts: 8
    edited 2009-08-27 15:50
    Many thanks.

    I have double checked that my code is correct.

    Could this be a problem with my region? Are there different calculations for which area of the world you are in?

    I am about 20 mins from Greenwich, UK, so I should be getting very close to 0deg W.

    Post Edited (henry151) : 8/27/2009 4:04:38 PM GMT
  • GeorgeLGeorgeL Posts: 131
    edited 2009-08-27 16:13
    That might be it, cause in the US all the lat's and longs are 3 digits, so it might be that. You can adjust the WAIT's for your region. Just look at the NEMA documentation on google.
  • SRLMSRLM Posts: 5,045
    edited 2009-08-27 16:14
    Is the GPS locked onto a satellite signal? If it's not, then it probably outputs garbage data (except for the lock indicator in RMC).
  • GeorgeLGeorgeL Posts: 131
    edited 2009-08-27 16:17
    When I have no connection, I dont get garbage data, only the time keeps updating.
  • henry151henry151 Posts: 8
    edited 2009-08-27 16:47
    Left robot on the window sill for 30 mins, light on GPS stayed flashing whole time, but the numbers have changed...
    86 65.0005 N 333 55.0000 W

    The W time value is still incrementing.

    I have yet to see the GPS attain a lock (solid light).

    Are the different revisions of this module anything to consider, this is a REv:2.3
  • GeorgeLGeorgeL Posts: 131
    edited 2009-08-27 17:00
    Thats the same one I have, try going outside, and attach an lcd or bring your laptop (if applicapable).
  • kdthomaskdthomas Posts: 2
    edited 2009-10-15 02:27
    So, In reading the specs for these two products, I notice that the PMB-248 uses 3.3V and the 28146 uses 5v. Wouldn't that cause a problem, hooking it to the stamp, or any device using 5v logic. In the data sheet for the PMB-248

    www.parallax.com/Portals/0/Downloads/docs/prod/sens/PMB-248_Specification.pdf

    pg 4, it lists Vcc at 3.3V with a max at 5.5V. Would running the chip at 5V for an extended period stress it?

    Is there a documented, proper way to reduce the 5V power and logic to 3.3V? Or am I totally missing the point?

    Bear in mind I am a newbie, just getting into embedded programming, with gumstix, beagleboard, etc. (And the stamp, too!!! smile.gif )

    All I really need is the NMEA data, not the request/response functionality, so if I can use the $39 unit, i'd like to. (I'm a cheap b***ard)
  • GeorgeLGeorgeL Posts: 131
    edited 2009-10-15 02:31
    To be honest, I've been working with Arduino for the past few months a lot more than stamp. With the PMB-248 and Arduino you can get all the sentences NMEA format through the TX/RX pins. I just added the TinyGPS library and it is very useful for filtering out the things you need. Take a look at it: http://arduiniana.org/libraries/tinygps/


    I dont think there would be a voltage issue, since I've been running the GPS constantly for almost 2-3 months.
  • kdthomaskdthomas Posts: 2
    edited 2009-10-15 17:45
    OK, I hear ya ... I also am thinking of running it from BeagleBoard, gumstix, etc.

    I just need to confirm that running from a board this way is the supported, correct, and proper way to do things. Or, if there is a simple way to step the voltage and logic signals down to 3.3V. If nothing else, I'll just use the $79 module.

    Does anyone know the MTBF on these things?

    I don't want to make 1000 devices and get 250 returns because we burned up a chip by running voltages at the edge of the envelope. Knowwhaddamean smile.gif
  • JoakimJoakim Posts: 2
    edited 2010-04-22 08:17
    Hi

    Im having trouble getting right info from my PMB 248 GPS antenna. It only ticks each second and change each second.

    This is the program I'm using:
    ' {$STAMP BS2sx}
    ' {$PBASIC 2.5}
    'By George Lejnine and parts by Randy Price
    'Program to read in GPS coordinates from the NMEA 0183 GPRMC statement
    'Many parts have been removed such as time and course direction, for simplicity. They can easily be added.
    gpstime VAR Word
    N VAR Word
    N2 VAR Word
    A VAR Word
    B VAR Word
    WA VAR Word
    W VAR Word
    NN VAR Word
    WW VAR Word
    speed1 VAR Word
    speed2 VAR Nib
    course1 VAR Word
    course2 VAR Nib
    'Baud rates:
    '16572 = 4800 baud
    n4800 CON 16884
    main:
    'The number after SERIN is the Pin to which the Green wire is connected, in our case 15
    SERIN 15,n4800,noGPS1,[noparse][[/noparse]WAIT("RMC,"),DEC gpstime, SKIP 3, DEC N, DEC NN, SKIP 3, DEC W, DEC WW, SKIP 3, DEC speed1, DEC speed2, DEC course1,DEC course2]
    GOSUB output1
    GOTO main
    '******************************************* OUTPUT ROUTINE *******************************************
    output1:
    DEBUG  DEC N,".",DEC4 NN," N "
    DEBUG  DEC W,".",DEC4 WW," W ", CR 'Line Break here
    'This statement is optional, it is for the BlueTooth Modules.
    'SEROUT 1,84 ,[noparse][[/noparse]"TX", 10, DEC NN,10]
    RETURN
    '************************************** GPS Not Detected Routine ***************************************
    nogps1:
    DEBUG "no gps",CR
    GOTO MAIN
    



    It belongs to George Lejnine.
    When I debug the info I get from N, NN, W and WW. I only get garbage data. It ticks like the clock and counts to 60 then it starts over.

    Like this:
    103 3.0057 N 49 22.0000 W
    103 3.0055 N 49 23.0000 W
    103 3.0053 N 49 24.0000 W
    
    



    I live in norway btw, 50min west of Oslo.
Sign In or Register to comment.