Hi guys i’m quite new to raspberry pi and i’m having trouble with a GPS module that i have bought. https://wiki.52pi.com/index.php/USB-Port-GPS_Module_SKU:EZ-0048#Trouble_Shooting i go to installing all the packages required for the module and begin to testing the to see if it picks up a latitude/longitude and this is what occurs.
when i check the status of the module it seems to be fine showing the following:
However lastly when i check the serial to see if it is receiving any data this occurs
i have been at this for hours and i’m not sure if the module itself is the problem or its me. If anyone can help that would be great
Do you have it connected via serial port, or via USB? – Seamus Jun 2 at 7:20
i did tried both of these and got no results. im sticking with the usb as it is easier to handle – Antos Jun 2 at 7:32
Good choice! Your antenna is outdoors I assume? – Seamus Jun 2 at 7:33
yeah i have been sitting outside for while, it is very cloudy, i have gotten the time to show up and it updates correctly, from the first screen shot, however the rest is the same. – Antos Jun 2 at 7:40
Ah, let me see. There are many possibilities: (1) Your serial hardware might not have been properly set up. I would recommend first do a serial loopback test. (test program included in my answer to the following question: “Rpi UART GPSD to GPS Module Connection Problem”: raspberrypi.stackexchange.com/questions/98840/…, (2) The signal in your place is too weak, or too noisy. You might like to use a long antenna, and also use lipo power bank to reduce noise. You might like to compare how I use GPSD. – tlfong01 Jun 2 at 7:41
1Thanks for the advice, i received a long antenna device today and have i might hook it up tomorrow when its a clear day, ill have a look at your thread as well, for the price the module i bought is “garbo” – Antos Jun 2 at 7:47
As I suggested in my answer, you don’t need to first connect Rpi UART in the preliminary setting up. In other words, your first step is (1) Try to get a “fix”, to make the blue LED blinking. The second step is (2) To make sure serial is OK by doing loopback test to make sure that USB or on board Serial is working, then (3) Install GPSD and try the basic tests CGPS and XGPS (See Appendix M to compare my e sample output). Good luck, cheers. – tlfong01 Jun 2 at 8:21
Please don’t post pictures of text. Instead paste the text direct into the question. – Ingo Jun 2 at 10:34
And if you have completed all the above three steps, getting data from the GPS module, then perhaps you can do (4) Use python, instead of CGPS and CGPS utilities, to store and process the GPS text and graphics data. I saw that your last two screen captures seem to dig into the ttyUSB and socket thing, which I think is too low level, too tedious, too messy to explore. Of course it is just my opinion, and I am a newbie in GPS, after all, though I have about 5 hobbyist years playing with Rpi. – tlfong01 Jun 2 at 13:31
Hi @antos. I am sorry that before I made my answer, I did not read the troubleshooting guide you are referring. Just now I read it again and found that you are doing what the guide says, playing at the socket level. I need to read that guide again and see if I can make more comments. Cheers. – tlfong01 Jun 2 at 13:38
I read the Quectel L80-R setup and troubleshooting guide and found that they are also using GPSD (I am not surprised, because GPSD is a well developed huge project and so everybody is using it). The python examples are also good, I need to read carefully one more time to see if I can give more comments. PS – My setup though also using GPSD, but then CGPS and XGPS etc, which is not the way the L80-R guide goes. So I think it is not a good reference for you to use pythong to get data. / to continue, … – tlfong01 Jun 2 at 13:56
Though my first suggested steps are still good, get a fix first, check serial (the guide uses a direct check at socket level) is still good. Below are the docs I read so far: (1) Quectel L80-R USB-Port-GPS Module SKU:EZ-0048 wiki.52pi.com/index.php/… (2) L80-R Hardware Design GPS Module Series Rev. L80-R_Hardware_Design_V1.2 Date: 2016-04-22 wiki.52pi.com/images/e/ed/…, to continue, … – tlfong01 Jun 2 at 14:01
(3) Quectel L80-R Compact GPS Module Integrated with Patch Antenna wiki.52pi.com/images/7/73/…. / to continue, … – tlfong01 Jun 2 at 14:03
I casually searched AliExpress and found the following product page, but no document at all. Please let me know if you have other good links with good docs. “AliExpress 2pcs/lot DIYmall Quectel L80-R Compact GPS module integrated with Patch antenna for Acquisition and tracking – US$14”: aliexpress.com/i/33021219197.html. Cheers. – tlfong01 Jun 2 at 14:10
I was using the following module:(4) “AliExpress GPS + Beidou Two-mode positioning module – US$24”: fr.aliexpress.com/item/32978748359.html. But I have not played with it for a long while. Let me see if I can find it in my junk box and set it up and start playing again. Ah bed time, see you tomorrow. – tlfong01 Jun 2 at 14:21
1@tlfon01 yeah thanks for all the help i’m going to read and go through what you initially sent now, and i’m going to give another go outside today, ill find somewhere out in the open and give it a go. ill keep you updated, ill be working on this thing the entire day today – Antos Jun 3 at 1:15
1@tlflon, yes i finally got a fix with another hour or so playing around. i did some extra research and apparently GPS modules do not work well with tin and tin roofing. since that being everyones roof in my area, after some walking around outside i finally got a fix, not completely ideal but at-least i now know it works. Thanks so much for all the resources they truly helped. Have a good day! – Antos Jun 3 at 2:06
How nice to hear the good news. My test site is some 20 metres down a concrete well. I guess there are mild steel rods within the concrete walls, but radio signals can penetrate with no problem. – tlfong01 Jun 3 at 3:40
How can Rpi GPSD python talk to the QueCte L80-R GPS Module?
/ to continue, …
/ to continue, …
- Part A – Setting up the module and trying a get a fix
- Part B – Checking out serial hardware /dev/ttyS0 and /dev/ttyUSB0
- Part C – Installing GPSD and testing utilities gpsmon, cgps, and xgps
- Part D – Installing GPS Python library and testing python NMEA 0183 programs
- Part E – Discussion and recommendation
- Program Listings
Part A – Setting up the GPS module and trying to get a fix
First thing first is to set up the GPS module and try to get a fix (Figures 1 ~ 3).
I placed the antenna about 15cm outside the window and powered up. As usual, the first fix takes about 1 to 2 minutes. The subsequent power off power on fixes takes from 15 sec to 45 sec, with an average of 30 seconds. This fixing timing is similar to last time of 2019may. So I quickly concluded that setup and fixing is reliable.
This is the imgur fixing video.
And the photo.
- When power is on, blue LED is turned on and steady. When there is a fix, blue LED blinks as shown in the above Imgur video.
- The serial cable is not connected in this fixing test. Serial cable test is the next step.
Part B – Checking out the serial cable
I used my serial loopback program v0.99 (Ref 12) to verify that Rpi’s on board Tx/Rx wiring and software are more or less OK.
Next step is to install GPSD.
Part C – Installing GPSD
I quickly read the Quectel L80RE GPS Module User Guide and follow the instructions there to install the following:
gpsd, gpsd-clients, and python-gps,
and starting running it. Everything was smooth, except a couple of errors during installation. I could enable, start, status without any problem but cgps does not seem to run properly, such as indicating no fix, though there are actually a fix.
The above installations using CLI terminal commands $sudo apt-get install were not smooth, with a couple of error messages. So I used buster Desktop GUI and installed the similar gpsd and client packages v3.17-7 as shown below:
Part D – Installin GPS Python library and testing python demo programs
(15) Quectel GPS Module User Guide Reading Summary V0.3 (Python Demo Programs)
/ to continue, …
(1) Quectel L80-R GPS Module User Guide
(2) Quectel L80-R Hardware Design GPS Module Series Rev. L80-R_Hardware_Design_V1.2 Date: 2016-04-22
(3) Quectel L80-R Compact GPS Module Integrated with Patch Antenna
(4) Quectel L80-R Compact GPS module integrated with Patch antenna for Acquisition and tracking – DIYMall US$14
(5) SkyTraq ATK1218-BD (ATK-S1216) GPS/BD dual mode GPS module – Risym ¥98
(6) SkyTraq GPS + Beidou Two-mode positioning module – US$24
(7) SkyTraq Products – SkyTraq
(8) SkyTraq S1216 [renamed S1218-BD] Family GNSS Module Data Sheet – SkyTraq
(9) Serial Port Loopback Test Program V0.60 – tlfong01 2019apr15 Ask Question
(10) Serial LoopBack Program v0.98 -tlfong01 2020jan08
(11) Serial Port Multiple Problem
(12) Serial UART LoopBack Program v0.99 tlfong01 2020jun03hkt1510
(14) NMEA User Guide
(15) gpsd_json — gpsd request/response protocol
(16) gpsd(8) manual pages
(18) gspmon manual pages – ubuntu
(19) gpsmon forum discussion – rpi.org.forum
(20) BerryGPS Tutorial Setup Guide
(21) MakerPro Daniel Hertz Tutorial: How to Use a GPS Receiver With Rpi 4 – 2020feb03
(22) MakerPro Daniel Hertz Tutorial: How to read GPS data with Python on Rpi – Daniel Hertz, MakerPro 2020feb24
(100) Rpi UART GPSD to GPS Module Connection Problem – Rpi.SE.Q&A tlfong01 2019may22
(101) Quectel GPS Module User Guide Reading Summary V0.1
(102) Quectel GPS Module User Guide Reading Summary V0.2
(103) Quectel GPS Module User Guide Reading Summary V0.3 (Python Demo Programs)
/ to continue, …
Appendix A – GPS Module Pinout and Block Diagram
Appendix B – NMEA 0183 Message Format
Appendix C GPSD Commands Summary V0.1
$ dmesg | grep tty [ 0.001609] console [tty1] enabled [ 0.092061] 3f201000.uart: ttyAMA0 at MMIO 0x3f201000 (irq = 87, base_baud = 0) is a PL011 rev2 [ 0.594855] console [ttyAMA0] enabled
ttyS0 = Serial for Raspberry Pi 3, ttyAMA0 = Serial for all other Raspberry Pi ‘serial0’ is assigned as an alias to either of the above devices. This makes the device a lot easier to remember.
pi@raspberrypi ~ $ ls -l /dev/serial0 lrwxrwxrwx 1 root root 5 Aug 28 12:49 /dev/serial0 -> ttyS0
$ sudo apt-get update $ sudo apt-get upgrade $ sudo reboot $ sudo apt-get install gpsd-clients gpsd -y $ usdo apt-get install gpsmon
To enable/start/stop/disable/kill gpsd
$ sudo systemctl enable gpsd.socket $ sudo systemctl start gpsd.socket $ sudo systemctl stop gpsd.socket $ sudo systemctl disable gpsd.socket $ sudo killall gpsd
Gpsd config file
$ sudo nano /etc/default/gpsd Look for DEVICES=”” and change it to DEVICES=”/dev/serial0″
3 Ways To read GPS data
1. cat $ cat /dev/serial0
$ sudo apt-get install minicom -y $ minicom -b 9600 -o -D /dev/serial0
$ sudo apt-get install screen $ screen /dev/serial0 9600
To view GPS data with gpsmon or cgps, if gpsd not aut started at boot
$ sudo gpsd /dev/serial0 -F /var/run/gpsd.sock $ sudo gpsmon $ sudo cgps $ sudo xcgs
To profile on a GPS. A gnuplot scatter graph of 100 samples
$ gpsprof | gnuplot -persist
A summary of some NMEA sentences
$GPVTG Vector track and Speed over the Ground
$GPGGA GGA – essential fix data which provide 3D location and accuracy data.
$GPGLL GLL – Geographic Latitude and Longitude
$GPGSA GSA – details on the nature of the fix
$GPGSV Detailed satelite data
$GPRMC RMC – The recommended minimum
/ to continue, …
(A) Serial Lookback Test v0.6 – 2019apr08 tlfong01
# uart_test06 tlfong01 2019apr08hkt1603 *** # https://raspberrypi.stackexchange.com/questions/96534/rpi-python-serial-test-program/96535#96535 # uart_test06 tlfong01 2019apr08hkt1603 *** # Computer = Rpi3B+ # Linux = $ hostnamectl = raspberrypi Raspbian GNU/Linux 9 (stretch) Linux 4.14.34-v7+ arm # Python = >>> sys.version = 3.5.3 Jan 19 2017 # Test 1 - repeatWriteBytes() - UART port repeatedly send out bytes. # Function - Repeat many times sending bytes, pause after each bytes. # Test 2 - loopBackTest() - UART port send and receive bytes. # Function - Send one bytes to TX, wait some time (Note 1), then read bytes back from RX. # Setup - Connet Tx pin to Rx pin to form a loop. # Note 1 # Bolutek BlueTooth BC04 needs at least 10mS to respond from time import sleep import serial serialPort0 = serial.Serial(port = '/dev/serial0', baudrate = 9600, parity = serial.PARITY_NONE, stopbits = serial.STOPBITS_ONE, bytesize = serial.EIGHTBITS, timeout= 1) def setSerialPortBaudRate(serialPort, baudrate): serialPort.baudrate = baudrate return def serialPortWriteBytes(serialPort, writeBytes): serialPort.write(writeBytes) return def serialPortReadBytes(serialPort, maxBytesLength): readBytes = serialPort.read(maxBytesLength) return readBytes def serialPortWriteWaitReadBytes(serialPort, writeBytes, maxBytesLength, waitTime): serialPort.flushInput() serialPort.flushOutput() serialPort.write(writeBytes) sleep(waitTime) readBytes = serialPortReadBytes(serialPort, maxBytesLength) print(' bytes written = ', writeBytes) print(' bytes read = ', readBytes) return readBytes def repeatWriteBytes(serialPort, writeBytes, pauseTimeBetweenBytes, repeatCount): print(' Begin repeatWriteOneByte(), ...') for i in range(repeatCount): serialPortWriteBytes(serialPort, writeBytes) sleep(pauseTimeBetweenBytes) print(' End repeatWriteOneByte().') return def serialPortLoopBack(serialPort, writeBytes, maxBytesLength, waitTime): print(' Begin serialPortLoopBack() [Remember to connect Tx to Rx!] , ...') serialPortWriteWaitReadBytes(serialPort, writeBytes, maxBytesLength, waitTime) print(' End serialPortLoopBack(), ...') return setSerialPortBaudRate(serialPort0, 9600) #repeatWriteBytes(serialPort0, b'AT\r\n', 0.01, 200000000) serialPortLoopBack(serialPort0, b'AT\r\n', 32, 0.030) ''' Sample output tlfong01 2019apr0801 >>> === RESTART: /home/pi/Python_Programs/test1193/uart_test02_2019apr0801.py === Begin serialPortLoopBack() [Remember to connect Tx to Rx!] , ... bytes written = b'AT\r\n' bytes read = b'AT\r\n' End serialPortLoopBack(), ... >>> ''' # End
/ to continue, …
Fig 1 – GPS Module Setup 1
Fig 2 – GPS Module Setup 2
Fig 3 – GPS Module Setup 3
Fig 4 – GPS Testing Site
cat /dev/ttyUSB0 will only work if the baud rate is set correctly on both sides of the UART which may or may not be the case. Check the documentation for your module to see if there are any instructions regarding the baud rate settings.
Also, cheap GPS modules are not going to give you any meaningful data until they acquire a fix, and must be tested outside. Do a test outdoors, preferably with a laptop, and wait for at least 12.5 minutes before trying to communicate with the module.