-
Start with fresh Jessie install on a Raspberry Pi 2
-
Install some libraries
$ sudo apt-get install python-pip
$ sudo pip install pynmea2
-
Change console tty to free up HW UART
$ sudo nano /boot/cmdline.txt
Change contents from:
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 console=tty1 root=/dev/mmcblk0p6 roo tfstype=ext4 elevator=deadline fsck.repair=yes rootwait
To:
dwc_otg.lpm_enable=0 console=tty1 root=/dev/mmcblk0p6 rootfstype=ext4 elevator=deadline fsck.repair=yes rootwait
Note: we're removing
console=ttyAMA0,115200
from the file.You can also achieve this by doing sudo raspi-config, selecting option 8, going to 'Serial' and turning .
-
disable getty on serial
$ sudo systemctl disable [email protected]
-
reboot the Pi
$ sudo reboot now
Last active
November 18, 2015 00:08
-
-
Save davidsulpy/16b306218b4bd9e7cb7d to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
isstreamer.ini |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import serial | |
import pynmea2 | |
from ISStreamer.Streamer import Streamer | |
streamer = Streamer(bucket_name="GPS", ini_file_location="./isstreamer.ini") | |
serialPort = serial.Serial("/dev/ttyAMA0", 9600, timeout=0.5) | |
def parseGPS(str): | |
if str.find('GGA') > 0: | |
msg = pynmea2.parse(str) | |
streamer.log("Location", "{lat},{lon}".format(lat=msg.latitude,lon=msg.longitude)) | |
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 = serialPort.readline() | |
parseGPS(str) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment