GPS for the GoPiGo

There’s a nice “neo” form factor GPS module out there (this link is from Robot Shop) for the NEO-7M GPS module for $30.

https://www.robotshop.com/products/neo-7m-gps-module-arduino

Ozon in Russia has a similar module based on the NEO-7M direct from China for $12.
https://www.ozon.ru/product/gps-modul-gy-gpsv3-neo-7m-799899477

It talks about the Arduino, but it can also work with the Raspberry Pi’s 3.3v VCC and logic levels too.

I ordered one and I’m going to play with it when it comes. (GPGOS’s Bloxter has support for a serial interfaced GPS module.)

Maybe Dave would like one for his next marathon at the local track? Or if he decides to chase squirrels and gets lost?
:rofl:

1 Like

I’m always impressed that we got a USER REQUEST to support the GPS in Bloxter. But yes indeed, it is supported :slight_smile:

2 Likes

This is the only GPS officially supported in Bloxter btw

2 Likes

AFAIK the command set for GPS units is (supposedly) the same, and since this was actually available, (!!), I decided to give it a try.

Doesn’t the GPS run off the serial port? At least it used to.

1 Like

it runs off the serial port, yes. But I’m not sure if the python library will work.

2 Likes

I have made a Grove-GPS adapter cable and I plan to plug it in and give it a try later.

1 Like

Update:

Connecting the GPS to the serial connector on the GoPiGo did not work. I do not yet know if there’s a basic incompatibility or if it’s something stupid like the baud-rate being off.

Does anyone know how to open the serial port in a terminal window?

Update:
https://forums.raspberrypi.com/viewtopic.php?t=212100

1 Like

Apparently the original Grove GPS module is out of production and has been replaced by the Air-530 version.

Do you know if this will work?

Do you know what command protocol is being used for the original GPS?

Thanks!

1 Like

It absolutely sends commands to the GPS, as the GPS requires at least one setup string to function properly.

It looks like it uses the standard NEMA GPS message structure and protocol. The GPS I bought should work out of the box as it is a U-blox compatible device as is the one recommended by @cleoqc.  The only difference appears to be the pinout of the connector and creating an adapter cable is a trivial exercise.

The returned data is in response to the appropriate data-request messages.

I believe the GPS defaults to 9600 8n1 as is specified in the source.

I tried plugging it into Charlie and it did not appear to work within Bloxter.  I will have to test with Charlene to see if the problem is a connection problem with Charlie’s serial port, (caused by the connector replacement), or something else.  (I might have to re-enable Serial, just in case I turned it off. :man_facepalming:)

I bought another USB-Serial adapter, wanting to test the GPS using my laptop, but it appears that the NEMA standard is more complex than the simple “AT” commands used by modems or the serial interface used by many microcontrollers.

I am currently doing my taxes so specific experiments will have to wait.

1 Like

Well. . . . that explains a lot. . . .

AFAIK, the Grove GPS module is supposed to work with the GoPiGo3 out-of-the-box, without requiring a whole slew of modifications.

Not to mention that this is both a completely different repository AND totally different software.

Again, AFAIK, (based on my comparison of the two modules I researched), they’re essentially identical except for the connector pinout on the one I bought, especially since they use the same U-Blok GPS module - the Grove module uses the U-Blok Neo-6M and mine uses the U-Blok Neo-7m.

The 7M is supposed to be a drop-in replacement for the 6M except that the 7M can use a wider constellation of GPS satellites, including the Russian GLONASS and the Chinese constellations.  (It’s also supposed to be more accurate, suitable for automotive and marine use.)

Eventually, (sometime in April), I’m going to get the latest version of the Grove-style GPS module and I’ll give that a try.

I tried it with a serial terminal and got no joy either since the commands to the GPS are long, (15 byte) encoded strings.

BTW, as far as I could tell the GPS sends strings back in response to a request for the string.  My big problem is I don’t have a Grove-to-Grove GPS pinout connector long enough to put it near a window where it can see satellites, as it may not do anything until it’s downloaded a current copy of the “Almanac” for the ephemera, and gotten a good satellite fix.

More research needs to be done.

1 Like

Progress is being made!

I finally got the GPS module I bought hooked up to a USB-Serial converter at 5v, and I’m getting comm.

This is three frames of data.  Normally it is a continuous stream, but I’ve added line-breaks to show the three frames distinctly.

$GPRMC,145447.00,A,5533.04892,N,03734.91268,E,0.339,,120325,,,A*79
$GPVTG,,T,,M,0.339,N,0.628,K,A*26
$GPGGA,145447.00,5533.04892,N,03734.91268,E,1,04,6.11,235.2,M,13.4,M,,*59
$GPGSA,A,3,26,23,16,10,,,,,,,,,9.97,6.11,7.88*07
$GPGSV,2,1,06,05,02,044,,10,37,199,31,16,39,240,25,23,70,142,28*7A
$GPGSV,2,2,06,26,19,218,29,27,51,292,22*7B
$GPGLL,5533.04892,N,03734.91268,E,145447.00,A,A*6E

$GPRMC,145448.00,A,5533.04905,N,03734.91305,E,0.280,,120325,,,A*70
$GPVTG,,T,,M,0.280,N,0.518,K,A*25
$GPGGA,145448.00,5533.04905,N,03734.91305,E,1,04,6.11,234.8,M,13.4,M,,*58
$GPGSA,A,3,26,23,16,10,,,,,,,,,9.96,6.11,7.87*09
$GPGSV,2,1,06,05,02,044,,10,37,199,31,16,39,240,25,23,70,142,28*7A
$GPGSV,2,2,06,26,19,218,30,27,51,292,23*72
$GPGLL,5533.04905,N,03734.91305,E,145448.00,A,A*64

$GPRMC,145449.00,A,5533.04896,N,03734.91327,E,0.161,,120325,,,A*76
$GPVTG,,T,,M,0.161,N,0.297,K,A*29
$GPGGA,145449.00,5533.04896,N,03734.91327,E,1,04,6.10,235.0,M,13.4,M,,*5A
$GPGSA,A,3,26,23,16,10,,,,,,,,,9.96,6.10,7.87*08
$GPGSV,2,1,06,05,02,044,,10,37,199,32,16,39,240,25,23,70,142,28*79
$GPGSV,2,2,06,26,19,218,30,27,51,292,23*72
$GPGLL,5533.04896,N,03734.91327,E,145449.00,A,A*6E

It appears that you are exactly correct and I bow my head in abject apology:  The GPS unit DOES establish comm on its own without messages from the host.  (Proved by starting a GPS session with the TXD line disconnected.)

Now that I know the GPS itself is working, (and I’m getting serial comm), I can now work backwards to the GoPiGo and get it working there.

There is a problem with the data though.  When I enter the coordinates into Google Maps, it seems to believe that I’m near a place called “Pine-Cone Forest[1]” instead of where I actually am.  I strongly suspect that I am probably interpreting it incorrectly.

Where the GPS thinks I am:  55.330497, 037.3493248. (These coordinates were taken about 15 minutes after the original frames of data).

This error could be caused by:

  • The lack of precision caused by the GPS being in a window.
  • The GPS needing more time to locate me accurately.
  • Or my needing to send a command to the GPS setting a location mode correctly.
     


 

Where I really am:  55.550906, 37.582185

 

==================== Footnotes ====================

  1. The place the GPS thinks I am at isn’t such a bad place.  Not only is it a nice forest, there’s a pretty boss resort near there!  I could do far worse.
1 Like

I posed this question to the folks at Seeed Studios and this is their reply:

I have one of the new Air530 GPS modules on order.

Air530 GPS module
 

The new one, (the Air530), is supposed to be a drop-in compatible replacement for the original.  It’s interesting to note that the main GPS chip, (assembly), is now a totally different assembly from a totally different manufacturer.

ETA some time in April from China, and I will test it then.

The one I have appears to be identical to the original, except for the connector not being a Grove connector and it has a different pinout - ergo it should work if I can get the interface figured out.

We will see what we will see when the new one comes in.

1 Like

Yes, I am anticipating that it will be just a “simple” programming task. (:man_facepalming:)

What puzzles me is:
If the Raspberry Pi requires such a setup, and the GoPiGo OS is supposed to be compatible "out-of-the-box, why doesn’t it work?  Or why isn’t it pre-configured?

Research is ongoing.

P.S.
I left it plugged into a +5v source all last night, (in the window), to see if the accuracy would improve.

1 Like

Didn’t @KeithW mess with the GPS awhile ago at his new place in Pennsylvania?

I wonder how he got the accuracy working?

1 Like

For those of you who are interested, this page describes what all that gibberish means. :wink:

https://www.rfwireless-world.com/Terminology/GPS-sentences-or-NMEA-sentences.html

1 Like

There’s another possibility:

  • The coordinates are in a format I’m not expecting.

It turns out that NEMA coordinates are in degrees and decimal minutes where the minutes are modulo 100 not modulo 60.  (i.e. There are 60 minutes in a degree, not 100.)  Therefore I have to take the minutes portion and divide it by 60 to get modulo-60 minutes.

Viz.:
NEMA latitude is formatted as ±DDMM.mmmmmm  (Plus is north, minus is south.)
NEMA longitude is formatted as ±(D)DDMM.mmmmmm  (Plus is east, minus is west.)

To convert 5533.04896,N,03734.91327,E to decimal minutes:

  1. Split out the two numbers:

    • 5533.04896
    • 03734.91327
  2. Extract the degrees part of the number:
    (There are always two digits of “minutes” to the left of the decimal.  Anything beyond that is the “degrees” part.)

    • 5533.04896 becomes 55 degrees and 33.04896 decimal minutes. (latitude)
    • 03734.91327 becomes 037 degrees and 34.91327 minutes. (longitude)
  3. Divide the minutes by 60:

    • 33.04896 decimal minutes divided by 60 equals 0.550816 decimal degrees
    • 34.91327 decimal minutes divided by 60 equals 0.581888 decimal degrees (rounded to 6 decimal digits).
  4. Re-add the degrees to the decimal minutes:

    • 0.550816 + 55 = 55.550816 (decimal degrees of latitude).
    • 0.581888 + 037 = 037.581888 (decimal degrees of longitude).
  5. Plug the numbers into Google maps:

    • Format to “55.550816, 037.581888”
    • Copy the string and plug it into Google Maps.

coordinates in google maps
 

Google automagically converts to D:M:S.ssss format.
Note that this data was taken early on after starting the GPS and it shows me about 5 meters from where I am. (the lower right-hand corner of the boxes above where the red mark is)

Correction:
I’m in the lower right had corner of the smaller rectangle.  The bottom image is within about 2 meters of where I actually am.

Doing the same with later data yields:

NEMA coordinates of 5533.05173,N,03734.94109,E becomes
55.550862 (North latitude)
037.582351 (East longitude)

55.550862, 037.582351 pasted into Google Maps yields:


 

Oops, that’s not correct either!  Ahh!  The GPS fell out of the window and was sitting under my desk. . .

Try again using 5533.05397,N,03734.93610,E - which becomes:
55.5508995 North latitude
037.582268 East longitude

55.5508995, 037.582268 pasted into Google Maps:


 
Well. . . At least I’m not in Cone Forest!

It looks like I’m getting an error of about a 3 - 5 2 - 3 meter radius. Earlier I tried it and it got me right on the money. . . then I un-plugged it.

It seems to want a period of time to settle down.

One of these days, I’m going to take it outside and see what happens compared to being in a window.
 

That happens in the US too, depending on where you are.  Especially on Cape Cod where the entirety of the Cape is being sprayed with the output of a ground-installation of a gigantic over-the-horizon PAVE-TAC Phased-Array radar near the Sagamore bridge.

I’ve been in Florida when my GPS suddenly decided I was in Louisiana.  Likewise, the mountains of West Virginia can play hob with GPS signals too.

In this case, my phone has me right on the money.  Now that I’ve corrected the coordinate system, I’m at least still in my front yard.

1 Like

I have no idea, I wasn’t paying attention as I was trying to get the data to be reasonably correct.

1 Like

More success!

I now have serial data on Minicom (after setting the correct serial port and baud rate).

Bloxter still can’t see the GPS.

The software that wants to use the GPS uses a library “easygps”, but the easygps library has no method “read” which is required by other methods, so it always fails.

easygps.py (8.8 KB)

I’m going to have to find a serial-read routine somewhere to include in the easygps library.

1 Like

I found a “read” routine in another library.

If necessary I will import it into the GPS library(ies) and submit a pull request.

I’m getting close:

Note the raw data received in Thonny’s terminal window.  It’s horrible data because the GPS isn’t’ in a window and has no satellite lock.

What appears to be happening is that the GPS read is expecting a very specific format of a “GPGGA” sentence which isn’t happening.  I added a line where it prints the raw data received, prior to filtering, and you can see I’m getting data.  Crummy data because I’m nowhere near a window with the GPS, but I’m getting data.

What I need to do is generalize the data filtering so that any additional characters, (the "b’ " in this case), don’t contaminate the filtering process.

Viz.:

  1. Capture a raw string.
  2. Look within the first ten characters for the string “GPGGA”.
    • If that string is found, strip off anything before the first “G”, and return it as a valid string.
    • If not, go back to step 1.
  3. Parse the valid string and print it.
  4. Go back to step 1.

Next steps:
Research substrings in Python.

1 Like