Raspberry Pi Work

Ever since the Raspberry Pi became easily accessible for the public, I had been interested and tinkering with them. I have used my Raspberry Pi for a wide range of projects. From running a little web server, to my latest project, creating a car data logging system.
I think the Raspberry Pi has really peaked my interest because it is something that I can work with hands on, and apply my software development experience to. Another reason why it had peaked my interest (and for many others as well), was because it was cheap and affordable for a college student like me.
Alright, enough about why I like Raspberry Pi's, onto my projects!

Raspberry Pi Car Data Logger

Alright, This project is probably my biggest project undertaken with a Raspberry Pi, and I am working to develop a data logger for my car. The project is still in progress, and is not done yet, so I am going to put what I have done so far here.


My idea was to use a Raspberry Pi to read engine data from my car, and store it in a time series data format. I could then use my experience with R and Shiny to create a web application on a server to plot and display that data. This would allow me to see trends in my vehicle's temps, transmission, fuel efficiency, speed, and overall health.
I decided to use OBD to read those sensors from the engine. When most people think of OBD, they think Check Engine Light. That is the most common use of OBD, what it was intended to do, diagnose problems. However, all cars can also provide some engine sensor data over the OBD interface as well. Each car varies in what they can provide of course. My hopes are that I can at the very least get the following from my car:
  • Engine RPM
  • Engine Temp
  • Engine Load
  • Speed
  • Fuel Status
That's not a lot, is it? I don't think so, but it will give me a good amount of insight into how my car is performing if I look at the data in the right ways.

My Hardware

Thankfully, buying electronics as components are not that expensive, so I think I will get by without spending more than $50 on the project. So far, this is the list of parts that I have gotten for the project:
  • Raspberry Pi (I used a model B rev 2.0)
  • 16 GB SD Card
  • USB Bluetooth 2.1 Adapter (Asus Model USB-BT211)
  • USB Wireless N Adapter (Trendnet Model TEW-648UBM)
  • FreedomPop Wireless 4G Hotspot
  • Bluetooth OBD Car Adapter ( Model I Got )
  • DS3231 RTC Module ( Model I Got )
  • 3A Car Switch ( Model I Got )
The reason that I am using an RTC module is because the Pi will have an unreliable connection to the internet most of the time. Since I am effectively gathering time series data, the time is going to be pretty important, and the Pi does not have an internal RTC. Installing the RTC module will allow me to have reliable clock data.
The 3A car switch is a contraption that I wire to a few of my car's wires so then the switch can power on the Pi when I turn my car on. Also, when I turn my car off, the switch stores some extra power in it to allow the Pi to shutdown properly after the car has been turned off. This is to find a solution to turn the Pi on and off with my car and also handle the software safely.
The FreedomPop Wireless hotspot allows my pi to connect to the internet and then sync the data with a server at home when my Pi shuts down. Not to advertise, but the reason why I am using FreedomPop is because I am able to get a free 500MB of wireless data each month. 500MB is more than enough to send a text file to a server.
Here is a pic of my Rapsberry Pi with all of its components attached to it:
Mack's Raspberry Pi

My Progress

I am slightly following the setup of a similar project, which can be found here.
Before I say anything more, if you have any questions about what I did to get things working, please send me an email with your questions. I will be glad to help you out!
I have gotten the Raspbian distribution loaded onto my Pi and installed the python code from the project that I just mentioned. I then proceeded to configure the wireless card for the FreedomPop, and got the bluetooth drivers installed and got all the needed linux packages installed.
Over the last couple weeks, I have been having difficulty with his code working. I initially thought that his code was not designed for my setup. However, after quite a bit of investigation, I found that there was additional setup needed to communicate over bluetooth with the OBD adapter. So, I finally was able to start to get data out of my car!
Next up, I had written startup and shutdown scripts to startup and run the scripts automatically, and to shutdown safely. I have also taken the car switch that I purchased and wired that into my car using the fuse box just under my dash, and I stashed it into a little side panel by my feet. I have wired that up to power the wireless hotspot and the raspberry pi. I have gotten the pi to consistently log data each time I power the car on, connect to the wifi hotspot, and then when the car is turned off, it uploads the data to my server.
So the raspberry pi is starting to log lots of data, and now I am at the point where I need to start analyzing it. However, with school and all going on, the project has started to move at a much slower pace. Nonetheless, I have started to write the R web application. You can find its Github here. The web app is up and running, but doesnt have much functionality yet.. However, you can find it here. That's all the updates that I have for now, check out the list of things below for what's coming next!

What's Next

So things that need to be done next (in order of importance) is:
  • Design the Data Filtering/Analyzing System
  • Create the Shiny App and R Code