JVital
Posts: 6
Joined: Tue Nov 03, 2015 4:00 pm

RoadApplePi - The Elegant Black Box Solution for your car

Wed Mar 14, 2018 3:38 am

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
Dashcam Recordings with car stats: Whenever your RoadApplePi is powered on and connected to a webcam and Bluetooth OBD2 reader, it's recording every piece of information it can scrape up. Using hardware-accelerated video encoding, this results in smooth dashcam footage and an instrument cluster that shows exactly what you (and others around you) were doing at any given time.

Real-time OBD (II) Information: See what's going on under-the hood in real time with our "Dashboard" view

Web App Access: Many "carputers" based around the Raspberry Pi require the installation of a screen in your car, making them difficult to install. RoadApplePi works around this issue by giving you a modern web app that can be accessed from any internet-enabled device.

Offline Access: Need to view dashcam recordings while away from your RoadApplePi? Not a problem! The Web App works without an active connection to your Pi, and you can cache videos and instrument clusters for offline viewing.

Wireless connectivity: Most of the time, your car will be out of range of any WiFi network. RoadApplePi solves this issue by having the option to create a wireless network, specifically for ease-of-access to the web app. You also have the option to connect to an existing wireless network if you're in range.

Set it up and forget about it: If you're going all the way with an automated car power system, you won't have to touch your RoadApplePi again after the initial setup (see "Power and Time Options" for more details)

..And more to come! RoadApplePi is free software, developed in my free time. Depending on your help and support I hope to implement other features, such as:
  • More OBD pids (car stats)
  • The ability to read and log engine trouble codes
  • Tune your ECM
  • Export dashcam recordings with superimposed obd information as a video for complete compatibility
  • Become fully self-aware (just joking ... I hope)
What you need
RoadApplePi is designed to work with as little or much as you have. Bare minimum, you'll need

A Raspberry Pi. Any model will work, but the RPi Zero W or RPi 3 is recommended since they have Bluetooth and WiFi built in. Otherwise, a USB Bluetooth/WiFi dongle is required. Side note: This software was developed almost entirely on a RPi Zero W with few issues. However, due to the slow processor on this model, some things run slow. The Real-Time dashboard runs around 15 seconds behind, and loading the instrument cluster on recorded videos may take 20-30 seconds (after which, they play fine). If you're opting to use a slower model, I recommend doing the initial setup of a spare Raspberry Pi 2/3 to speed up the software compilation process. After that, the SD Card can be moved to your pi of choice.

Class 10 SD Card with Raspbian Stretch (optionally, the lite flavor): This software was written to work on Raspbian Stretch, but it may work on other OSs. YMMV. Also, I recommend using at least a 16GB SD Card to give you enough space for your dashcam recordings. I've been using the same 32GB SD Card for the past 6 months with no issues. This gives me enough space to retain, on average, 3 weeks of recordings.

A Webcam: All development was done with an old USB webcam, but any webcam should work including Raspberry Pi-specific ones.

A power source: Powering the beast is the trickiest part of the whole build. If you're just getting started, I'd recommend a 2A car phone charger with a micro USB cable to power the Pi. This won't automatically/cleanly power off your Pi, but it'll get it powered until you have a better solution in place. See "Power and Time Options" for more details.

Bluetooth ELM327 OBDII adapter (optional): While technically optional, a Bluetooth ELM327 adapter is required to record engine information. They're around $10 on Amazon and completely worth the price.

Installation
  • Flash Raspbian (lite) onto an SD Card and boot your Raspberry Pi, performing any initial setup needed to get it connected to the internet
  • From the command line, run:

    Code: Select all

    sudo apt update && sudo apt install 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
  • 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
  • Put it into Access Point mode, specifying a network SSID and Password
  • 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
  • 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.
  • 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
  • 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.
  • 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.co ... y-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/download ... rry-pi.pdf.

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

Sleepy Pi 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.

It must be programmed to do this. I've already modified one of Spell Foundry's example programs to do just this, and is the RoadApplePi.ino file in this repository. To flash this sketch onto your Sleepy Pi, see https://spellfoundry.com/sleepy-pi/prog ... duino-ide/.
You need to build a voltage divider for the program to be able to properly read the current power status of the car. Thanks to Spell Foundry, here's the voltage divider you need to build:
Image

You can build this circuit on whatever you would like, but I used a solderable breadboard. For those less well-versed in reading schematics, here's a quick explanation of what you're doing
  • (Not shown in this schematic) Wire an always-hot line from your fuse box to the VIN of the SleepyPi
  • Wire an ignition-dependent line into the voltage divider (signified by the 14.4V in the diagram)
  • Wire a ground wire from your car into both the voltage divider (very bottom of the diagram) and the 0V part of the power input on the SleepyPi.
  • The outputs of the voltage divider are on the right of the diagram. If you're using my SleepyPi sketch, wire the 3.09V output into Pin 14 of the Sleepy Pi, and the 0V output to the SleepyPi's GND
Once assembled, you're left with a 3-layer sandwich: your raspberry pi, the sleepy pi, and your voltage divider. Here's what mine looks like installed in my car:

Image

Take a look at it!
To get started, head over to https://github.com/JVital2013/RoadApplePi. Licensing and donation information is available at that location as well.

Happy travels!

JVital
Posts: 6
Joined: Tue Nov 03, 2015 4:00 pm

Changelog

Wed Mar 14, 2018 3:38 am

Reserved

JVital
Posts: 6
Joined: Tue Nov 03, 2015 4:00 pm

FAQ

Wed Mar 14, 2018 3:39 am

Reserved 2

dcpesses
Posts: 1
Joined: Thu Mar 31, 2016 3:49 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Tue Mar 20, 2018 2:59 pm

Very cool project! I’ve been wanting to do some basic OBD / Pi integration for a while, like display a digital speedometer, but the scope of this project blows me away!

What kind of ELM327-based Bluetooth scanner do you recommend? I see a bunch of the ~$10 ones that say they support either Android only or both Android & iOS. Does it make a difference which one we get?

Can’t wait to see this in action!

JVital
Posts: 6
Joined: Tue Nov 03, 2015 4:00 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Sun Mar 25, 2018 6:59 pm

dcpesses wrote:
Tue Mar 20, 2018 2:59 pm
What kind of ELM327-based Bluetooth scanner do you recommend? I see a bunch of the ~$10 ones that say they support either Android only or both Android & iOS. Does it make a difference which one we get?
As long as it's a Bluetooth adapter, it shouldn't matter. I think the Bluetooth ones are all marketed as Android-comoatible. You can get the one I use from https://www.amazon.com/gp/aw/d/B01HXGX8 ... UTF8&psc=1.

That being said, the $10 ones are almost always knockoffs. To read more about this, see https://en.m.wikipedia.org/wiki/ELM327#Pirate_clones. In my opinion, I wouldn't worry about it too much: this software was written with a knockoff, so it doesn't leverage any of the functionality of "real" adapters (for now).

hamped
Posts: 1
Joined: Thu Apr 09, 2015 6:25 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Sun Apr 01, 2018 11:03 am

Now this along with gps data and live dashboard on own server would be awesome:-)

JeanPierre
Posts: 1
Joined: Mon Apr 09, 2018 8:12 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Mon Apr 09, 2018 8:17 pm

Hello! I think it's great what you did. You got ahead of me! I am currently making an identical device with the Rpi3, but I have encountered a problem when trying to connect by bluetooth with the ODB2 scanner. I have reviewed in a thousand forums and still can not connect properly with the port, how did you do it? I would be very helpful. Thank you very much in advance for your answer. :D!

marcofrax
Posts: 1
Joined: Thu May 10, 2018 11:58 am

Re: RoadApplePi - The Elegant Black Box Solution for your car

Thu May 10, 2018 12:03 pm

Does your distribution support multiple cameras input and recording?

BUK92
Posts: 1
Joined: Sun Sep 23, 2018 3:11 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Sun Sep 23, 2018 3:19 pm

This seems like a great idea. I’d love to get it in my van. The only problem being that after 3 days of trying I’m still stuck When trying to connect to RoadApplePi for the first time, in order to turn the WiFi on.
I get absolutely nothing. I’ve used various Ethernet cables, so that isn’t the issue. I’ve redownloaded and reinstalled raspbian and RAP numerous times. Tried manually setting up Wireless access point from the Pi. Nothing at all. Is there a step missing from the instructions?

Fletch
Posts: 1
Joined: Mon Sep 24, 2018 12:40 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Mon Sep 24, 2018 12:42 pm

I have a wired OBD reader. Is there a simple way of getting getting it to work instead of using the Bluetooth version? I did test and it wasn’t plug and play.

alextovey
Posts: 25
Joined: Wed Oct 17, 2018 8:43 am

Re: RoadApplePi - The Elegant Black Box Solution for your car

Mon Oct 29, 2018 3:36 pm

This only works if you manually create and run through the script. I manually installed sql, apache2, ffmpeg and it now works.

alextovey
Posts: 25
Joined: Wed Oct 17, 2018 8:43 am

Re: RoadApplePi - The Elegant Black Box Solution for your car

Mon Oct 29, 2018 4:15 pm

Anyone know how to change it from a usb camera to the onboard camera?

gilinnc
Posts: 1
Joined: Tue Dec 11, 2018 11:16 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Tue Dec 11, 2018 11:21 pm

I love the idea of RoadApplePi - however, I like to know more about the following methods if possible:

It is listed that it can connect to any wifi signal. Would it be possible to setup some sort of wifi access to a NAS or wifi storage device - like in a garage or house that it is within the wifi range and upload the video and driving data? Could I use a laptop to view the vehicle operating condition and video of certain situation such as hard breaking, quick speed - or even exceeding speed limits?...

I don't have the money to buy those GPS devices with monthly data charges.

Thanks,

Gil
:ugeek:

morticiaskeeper
Posts: 101
Joined: Mon Aug 27, 2012 6:05 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Sun Dec 16, 2018 1:21 pm

I'm going to have a go at merging this with my GPS Head Up Display. The GPS will keep the clock up to date.

As I do a lot of stop/start driving, I've modified a Poundland battery to give me a UPS. I can switch the pi on in the morning and the UPS will keep it going when I turn the ignition off.

I must admit, I have tried to write a basic python dashcam, but i just couldn't get the video quality and filesize that you have managed.

morticiaskeeper
Posts: 101
Joined: Mon Aug 27, 2012 6:05 pm

Re: RoadApplePi - The Elegant Black Box Solution for your car

Mon Dec 17, 2018 6:44 pm

I have a problem.

Used it all day in my van, came home and connected to it with my phone. In settings, I told it to connect to my home network, which it did.

None of the videos of the day are available and the settings menu to switch it back to AP mode just tells me that only some settings are available while in offline mode.

an SSH connection is also refused.

genie360
Posts: 1
Joined: Sat Dec 29, 2018 5:08 am

Re: RoadApplePi - The Elegant Black Box Solution for your car

Sat Dec 29, 2018 5:16 am

Any updates on this project? I cannot for the life of me get my pi camera (CSI interface) to work. I have enabled the cam drivers via modprobe bcm2835-v4l2, the light on the camera is coming on, and there appear to be recordings saved. However, the videos appear to be blank/corrupted. I manually moved a couple of recordings to my desktop from the /var/www/html/vids folder and they won't play in VLC either.

After much googling, this seems like this is the only pi dashcam solution that incorporates ODB info in such an elegant manner, so thanks for the hard work OP!! Please add some more documentation!

Beenay25
Posts: 10
Joined: Tue Feb 21, 2012 9:56 am

Re: RoadApplePi - The Elegant Black Box Solution for your car

Tue Feb 12, 2019 9:15 pm

I'm also trying to get this working with a pi cam (ZeroCam to be exact)

The best I've been able to get so far is a blank video window on the recordings page.

Will it work with the raspberry pi camera? Or should it be used with a USB webcam?

durtball
Posts: 1
Joined: Thu May 16, 2019 5:07 am

Re: RoadApplePi - The Elegant Black Box Solution for your car

Thu May 16, 2019 5:12 am

Does this project include sound recording on the camera? Can you use a pi onboard camera or does it have to be usb? Does it support multiple cameras? This would ve my first PI build. Id love some info before i buy everything i need. Thanks a bunch

Return to “Other projects”