Shop OBEX P1 Docs P2 Docs Learn Events
GPS DATA BS2 STAMP — Parallax Forums

GPS DATA BS2 STAMP

cydelcamatcydelcamat Posts: 53
edited 2016-04-26 08:06 in BASIC Stamp
hi guys! is there anyone who knows on how to get the data on gps? Im using basic stamp 2 and I always got an error saying that "Error: No response from GPS Receiver Module"
please see attachment.

Comments

  • Are you using the GPS device that the program was written for? Do you have a part number?

    Which BS2 are you using, there are many flavors and require different programming for baud rates.

    Sometime mixing up the transmit and receive lines would product the same problem
  • Im using BS2 stamp and the codes is still not working. i don't know what the problem is because this is new to me. please see attachment
    1024 x 596 - 131K
  • What gps device are you using? Please provide a link to technical documentation.
  • cydelcamatcydelcamat Posts: 53
    edited 2016-04-27 00:18
    Hi thank you for replying. Im not sure what gps device we are using but this is the sample output of our GPS. Please see attachment
    856 x 570 - 259K
  • It's against forum rules to post multiple threads on the same subject. Stick with a single thread.

    The above sample output does not help much. There's a standard format for GPS serial output (NMEA). Look on the GPS receiver for a part number/model number. If it's mounted on a printed circuit board or breakout board, is there a part number there?
  • Just throwing my 2 cents worth in here. It looks to me to be a Baud Rate error. I could be wrong and someone will chime in if I am but that's usually what the garbled output is caused from.
  • Can you show me guys on how to get the time from gps data? can i have a sample code for that?
  • Here are some examples. Some of them use a BS2p rather than the BS2 because the BS2p is faster and has a special memory area that can be used for fast input of multiple bytes.

    The first two attachments are from Parallax's Nut and Volts column archive #83. The 3rd attachment is from Parallax's learn website KickStarter for their GPS receiver. The last attachment is an article on NMEA decoding using a Stamp. As mentioned earlier, it would be helpful to know what kind of GPS receiver you're using.
  • Hi thanks for replying. this is my codes for displaying the time from gps, my problem is I need to add 30minutes on the time that came from GPS.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    time VAR Byte (6)


    n4800 CON 188
    n9600 CON 84

    MAIN:

    SERIN 0, n4800,[WAIT("RMC,"),STR time\6]
    SEROUT 16, n9600,[time(0),time(1),";",time(2),time(3),";",time(4),time(5)]


    DEBUG CR

    GOTO MAIN





  • If you reuse the first 3 bytes of "time", you can convert from characters to numbers with:
    time(0) = (time(0)-"0")*10+(time(1)-"0")   ' hours
    time(1) = (time(2)-"0")*10+(time(3)-"0")   ' minutes
    
    You can then add 30 to the minutes. If the result is greater than 59, subtract 60 and add 1 to the hours.
    Similarly, if the hours goes over 23, you want to rollover to 0 hours. If you need the seconds, you can handle that the same way.

    To display using SEROUT, prefix the variable with DEC2 and SEROUT will convert the number to 2 decimal digits.
  • cydelcamatcydelcamat Posts: 53
    edited 2016-04-27 05:30
    Hi thanks again for the reply, how should the whole code looks like? im very sorry because im new to this.
  • Hi this are now my codes for adding 30 minutes in time but my problem now is if the minute comes to zero there will be no display. What is the problem? hope to hear you guys asap! thanks!



    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    time VAR Byte (6)
    moveto CON 2

    n4800 CON 188
    n9600 CON 84

    MAIN:

    SERIN 0, n4800,[WAIT("GGA,"),STR time\6]

    DEBUG CR
    time(2) = time(2) + 3
    IF time(2) > 5 THEN
    time(2) = time(2) - 6
    time(1)= time(1) + 1
    ENDIF

    SEROUT 1, n4800, ["$GPGGA,",time(0),time(1), time(2),time(3),time(4),time(5)]



    GOTO MAIN



  • Mike GreenMike Green Posts: 23,101
    edited 2016-04-27 14:02
    IF time(2) > 5 THEN

    This won't work because the digits in "time" are characters ("0", "1", ... , "9"). Try

    IF time(2) > "5" THEN

    What happens when the time starts off at "095000" and you add 30 minutes?
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    NWCCTV wrote: »
    Just throwing my 2 cents worth in here. It looks to me to be a Baud Rate error. I could be wrong and someone will chime in if I am but that's usually what the garbled output is caused from.

    If the OP is using the code for the #28146 GPS we used to have (which it kind of looks like) and using a standard GPS that outputs NMEA strings, then this could also happen, because the code is expecting back formatted data and getting random characters from the NMEA strings and that is being printed.

  • PublisonPublison Posts: 12,366
    edited 2016-04-27 15:19
    NWCCTV wrote: »
    Just throwing my 2 cents worth in here. It looks to me to be a Baud Rate error. I could be wrong and someone will chime in if I am but that's usually what the garbled output is caused from.

    If the OP is using the code for the #28146 GPS we used to have (which it kind of looks like) and using a standard GPS that outputs NMEA strings, then this could also happen, because the code is expecting back formatted data and getting random characters from the NMEA strings and that is being printed.

    And why I asked in Post #2 for the GPS unit he is using. OP has yet to reply.
    That might narrow it down to the baud rate, but 4800 is kind of standard.
  • Chris SavageChris Savage Parallax Engineering Posts: 14,406
    edited 2016-04-27 15:24
    He replied that he doesn't know. However the format of the data on the screenshot he posted tells me that it is either not #28146 or if it is, the /RAW line is active, which won't work for that code.

    I've also confirmed by looking more closely at the screenshot...he is using the code for the Smart GPS (#28146) which won't work. This is evident by the Hardware/Firmware Version lines, which are queried from the module. This code isn't compatible with a standard GPS receiver.

    In fact, as Mike already mentioned...your'e better off using a BS2p-series module to handle NMEA strings in the absence of #28146 (long since discontinued). The SPRAM alone makes those models invaluable for dealing with long strings since the BASIC Stamp Modules don't have enough variable RAM to handle that kind of data.
  • thanks for the reply guys i really appreciate it. i am now testing my codes and will give feedback later. again thank you guys. more power on this forum.
  • Hi guys! im back again. I need to put daylight saving time. does anyone here know how? this is my sample code for getting data on gps and displaying the time.

    ' {$STAMP BS2}
    ' {$PBASIC 2.5}
    time VAR Byte (6)
    moveto CON 2

    n4800 CON 188
    n9600 CON 84

    MAIN:



    SERIN 0, n4800,[WAIT("RMC,"),STR time\6]



    SEROUT 1, n4800, ["$GPGGA,",time(0),time(1), time(2),time(3),time(4),time(5)]

    DEBUG CR


    GOTO MAIN
  • You'll have to work that out yourself. Daylight savings time starts at different dates in different countries. You'll have to find out what those dates are and test for between those dates, then add or subtract the appropriate hours from the time (GMT).

    I personally would have an easier time converting the date and time fields into numbers (hours, minutes, etc.) first the way I suggested earlier. I think you'd have an easier time testing against specific values and adjusting those values. You also might have an easier time using one of the BS2p Stamps or even a Propeller.
  • Is it possible that BS2 stamp can handle that kind of program when I want to add daylight saving time?

    Thank you!
  • kwinnkwinn Posts: 8,697
    Yes, but I would recommend you convert the date and time fields to numbers as Mike suggested. It makes the comparison of dates and time simpler, and usually results in a smaller program.
  • Thanks for the reply. Can you give me a sample code for that? just to have an idea on how does it works. thank you!
  • See my post from 4/27. The idea is that digits stored as characters have values from "0" through "9". To get the numeric value of the digit, subtract "0" from the character to get a value from 0 through 9.
  • cydelcamatcydelcamat Posts: 53
    edited 2016-05-05 06:07
    Thank you Mr. Green. I'll give a feedback once i am done with my codes. hope it works. thanks again!
Sign In or Register to comment.