groveGPS not working with grovepi+

Not sure if this should be in the raspberry board or the grove board.



I have a raspberry pi with a grovepi on top. I have tried to use two different grovepi boards, and two different groveGPS sensors. I am getting no readings from either of these devices.



I have tried tthe code available on the Seeed site, as well as the code from the Dexter GitHub.



http://wiki.seeedstudio.com/Grove-GPS/



<LINK_TEXT text=“https://github.com/DexterInd/GrovePi/tr … /grove_gps”>https://github.com/DexterInd/GrovePi/tree/master/Software/Python/grove_gps</LINK_TEXT>



I have made changes to the code, such as including brackets around print statements because: python3. The unaltered ‘hardware test’ code from Dexter, the simplest was to access the groveGPS, throws an error:

TypeError: Can’t convert ‘bytes’ object to str implicitly

This error ‘may’ be solved by using </s>rv=b""<e> or </s> rv+=repr(ch)<e> but since I never get any data, I have no idea if this is working.



The groveGPS module is connected to the RPISER connection on the grovepi board. I have found some older posts which mention that UART has to be disabled/enabled. My original problem had been that my bluetooth mouse stopped working when accessing the GroveGPS module, but other posts have indicated bluetooth shares the ttyAMA0 serial connection. This fact should perhaps be in the documentation so it doesn’t cause quite as much frustration as it did me. I wasted two days trying to track that down before giving up and using a wired keyboard/most



What I would like to know is HOW CAN I GET THIS GPS TO WORK? I am getting no data inside or outside. I have not altered this current raspberry pi setup except to install the Adafruit_GPIO to get a Grove Barometer 280 to work. It has been over a week of frustration trying to get these groveGPS modules to generate any kind of data.



I have found this older forum post that implies one has to enable/disable serial (<LINK_TEXT text=“https://forum.dexterindustries.com/t/rp … ensor/1650”>https://forum.dexterindustries.com/t/rpi3-grovepi-and-grove-gps-sensor/1650</LINK_TEXT>), but I have flashed this raspberry pi card three times in the past week and don’t want to futz with it any more. Could you explain if this enabling is necessary, and please put it in the documentation if it is necessary? Having GPS as part of this project, recorded alongside the other sensor data would be a lot easier than trying to merge Strava GPS data.

I would like some hints as to how to get the GPS working before this weekend. I have already lost a week due to it not working properly.



Do I have to do something with enabling/disabling the serial port?

I have bought a new raspberry pi, just in case there was some kind of communications error, also a new non-bluetooth keyboard (logitech) to avoid the ttyAMA0/bluetooth problems.



So far I have tried two groveGPS sensors, two grovePi boards and two raspberry pi computers. The hardware test, simply printing what is coming directly form the GPS as data has nothing.



This current setup is vanilla raspbian stretch with Adafruit_Python_GPIO installed and Adafruit_Python_BME280 to get barometer information.



This ‘should’ work, right? I have not touched the UART for raspbian stretch as that solution was from a few years ago.



any insight would help. I can get data from the light sensor, sound level, temp.humidity/barometer280, displaying the GPS on the groveLCD but I get nothing from the groveGPS. All this is saved to a file but I am getting no data from the GPS.

Hi there,



Please try to add the usb to serial adapter and connect to the GND/TX/RX pin of raspberrry and see if any data. thanks.



best rgds

Bill

Thank you Bill. I do not have a serial to usb adapter.



I found a solution:



Here is what I have done:

  1. Latest Raspbian Stretch, 2.4 June 2018. update, upgrade
  2. install Dexter Libraries & stuff using the curl method
  3. Update the grovePi firmware.
  4. turn off Bluetooth on the upper right
  5. open raspi-config
  6. interfacing options -P6 serial - no to login shell - yes to hardware port enabled.



    in the grove_gps_hardware_test.py code, change ttyAMA0 to serial0.
    </s>ser = serial.Serial('dev/serial0', 9600, timeout = 0)<e>
    Use decode, as in
    </s>ch=ser.read.decode()<e>
    there was some confusion as the latest Raspbian python (3.?) would say TypeError: can’t convert ‘bytes’ object to str implicitly



    Changing </s>rv=""<e> to </s>rv=b""<e> would solve that problem, but the information could not be parsed as a string since rv was now a byte. Adding decode changes the serial byte info to a string, letting it be parsed.



    The library I used was the groveGPS with these changes. It seems to work. It was the easiest to understand for myself.



    I am unsure if this is the best way to solve this problem but it appears to work for me. It may not for those who want to log in using serial…

Python makes a clear distinction between bytes and strings . Bytes objects contain raw data — a sequence of octets — whereas strings are Unicode sequences . Conversion between these two types is explicit: you encode a string to get bytes, specifying an encoding (which defaults to UTF-8); and you decode bytes to get a string. Clients of these functions should be aware that such conversions may fail, and should consider how failures are handled.

We can convert bytes to string using bytes class decode() instance method, So you need to decode the bytes object to produce a string. In Python 3 , the default encoding is “utf-8” , so you can use directly:

b"python byte to string".decode("utf-8")