matt2005 / RoadApplePi

An elegent "Black Box" solution that can be retrofitted into any car with an OBD(II) port for minimal cost.
GNU General Public License v3.0
7 stars 3 forks source link

RoadApplePi

RoadApplePi is a simple to install system for your Raspberry Pi designed to record dashcam videos and engine information from your car in real-time, and then make it all accessable from an easy-to-use Web App that can be viewed on your smartphone or computer.

Demonstration video: https://www.youtube.com/watch?v=-G1HIgr2cvU

Features

What you need

RoadApplePi is designed to work with as little or much as you have. Bare minimum, you'll need

Installation

Updated for Buster

  1. Flash Raspbian (lite) onto an SD Card and boot your Raspberry Pi, performing any initial setup needed to get it connected to the internet
  2. From the command line, run:
    sudo apt update && sudo apt install -y git
    git clone https://github.com/JVital2013/RoadApplePi
    cd RoadApplePi
    ./setup.sh
    sudo reboot

    The setup script may take several hours to run, depending on your Raspberry Pi model

  3. On another device, go to http://raspberrypi/. --Note: Your device hostname can be changed by running sudo raspi-config on your pi. I've changed mine to "roadapplepi". A feature to change this from the web app will be added in the future
  4. Put it into Access Point mode, specifying a network SSID and Password
  5. After verifying that you can connect to the newly created WiFi network, shut down your Pi and move it out to your car. Connect your webcam to the Pi and the OBDII reader to your car and power the Pi back on
  6. With your ignition in the "Run" position, go to http://raspberrypi/ (or other hostname if you changed it). From the settings menu, pair your pi with the OBDII reader. Most of them use "1234" for the PIN.
  7. Go for a drive and see how it works!

Power and Time Options

If you've made it to this point, great! You should have a fully functional black box in your car. However, you have most likely run into two issues

  1. Raspberry Pis don't come with any sort of Real-Time Clock (RTC). In an internet-less location such as your car, your pi won't keep the time when turned off. You can partially solve this issue by synchronizing the time on the Pi with the time on your connected device (e.g. phone) via the web app, but this isn't optimal.
  2. Powering your Pi with your car's cigarette lighter if fraught with peril. In many cars, these ports are not "always on" and turn off with the car. This won't gracefully shut down your Pi, corrupting all your data. Even if the port is always on, you don't want the Pi recording 24/7. There are power management options in the web app, but they again aren't optimal

To solve both of these issues, there are two solutions that I recommend

Mausberry Circuits 3A Car Supply / Switch and an RTC

Out of the two, this is the simplest option, although it requires two components. The Mausberry Circuits 3A Car Supply (https://mausberry-circuits.myshopify.com/collections/frontpage/products/3a-car-supply-switch-1) performs two functions: it steps the car voltage down to a Pi-Friendly level, and gracefully shuts the Pi down automatically when the car powers off. On their web site, they mention wiring the device into your battery and ignition. Don't fret, you don't need to go to this extreme: you can use fuse taps to tap an always-on line, and an ignition-powered line in your fusebox. For more details on this, take a look at the SleepyPi 2 option.

Unfortunately, the Mausberry power supply does not contain an RTC, so you'll need to purchase one separately (unless you don't care about incorrect times). For more information, see https://cdn-learn.adafruit.com/downloads/pdf/adding-a-real-time-clock-to-raspberry-pi.pdf.

Fair warning, I haven't actually tried this, but it should work fine.

SleepyPi 2

Although this option is more complicated in initial setup compared to the Mausberry, it's the path I opted for and I've had great success. The SleepyPi 2 (https://spellfoundry.com/product/sleepy-pi-2/) is inherently an Arduino-based "Hat" for the Raspberry Pi that can be programmed as needed. Out-of-the-box, the SleepyPi 2 performs 2 functions that we care about: voltage transformation to Raspberry Pi friendly voltages, and an easy-to-configure RTC. However, it does not automatically power off the Pi when the car is switched off.

Licensing

RoadApplePi is released under the GPLv3. For more information, see COPYING

Credits

The following software has made RoadApplePi possible

Special thanks to Zipcar for making the dream possible! I'd been playing with the idea for this project for quite some time, when on March 14, 2017, Zipcar ran a competition to give away 314 Raspberry Pi Zero Ws. I was a lucky winner with this idea. Thanks to this stroke of luck, I've been able to share this fun project with you all.

Also, extra special thanks to my wife, who put up with me shoving this project under her nose every time I made a tiny bit of progress.

Donate

If you really like this project and want to give back, donations are accepted!