So the GPS system is free, its funded by the US Military, and a license fee for every GPS receiver chip made. Reading GPS messages is usually a very simple task, as they are usually in NMEA format which is a plain text, human readable format. There are a number of Python ( and others) libraries for complex GPS Lat/Long calculations (great circle calculation, distance between two coordinates etc.YitEarp wrote: ↑Mon May 13, 2019 7:58 pmhttps://www.amazon.co.uk/gp/product/B07 ... _qh_dp_hza -
Have purchased this for a play around with a project i would like to do just a simple tracker that i could remote access to pull the data and track in real time.
I also have a raspberry pi zero to use with it.
A couple of questions though as my knowledge of linux is so so i can get by from tutorials.
I had first initially thought GPS was not free but from my researching it seems it is widely free is that correct?
The add on hat has a coin cell battery - Does this mean that it could sit in a state of low power and only activate if i were to wake up the pi zero?
I have read a few guides on GPS and found the scripts that it takes to run so that shouldn't be too much of a headache * Famous last words.*
The part of the GSM is where i am struggling to get to terms with.
Since this part will only function over 2G in my country from what i gather (UK) will i still be able to remotely access the device this way and what software would i use to be able to do this?
Will i be limted by 2G speeds when downloading this data?
What will the real time tracking be using to track the device from home? GSM or GPS? i.e would i need to send a call to the device to wake it up?
I plan on running this from a powerbank will this be OK? Since i only want to activate the device and send a wake up script and a shutdown script when i am finished. (currently the 20,000mah battery i used for a pi 3+ lasted around 3 days give or take)
Is there a better alternative like those batteries you can attach direct to the pi.
Sorry my questions are a little out of frame.
Hopefully someone may understand!
Code: Select all
sudo dmesg | grep tty [ 0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=1 bcm2708_fb.fbwidth=656 bcm2708_fb.fbheight=416 bcm2708_fb.fbswap=1 smsc95xx.macaddr= vc_mem.mem_base=0x1ec00000 vc_mem.mem_size=0x20000000 dwc_otg.lpm_enable=0 console=tty1 root=PARTUUID=c6a9741f-02 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait [ 0.001426] console [tty1] enabled [ 0.529838] 20201000.serial: ttyAMA0 at MMIO 0x20201000 (irq = 81, base_baud = 0) is a PL011 rev2 [ 0.537947] 20215040.serial: ttyS0 at MMIO 0x0 (irq = 53, base_baud = 31250000) is a 16550 [ 69.618669] pps pps0: source "/dev/ttyS0" added [ 213.646566] pps pps0: source "/dev/ttyS0" added [ 483.279014] pps pps0: source "/dev/ttyS0" added [ 799.751537] pps pps0: source "/dev/ttyS0" added [email protected]:~ $ sudo lsof /dev/ttyS0 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME gpsd 832 gpsd 7u CHR 4,64 0t0 6090 /dev/ttyS0 sudo netstat -lntp Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 491/sshd tcp 0 0 0.0.0.0:2947 0.0.0.0:* LISTEN 1/init tcp6 0 0 :::22 :::* LISTEN 491/sshd tcp6 0 0 ::1:2947 :::* LISTEN 1/init sudo lsof /dev/ttyS0 COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME gpsd 832 gpsd 7u CHR 4,64 0t0 6090 /dev/ttyS0
Code: Select all
sudo gpsd -N -D3 -F /var/run/gpsd.sock gpsd:INFO: launching (Version 3.16) gpsd:ERROR: can't bind to IPv4 port gpsd, Address already in use gpsd:ERROR: maybe gpsd is already running! gpsd:ERROR: can't bind to IPv6 port gpsd, Address already in use gpsd:ERROR: maybe gpsd is already running! gpsd:INFO: command sockets creation failed, netlib errors -1, -1
Code: Select all
#!/usr/bin/python import serial import time import pynmea2 #Enable Serial Communication ser = serial.Serial("/dev/ttyS0", baudrate=9600, timeout=1) #Transmitting AT Commands to the Modem #'r\n' indicates the Enter key ser.write('AT'+'\r\n') str = ser.readline() print str time.sleep(.1) ser.write('AT+CGNSPWR=1'+'\r\n') str = ser.readline() print str time.sleep(.1) ser.write('AT+CGPSOUT=32'+'\r\n') str = ser.readline() print str time.sleep(3) ser.write('AT+CGNSTST=1'+'\r\n') str = ser.readline() print str time.sleep(.1) ser.flushInput() ser.flushOutput() def parseGPS(str): if str.find('GGA') > 0: msg = pynmea2.parse(str) print "Timestamp: %s -- Lat: %s %s -- Lon: %s %s -- Altitude: %s %s" % (msg.timestamp,msg.lat,msg.lat_dir,msg.lon,msg.lon_dir,msg.altitude,msg.altitude_units) while True: str = ser.readline() parseGPS(str)