bowen73
Posts: 25
Joined: Mon Jan 16, 2017 2:10 pm

Waveshare GSM/GPRS/GNSS Bluetooth HAT Expansion Board GPS Module SIM868

Tue Jul 28, 2020 2:45 pm

Does anyone have any experience with this HAT??
https://www.amazon.co.uk/gp/product/B07 ... UTF8&psc=1

I have it installed on a Pi Zero W

Ive tried their help on their website www.waveshare.com/wiki/GSM/GPRS/GNSS_HAT as well as various searches to try and get somewhere but keep falling flat.

All i have managed to do is make a call via a Python script. I cannot get it to send a text or get the gps to 'work'. Ive not even attempted the bluetooth

I have tried

Code: Select all

cgps -s
and after a little while showing a screen with no data it stops and return

Code: Select all

cgps: GPS timeout
when i run their gps.py demo it returns something that makes no sense and ends in an error:

Code: Select all

pi@raspberrypi:~/gps-tracker $ python gps.py
AT+CGNSPWR=1
OK

$GNGGA,142640.000,5259.109620,N,00209.512906,W,2,14,0.73,129.011,M,48.385,M,,*6A
$GPGSA,A,3,11,17,32,28,22,03,01,08,,,,,1.03,0.73,0.72*06
$GLGSA,A,3,71,85,70,72,79,87,,,,,,,1.03,0.73,0.72*15
$GPGSV,3,1,11,01,83,076,36,22,80,190,20,03,57,223,31,11,52,137,52*72
$GPGSV,3,2,11,17,30,310,26,32,30,053,46,28,27,272,25,36,22,140,46*70
$GPGSV,3,3,11,08,19,161,41,19,09,317,,04,02,180,28*4B
$GLGSV,3,1,09,71,74,103,33,87,42,315,15,72,38,194,19,70,30,039,27*62
$GLGSV,3,2,09,78,15,321,,85,13,128,30,79,10,011,24,88,05,310,*6F
$GLGSV,3,3,09,77,01,274,*5C
$GNRMC,142640.000,A,5259.109620,N,00209.512906,W,0.00,294.54,280720,,,D*66
$GNVTG,294.54,T,,M,0.00,N,0.00,K,D*28

AT+CGNSSEQ="RMC"
OK

AT+CGNSINF
+CGNSINF: 1,0,20200728135716.000,,,,0.15,0.0,0,,,,,,12,0,,,,,

OK
$GNGGA,142641.000,5259.109620,N,00209.512906,W,2,13,0.78,129.011,M,48.385,M,,*67
$GPGSA,A,3,11,17,32,28,22,03,01,08,,,,,1.06,0.78,0.72*08
$GLGSA,A,3,71,85,72,79,87,,,,,,,,1.06,0.78,0.72*1C
$GPGSV,3,1,11,01,83,076,36,22,80,190,20,03,57,223,30,11,52,137,52*73
$GPGSV,3,2,11,17,30,310,26,32,30,053,46,28,27,272,25,36,22,140,46*70
$GPGSV,3,3,11,08,19,161,40,19,09,317,,04,02,180,28*4A
$GLGSV,3,1,09,71,74,103,33,87,42,315,15,72,38,194,19,70,30,039,*67
$GLGSV,3,2,09,78,15,321,,85,13,128,30,79,10,011,24,88,05,310,*6F
$GLGSV,3,3,09,77,01,274,*5C
$GNRMC,142641.000,A,5259.109620,N,00209.512906,W,0.00,294.54,280720,,,D*67
$GNVTG,294.54,T,,M,0.00,N,0.00,K,D*28

AT+CGNSURC=2
OK
AT+CGNSTST=1
OK
$GNGGA,142642.000,5259.109620,N,00209.512906,W,2,13,0.78,129.011,M,48.385,M,,*64
$GPGSA,A,3,11,17,32,28,22,03,01,08,,,,,1.06,0.78,0.72*08
$GLGSA,A,3,71,85,72,79,87,,,,,,,,1.06,0.78,0.72*1C
$GPGSV,3,1,11,01,83,076,36,22,80,190,19,03,57,223,31,11,52,137,52*78
$GPGSV,3,2,11,17,30,310,26,32,30,053,46,28,27,272,26,36,22,140,46*73
$GPGSV,3,3,11,08,19,161,40,19,09,317,,04,02,180,29*4B
$GLGSV,3,1,09,71,74,103,34,87,42,315,15,72,38,194,18,70,30,039,29*6A
$GLGSV,3,2,09,78,15,321,,85,13,128,30,79,10,011,24,88,05,310,*6F
$GLGSV,3,3,09,77,01,274,*5C
$GNRMC,142642.000,A,5259.109620,N,00209.512906,W,0.00,294.54,280720,,,D*64
$GNVTG,294.54,T,,M,0.00,N,0.00,K,D*28

Traceback (most recent call last):
  File "gps.py", line 19, in <module>
    ser.write(W_buff[num+1])
IndexError: list index out of range
The Demo code is:

Code: Select all

  GNU nano 3.2                                   gps.py                                   Modified

#!/usr/bin/python
import serial
import time
ser = serial.Serial("/dev/ttyS0",115200)

W_buff = ["AT+CGNSPWR=1\r\n","AT+CGNSSEQ=\"RMC\"\r\n", "AT+CGNSINF\r\n", "AT+CGNSURC=2\r\n","AT+CGN$
ser.write(W_buff[0])
ser.flushInput()
data = ""
num = 0

try:
        while True:
                while ser.inWaiting() > 0:
                        data += ser.read(ser.inWaiting())
                if data != "":
                        print data
                        time.sleep(0.5)
                        ser.write(W_buff[num+1])
                        num =num +1
                        if num == 4:
                                time.sleep(0.5)
                                ser.write(W_buff[4])
                        data = ""
except KeyboardInterrupt:
    if ser != None:
        ser.close()
I have a Virgin Mobile (UK) sim installed and am attempting to make a GPS tracker with it with an online map or possibly with grafana and I'm learning as i go along but cannot get over the first hurdle. Ive come across scripts that convert the data into actual coordinates but nothing appears to be happening from the GPS front. so I'm hoping the Pi collective can help me out!
Many years in IT Management but now an old dog trying new tricks with Pi's and Python! :?

Return to “HATs and other add-ons”