Updating readme files.
This commit is contained in:
25
GPSPi/gps.py
Normal file
25
GPSPi/gps.py
Normal file
@ -0,0 +1,25 @@
|
||||
import pycurl
|
||||
import certifi
|
||||
import gpsd
|
||||
import time
|
||||
from datetime import datetime
|
||||
from io import BytesIO
|
||||
|
||||
gpsd.connect()
|
||||
|
||||
while True:
|
||||
packet = gpsd.get_current()
|
||||
if packet.lat == 0 and packet.lon == 0:
|
||||
continue
|
||||
timestamp = datetime.now().timestamp()
|
||||
lat=packet.lat
|
||||
lon=packet.lon
|
||||
url='path.to.your.server/loc.php?date={}&lat={}&lon={}'.format(int(timestamp),round(packet.lat,5),round(packet.lon,5))
|
||||
buffer = BytesIO()
|
||||
c = pycurl.Curl()
|
||||
c.setopt(c.URL, url)
|
||||
c.setopt(c.WRITEDATA, buffer)
|
||||
c.setopt(c.CAINFO, certifi.where())
|
||||
c.perform()
|
||||
c.close()
|
||||
time.sleep(59)
|
||||
0
GPSPi/loc.php
Normal file
0
GPSPi/loc.php
Normal file
@ -1,3 +1,7 @@
|
||||
# GPSPi
|
||||
This is a project for a GPS logger so I can graph my travels after the fact.
|
||||
The plan is to buy a GPS hat from Adafruit and use that to get the required data to log.
|
||||
This is a project for a GPS logger so I can graph my travels after the fact and show family where I am at any point.
|
||||
|
||||
To use this, first install gpsd in your local linux machine and make sure you have a GPS module.
|
||||
The gps.py file I run on a Raspberry Pi 4 and on the other end I have a LAMP server and I have the loc.php to receive messages from the GPS server.
|
||||
|
||||
You can modify the wait time in the gps.py file to your liking. I have it at 1 minute circa so I can have more data than not.
|
||||
Reference in New Issue
Block a user