Uncategorized

GPS Notes

Asked 
Active today
Viewed 63 times
1

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.

enter image description here

when i check the status of the module it seems to be fine showing the following:

enter image description here However lastly when i check the serial to see if it is receiving any data this occurs

enter image description here 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

share  edit  follow  close  flag
 New contributor
  • Do you have it connected via serial port, or via USB? – Seamus 2 days ago
  • i did tried both of these and got no results. im sticking with the usb as it is easier to handle – Antos 2 days ago
  • Good choice! Your antenna is outdoors I assume? – Seamus 2 days ago
  • 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 2 days ago
  • 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 2 days ago   
  • 1
    Thanks 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 2 days ago
  • 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 2 days ago    
  • Please don’t post pictures of text. Instead paste the text direct into the question. – Ingo yesterday
  • 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 yesterday   
  • 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 yesterday   
  • 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 yesterday    
  • 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 yesterday    
  • (3) Quectel L80-R Compact GPS Module Integrated with Patch Antenna wiki.52pi.com/images/7/73/…. / to continue, … – tlfong01 yesterday   
  • 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 yesterday   
  • 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 yesterday   
  • 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 yesterday
  • 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 yesterday
  • 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 yesterday    

2 Answers

-1

Question

How can Rpi GPSD python talk to the QueCte L80-R GPS Module?


quecte gps


/ to continue, …


Answer


Short Answer

/ to continue, …


Long Answer

Contents

  1. Part A – Setting up the module and trying a get a fix
  2. Part B – Checking out serial hardware /dev/ttyS0 and /dev/ttyUSB0
  3. Part C – Installing GPSD and testing utilities gpsmon, cgps, and xgps
  4. Part D – Installing GPS Python library and testing programs
  5. Part E – Discussion and recommendation

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.

Notes:

  1. 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.
  2. The serial cable is not connected in this fixing test. Serial cable test is the next step.

gps antenna


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.

gpsd install


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:


gpsd and clients installation


setup1


setup2


setup3


setup4


setup5

References

(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

(13) Quectel GPS Module User Guide Reading Summary V0.1


(100) Rpi UART GPSD to GPS Module Connection Problem – Rpi.SE.Q&A tlfong01 2019may22

/ to continue, …


Appendices

Appendix A – GPS Module Pinout and Block Diagram

gps module pinout

/ to continue, …


Program Listings

(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, …


Figures

Fig 1 – GPS Module Setup 1

gps setup 2


Fig 2 – GPS Module Setup 2

gps setup 3


Fig 3 – GPS Module Setup 3

gps setup 4


Fig 4 – GPS Testing Site

gps test site


share  edit  delete  flag

1

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.

share  edit  follow  flag

Categories: Uncategorized

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: