SimpleRTK2B-LR rover connection to Raspberry pi 3B+ error

Q&A forumCategory: QuestionsSimpleRTK2B-LR rover connection to Raspberry pi 3B+ error
harsadhani asked 6 days ago

I have set the base, then configurde Raspberry pi in headless mode with wifi to control over laptop
Then I connected Raspberry pi USB to POWER+GPS in Rover board (The adapter board is not available in stock in US and I used raspi camera).
I typed these codes as in your tutorial to connect the board to Raspberry pi:
#!/usr/bin/env python
import time
import serial
ser = serial.Serial (
port=’/dev/serial0′,
baudrate = 38400,
parity=serial.PARITY_NONE,
stopbits=serial.STOPBITS_ONE,
bytesize=serial.EIGHTBITS,
timeout=1
)
counter=0
while 1:
x=ser.readline()
print x
Then, I got this error:
Traceback (most recent call last):
  File “test.py”, line 13, in <module>
    timeout=1
  File “/home/pi/.local/lib/python2.7/site-packages/serial/serialutil.py”, line 244, in __init__
    self.open()
  File “/home/pi/.local/lib/python2.7/site-packages/serial/serialposix.py”, line 325, in open
    raise SerialException(msg.errno, “could not open port {}: {}”.format(self._port, msg))
serial.serialutil.SerialException: [Errno 13] could not open port /dev/serial0: [Errno 13] Permission denied: ‘/dev/serial0’
 
How to solve this problem? Appreciate if you give a detail instruction.
Thank you very much.

harsadhani replied 6 days ago

With lsusb command, I got:
Bus 001 Device 004: ID 1546:01a9 U-Blox AG
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. SMSC9512/9514 Fast Ethernet Adapter
Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. SMC9514 Hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub

harsadhani replied 6 days ago

pi@raspberrypi:~ $ dmesg | grep 1546
[ 2.894536] usb 1-1.2: New USB device found, idVendor=1546, idProduct=01a9, bcdDevice= 1.00
pi@raspberrypi:~ $ dmesg | grep ‘usb 1-1.2’
[ 2.762018] usb 1-1.2: new full-speed USB device number 4 using dwc_otg
[ 2.894536] usb 1-1.2: New USB device found, idVendor=1546, idProduct=01a9, bcdDevice= 1.00
[ 2.894557] usb 1-1.2: New USB device strings: Mfr=1, Product=2, SerialNumber=0
[ 2.894573] usb 1-1.2: Product: u-blox GNSS receiver
[ 2.894585] usb 1-1.2: Manufacturer: u-blox AG – http://www.u-blox.com

Still do not know how to replace: port=’/dev/serial0′, no ttyUSB listed

Ardusimple Staff replied 5 days ago

Hi harsadhani,
Yes if you are using native usb (instead of the raspberry pi uart) the serial descriptor will be different.
You should be able to list your serial device with the following command, and replacing the port=’/dev/serial0′ by your gps usb board.

*** Extract from https://pyserial.readthedocs.io/en/latest/tools.html ***
$ python -m serial.tools.list_ports -v
/dev/ttyS0
desc: ttyS0
hwid: PNP0501
/dev/ttyUSB0
desc: CP2102 USB to UART Bridge Controller
hwid: USB VID:PID=10C4:EA60 SER=0001 LOCATION=2-1.6
2 ports found
***

harsadhani replied 4 days ago

Hi,
Thank you very much. It is work with that command.
pi@raspberrypi:~ $ python -m serial.tools.list_ports -v
/dev/ttyACM0
desc: u-blox GNSS receiver
hwid: USB VID:PID=1546:01A9 LOCATION=1-1.2:1.0
/dev/ttyAMA0
desc: ttyAMA0
hwid: 3f201000.serial
2 ports found

I changed /dev/serial0 with /dev/ttyACM0 and it worked.

However, it gives these lines:
$GNRMC,212820.00,A,3327.39546,N,08849.07048,W,0.058,,060421,,,A,V*0F

$GNVTG,,T,,M,0.058,N,0.107,K,A*36

$GNGGA,212820.00,3327.39546,N,08849.07048,W,1,08,1.14,118.4,M,-29.5,M,,*76

$GNGSA,A,3,03,14,17,28,06,02,,,,,,,2.13,1.14,1.79,1*04

$GNGSA,A,3,74,85,84,,,,,,,,,,2.13,1.14,1.79,2*0B

$GNGSA,A,3,,,,,,,,,,,,,2.13,1.14,1.79,3*08

$GNGSA,A,3,,,,,,,,,,,,,2.13,1.14,1.79,4*0F

$GPGSV,3,1,09,02,26,223,24,03,23,066,39,06,62,216,28,12,00,311,,1*69

$GPGSV,3,2,09,14,53,117,44,17,57,024,37,22,09,044,37,28,60,107,40,1*6D

$GPGSV,3,3,09,30,12,176,17,1*5B

$GPGSV,3,1,09,02,26,223,,03,23,066,33,06,62,216,,12,00,311,,6*68

$GPGSV,3,2,09,14,53,117,33,17,57,024,27,22,09,044,,28,60,107,,6*6B

$GPGSV,3,3,09,30,12,176,,6*5A

How to get only Longitude and Latitude (in cm accuracy)?
I will use them in my program to move the robot to waypoints.
Thank you very much.

Ardusimple Staff replied 4 days ago

Hi harsadhani,
That’s great to hear that you could start receiving data. This is NMEA protocol, from each message you can read the required information like position and satellite strength. You will have to implement a parser, you might want to start with the gpsd library: https://gpsd.gitlab.io/gpsd/

harsadhani replied 3 days ago

Thank you very much. It is a great start, but seems like a lot of work to do.