Putting it all together
In the next two sections, we will put together what we have done so far. First, we'll begin by sending data to the Google Docs sheet. Then, we will build an Android app to show the data on a map.
Sending measurements
We will use a Python script to access GPS data on the Pi that we'll need to run on system reboot. For this purpose, add the following code at the end of the /etc/rc.local
file:
sudo killall gpsd sudo gpsd /dev/ttyUSB0 -F /var/run/gpsd.sock sudo rfcomm connect hci0 00:1D:A5:15:A0:DC & sleep 1m current_time=$(date "+%Y.%m.%d-%H.%M.%S") file_name=/home/pi/log_sender.txt new_filename=$file_name.$current_time sudo /home/pi/pyobd-pi/sender.py > $new_filename 2>&1 &
Here, we can restart the GPS services, connect to the OBD Bluetooth dongle, create a log file, and start the sender.py
script that we will implement next:
#!/usr/bin/env python import obd_io from datetime import datetime import time import threading import commands import time from...