Hackathon 2018: Four Guys in a Garage. On Laptops. In a Minivan.
This year’s hackathon was all about the Internet of Things (IoT)—pulling data from the real world and sending it to the cloud, then finding ways to analyze and manipulate that data for insights.
I came to my team—The Merry Martins, which included Vaughn Hawk, Rich Staats, and Phil Tseng—with a pitch based on something I’m always curious about: what’s going on with my car? Cars generate a lot of data that can be useful to a driver, like fuel mileage and maintenance needs, so it seemed like a great environment to bring the power of data to a real-world situation.
Getting the data, and getting it clean
While the rest of the teams found space in conference rooms, we headed to the parking garage for two days of experimentation.
We got our first lesson right away: don’t use the cheapest adapter you find. We tried out many different OBD2 adapters to try to pull data from the port of my 2013 Dodge Caravan, and none of them worked very well. Luckily, Phil had a high-quality adapter he’d brought from home, and that one finally gave us data we could use.
It wasn’t totally ideal: we’d originally planned to use a Bluetooth connection to send data to the cloud, but it just wasn’t working with the cheap adapters. So we had to use a laptop’s Wi-Fi to pull the data, then tether it to a phone to get the data online.
Of course, it wasn’t that simple. The data from the car is stored in unique ways. For instance, the RPMs are stored four times a minute, so we had to do some math to get accurate info.
Then we ran into the problem of garbled data. We were using open source libraries and scripts on github, and they simply didn’t work. After wrestling with it for a while, we figured that the best solution was to simply write the scripts from scratch in Python. Then we used Telnet to test the data, and we were finally off and running.
It wouldn’t be a hackathon without a near-disaster, though. While we were testing out manual commands with the car connected, I must have either mistyped something or typed something I shouldn’t have, because the engine died and all the dash lights came on. I broke my van! It was mildly terrifying, but luckily, the car re-started just fine, and a potential catastrophe was just a hilarious near-miss.
Creating the pipeline and making it work
At last, we had clean data coming from the car, and we decided to send it through Elasticsearch, a cloud-based service that analyzes data in real time. We hadn’t used the cloud version of this software before, and it was very advantageous that it came with graphing and visualization built in, which made it very fast to turn the data into usable information.
So we finally had a working data pipeline:
The OBD2 interface provided vehicle data in hexadecimal values
Our Python script polled the desired OBD2 data
The vehicle data was sent to a laptop via Wi-Fi, and values were transformed via Python to be structured for Elasticsearch
Data was sent via Bluetooth from the laptop to an iPhone, by means of a simple Unix route add statement, which then streamed data to Elasticsearch
Since we’d already almost broken my car, it was only fair to use someone else’s car as another lab rat. So we plugged our solution into Rich’s 2016 Kia Soul. Lucky for him, the code worked perfectly, and the newer car even had a couple more data points to play with than the older one. Success!
When it came time to demo our project to the company, we weren’t on the stage—we hopped in the car and cruised around the parking garage. The Toads watched a live stream of us driving around, with a graph of the car’s data updating in real time alongside our stream. It was really cool to see the real world and its digital representation happening simultaneously.
Outcomes and lessons
Our project laid a foundation we could use to build a lot of useful things, like an app that shows you real-time fuel consumption, alerts you to maintenance needs, and flags potential problems, like RPMs increasing too much.
Overall, we had a lot of fun, solved some practical problems, and expanded our IoT expertise. A few lessons I learned:
Don’t underestimate how long it takes to get something connected. Even though it looked easy to connect our adapter, it wound up taking a lot of problem-solving
When dealing with something new, mob programming is a huge time-saver. With four of us gathered around a big screen typing, we could review and validate our work as a group very quickly
Getting good data out of your sensors is fundamental in IoT. We spent a lot of our time on getting that right, and it was validated when we tested it out on the second car and our solution worked well
A change of scenery is fun! Working in a car instead of an office gave us a chance to really bond as a group
I’m looking forward to our next hackathon for more bonding, learning and another chance to almost break a car—hopefully not mine!