DIY Telematics Box

blackbox4

Lately, there has been a rise in dashcams sold worldwide to protect the driver’s insurance claims. Most of the time, these have been sufficient. I recently bought my first car and had to drive about an hour on the motorway to my first job. Being a new driver, I had my car fitted with a black box (telematics box) to monitor my driving. A few years later, I bought my second car, but I didn’t have a telematics box installed. Given the driving styles I have seen from various individuals on my commute to and from work, I felt a dashcam alone would not be sufficient, and I really wanted to have something that could monitor my driving in the event of some idiot thought they were on the set of the next Fast & Furious. So I made my own!

Disclaimer

This custom-made black box may not always be a valid evidence in a court of law. Some countries/states/local laws may not allow installation of custom monitoring units into moving vehicles unless authorised by an approved installation team. For these reasons, the author(s) of this article and website hold no responsibility over the outcome of your driving, any issues caused by the installation of a telematics box, and any other incidents occurred with a custom-made monitoring unit fitted.

Blackbox

What is a black box? A black box is simply a device that records and logs various attributes of a moving vehicle. They are primarily used in airplanes to monitor things like heading, airspeed, fuel levels, radio chatter etc. In the unlikely event of an airplane incident, the black box is the first reference point to understand what happened in the moments leading up to the incident. As we have rapidly approached the era of Big Data, these black boxes (aka telematics boxes) have been fitted into cars to monitor drivers’ styles to better predict their chances of causing an incident. While this idea is aimed at new drivers, I believe it could benefit all drivers, and lead to safer roads for everyone. From a psychological perspective, you are instinctively more likely to obey the laws of the road if you believe you are being tracked.

Design

The full step-by-step instructions for building your own can be found on Instructables. An oversimplified rundown of this whole article is to connect an SD card to the car’s on-board computer and track the car’s movements. The black box will talk to the car’s on-board computer through the OBD (On Board Diagnostics) port. A brief history of the OBD can be found here, but fundamentally most (if not all) cars sold in the US and European Union after 2003 must have an OBD port. Garages use the OBD port to diagnose why your engine light is on, and will probably charge you a fortune just for that.

Below is a list of materials I have used to build my own:

  • Arduino – Does all the number-crunching and takes readings.
  • Bluetooth OBD connector – To talk to the car’s computer.
  • HC-05 Bluetooth Module – Module to connect to the Arduino and program to connect to the
  • OBD connector
  • SD card module – To store the data collected
  • GPS module – To determine the position the car reading was taken. Also to determine the
  • UTC time.
  • USB lighter adapter – To give power to the whole box.
  • A case – to put it all in a box-like container.

blackbox1

Multiple serial ports are needed for Bluetooth, GPS, and debug data. If you didn’t want to output debug data to the computer, you might get away with using an Arduino UNO (depending on the source code), and use SoftwareSerial to talk to either Bluetooth or GPS, therefore saving a bit of money and space. You can test the Bluetooth OBD connector using your Android phone (no Apple support, sorry!) using the Torque app. Simply connect your OBD adapter, and pair on your phone. Open the Torque app, and start reading data!

Code

As with all Arduino-based projects, some coding is required. Fortunately, I have written the code already, so all you have to do is upload it to the Arduino. Ultimately, the structure of the code is simple enough. It follows the following phrase: “If I have a GPS position, collect car data.” Without a GPS position, we wouldn’t know where the driver was for the car reading. We will be collecting the car engine’s revolutions count (RPM), car speed, and the accelerator’s depression. The speed will tell us how fast the driver was going, the RPM will tell us when the driver changes gears, and the accelerator will tell us how heavy-footed the driver is. Combinations of each of these will give us different outcomes as well. For example, speed-RPM will give users the exact gear the driver has selected. The entries to each file will be in the format “[Date],[Time],[Latitude],[Longitude],[Speed],[RPM],[Throttle]”. The entries will be made at a rate of 1Hz, or every time a GPS coordinate is taken. The full source code can be found on Github. Make sure to change the OBD adapter’s MAC address to use properly!

Case

To make it a neat box, I designed a simple case in SketchUp to cover all the electronics

blackbox_case

You don’t need to design a case, you can fit it into any other pre-made box, or leave everything out. The importance is to be able to power the box and plug the GPS antenna into it.

Result

Put all the pieces together, upload the code, and go driving! Below is a sample result showing data that has been collected.

blackbox_map

Future Improvements

In terms of additional features, it would be a good idea to send this data directly to an online storage facility to then view on a map. This will require a modem. I have played around with specifically the SIM808 module, because it is a Bluetooth, modem, and GPS unit all in one. However, it does use the 2G band, which is in the process of being shut down around the world. There aren’t any cheap 3G/4G alternatives for the moment, so this is on hold until then. Whilst it may be more expensive, making your own PCB with each component will make the end product smaller and more compact. Doing so will make it also easier to hide, or place away from hindrance.

From the data acquired from using this method, insurance companies use machine learning, neural networks, and artificial intelligence to predict drivers’ styles. It would be interesting to see how this data can be used to train learning algorithms for various results. The files saved are basic CSV files (without the .csv extension). It might be more beneficial to save these in a KML format to then view on Google Earth. CSV files only carry the literal text data, and a custom program would have to be designed to convert this into a mapped view of the route travelled.

FAQs

Where is my OBD connector in my car?

The OBD connector is usually hidden away under the steering wheel somewhere. In my first car, it was below the radio. In my current car, it is between the steering wheel and the driver’s door. Please search online if you are having difficulty finding your OBD connector.

How long does it take for the GPS signal to arrive?

This may depend on where you are. Out in the open, it should take about 30 seconds (according to the Neo6M datasheet) on a cold start. In highrise cities or in the valleys may take longer. 

I can’t connect to my adapter!

It might be that there is something connected to it. Try unplugging it, and plugging it back in.

Complete

That’s it! You’re own telematics box with your own driving data! Thanks for reading and happy safe driving!

Leave a Reply