python GPS – NMEA sentence Parser

from datetime import datetime
import sqlite3
import time
import requests

class db_create():
    def __init__(self,lon,lat,speed):
        self.lon=lon
        self.lat=lat
        self.speed=speed
        self.time=time.time()
    def __str__(self):
        return(" Lon={}\n Lat={}\n Speed={}".format(self.lon,self.lat,self.speed))
class decode():
    def __init__(self,serial_data):
        self.raw_lat=serial_data[3]
        self.raw_lon=serial_data[5]
        self.speed_knot=serial_data[7]

        self.to_decaminal()

    def to_decaminal(self):
        self.lat=float(self.raw_lat[0:2])+(float(self.raw_lat[2:4])/60)+(float(self.raw_lat[5:7])/3600)
        self.lon=float(self.raw_lon[0:3])+(float(self.raw_lon[3:5])/60)+(float(self.raw_lon[6:8])/3600)
        self.speed=float(self.speed_knot)*1.85200 #knots to kmh
        
gprmc="$GNRMC,091805.00,A,3953.300557,N,03252.202539,E,0.102,,200619,,,A*6"#exapmle data string of telnet

if (gprmc[0:6] == "$GNRMC"):
    parsed_data=gprmc.split(",")
    if (parsed_data[2]=="A"):
        decoded_data=decode(parsed_data)
        print(db_create(decoded_data.lon,decoded_data.lat,decoded_data.speed))
    else:
        print("gps error")

It is an example for parsing nmea sentes with python and it creates the db , you need to create serial connection to use with gps receiver.

#gprmc string is example of serial data stream you need to create serial connection to use

http://aprs.gids.nl/nmea/ # here, you can find more information about gps nema sentences

RPI CAM #Closed

Due to Heating issues I have closed the camera sorry :p

https://egemeric2.ddns.net/index.php/rpi-camera/ (You can see here)

You can see Ankara’s city View with RPI Cam.This camera is connected to Rpi Zero W . Also you can watch daily timelapses (but video qualities are very low due to my upload speed so i use webm format to decrease file size.)

Whole day has nearly 18000 frame(1-2gb in jpeg) but i have used mancoder program to convert jpeg’s to Avi . By doing this ,whole day’s timelapse’s has been decreased to 40 mb but after converting avi to webm this file size is decreased extremely to 6-8 mb .

I’ve used crontab to converting images to videos. crontab works at every 01.01 AM (for ffmpeg and deleting used jpegs)

On rpi zero i used https://elinux.org/RPi-Cam-Web-Interface this tool to web gui and after i created a basic curl script to catch images every 5 seconds. (this curl script works in my main dektop also this pc renders the files and hosts the videos)

you can see my basic scripts at bottom

RPI CAM #Closed yazısına devam et