creating a data overlay for in-car videos

04 May 2022 - shawn

Overview

nfsu2-miat

the actual miata my 8-year old self put together in 2004

Every in-car video of performance driving should look like a video game. I love the look of a half-dozen gauges updating me on everything that the footage alone doesn’t convey: G-forces, course maps, speed, driver inputs, engine RPM - anything missing that I would be able to sense behind the wheel. Videos with this extra data are more interesting to watch and are more useful as tools for improvement.

Professional data loggers are expensive, but much of what they record could be captured by equipment already available to me, like my camera and my car’s computer. I just needed a way to access it.

This project was split into two main parts. The first was a NodeJS script to extract telemetry data from videos shot with my GoPro and make it available to DashWare, and the second was a device combining a Raspberry Pi, some circuitry, and a Python script to read and save signals from the car’s gauge cluster.

The GoPro

Newer GoPros (5+; I’m using a Hero 8 Black) record GPS, gyroscope, and accelerometer metadata alongside videos, which would be useful for creating maps, speedometers, and G-force meters in DashWare.

“Would” be useful?

Well, despite DashWare being owned by GoPro, this GPMF data can’t be imported. It looks like this worked at one time, but has broken for some cameras.

Fortunately, this library exists for NodeJS - which means it can be extracted and formatted into a CSV that DashWare can use!

Problems to solve:

Coming Together

This video was made using the finished script. It was shot using only a GoPro Hero 8 and edited together using this script and other free software.



The Tachometer

Of onscreen gauges, nothing is as critical to me as a tachometer. Maybe it’s because my adolescent self etched hundreds of hours of Need For Speed: Underground 2 into my brain, conditioning me to link the pitch of a motor and a dial onscreen to the sensation of speed, or maybe I’m pretending it’s not that and that I just want to know if I’m short-shifting or something. Either way, I needed to have an onscreen tachometer in my videos.

nfsu2-miat

One way to accomplish this is to log data from an OBDII reader. This approach works well on modern cars, but not so well for my track car, a 1997 Mazda Miata. ‘96 and ‘97 Miatas have OBDII, so it’s possible, but their computers just aren’t fast enough to get an acceptable refresh rate. The refresh rate drops even further with each type of information that’s read, leading to either videos with very choppy gauges that update every second or so, or an inaccurate mess from interpolation.


The solution: a Python script running on a Raspberry Pi, paired to a circuit to safely read the Miata’s gauge cluster tachometer signal.
Assembled board

Parts List

Any of these parts can be substituted for similar items.

Part Description approx cost
Raspberry Pi Zero W Main board $10-15
Schmartboard Pi Zero Circuit board, built for Pi Zero $10
L7805CV Voltage regulator $0.49
1N004RLG Diode $0.19
2N4401BU NPN transistor $0.29
GPIO pins   $0.95
GPIO socket   $1.50

Total: ~$25 USD

Research

One of the best things about owning a Miata is that if you have an idea for something to do with yours, someone else out there has figured out how to do the hard stuff already. I’m a software developer, not an electrical engineer, so this project wouldn’t have been possible without running into this schematic from this post. The circuit steps the tachometer signal wire on the back of the gauge cluster down to a lower voltage that can be sent to an arduino (or in my case, a raspberry pi) without damaging it or disabling the tachometer.

Problems to solve:

The Rest

Even with this novel of a write-up, not everything is documented here: I didn’t go over the code for either script, walk through using the finished product, or detail very much of the troubleshooting required to get all of this working properly. If you have any questions please feel free to reach out and ask!

Creating data overlays for in car videos
Creating data overlays for in car videos