Updating readme files.

This commit is contained in:
Axel Rafn
2023-03-06 20:16:36 +00:00
parent 4461c60483
commit fbd8a62eab
5 changed files with 32 additions and 677 deletions

25
GPSPi/gps.py Normal file
View 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
View File

View 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.