Vehicle telematics with OBD-II & open-source hardware
Vehicle telematics with OBD-II & open-source hardware
Making it possible, accessible, and affordable to carry out vehicle telematics projects with open-source hardware
Making it possible, accessible, and affordable to carry out vehicle telematics projects with open-source hardware Read more
About this project
For many years and till this day, I am the author of MediaCoder. While developing and maintaining my video transcoding software, I am also an open-source hardware enthusiast, and at the same time very interested in vehicle telematics, which is basically about measuring my car’s performance and recording my driving history. That's why I started this project two years ago which is now named - Project Freematics.
The name of Freematics stands for Free (as in freedom) and Telematics. The goal of this project is to make it possible, accessible, and affordable for people, especially makers, to carry out vehicle telematics projects with open-source hardware, especially Arduino, the most popular single-board microcontroller platform.
Telematics, more specifically vehicle telematics, refers to the use of telecommunications and informatics systems within road vehicles. Practical applications of vehicle telematics include:
- Vehicle data logging and analysis
- Vehicle tracking
- Mobile data transmission
- Wireless vehicle safety communications
- Intelligent vehicle technologies
- Car clubs
- Auto insurance
The core of most vehicle telematics projects is the data, including vehicle ECU data, GPS data and some sensor (e.g. accelerometer) data . A motor vehicle works as a closed systems for many reasons. The OBD-II port, equipped in most modern cars as a compulsory standard, opens up a gate to the internal status of a car. OBD-II is no longer only used by professionals and hobbyists to repair vehicles. The information it provides is commonly used by vehicle telematics devices that perform fleet tracking, monitor fuel efficiency, prevent unsafe driving, as well as for remote diagnostics and by Pay-As-You-Drive insurance. Although originally not intended for the above purposes, commonly supported OBD-II data such as Vehicle Speed, RPM, and Fuel Level allow fleet tracking devices to monitor vehicle idling times, speeding, and over-revving.
In 2009, I bought a new car and was so excited about it. I got a USB version ELM327 adapter and tried to pull out some information from my car, so that I could have more to share at local car club gathering. I found some open-source software written for ELM327 and was absorbed in all these as my programmer background and automotive passion joined together. Soon I managed to write an application running on my Windows Mobile phone showing a dashboard on the phone's screen with data retrieved from the car.
In 2010, I got to know Arduino, which really broadened my mind. I managed to get ELM327 to work with Arduino and developed an Arduino library to making it more easily for other people.
Made for Arduino
Together with a friend who is a hardware guy, we tried to make an Arduino friendly solution for OBD-II access. Our implementation was based on a STM32 and a MCP255. After this was done, we were able to access all available OBD-II PIDs. We also managed to put in a MPU6050 module as motion sensor useful for measuring car's lateral G-force. This product started to deliver in mid-2012 and is known as OBD-II Adapter for Arduino.
Made with Arduino
After an initial user base was established, we kept on thinking of new possibilities of the hardware. I felt it might be a good idea to integrate an Arduino into the adapter, together with some useful peripherals, so that the adapter can work standalone as a smart device. With mass storage, it could work as a vehicle data logger. With wireless communication, it could stream out live or history data to mobile devices. With GPS module, it could become a location aware device and record driving routes. Finally these thoughts brought up Freematics OBD-II Adapter.
Integrated with an Arduino compatible AVR MCU, Freematics OBD-II Adapter is programmable exactly as an Arduino board with access to OBD-II data and onboard peripherals through Arduino libraries.
- ATMega644PA as main controller (Arduino compatible)
- STM32 as protocol processor (CAN, KWP2000, ISO9141-2, GPS NMEA)
- MPU6050 as motion sensor (accelerometer and gyro) and temperature sensor
- Onboard BLE (or Bluetooth 2.1) for wireless data communication with iOS and Android devices
- microSD socket (up to 32GB mass storage)
- Optional lead-out cable for SPI, I2C or UART and power output
- Optional built-in GPS receiver
Difference from all other OBD-II readers
Many people may compare all those widely available OBD-II readers with Freematics OBD-II Adapter. The following table shows their significant differences.
Freematics OBD-II Adapter can be programmed with Arduino IDE, just like programming an Arduino board.
Compiled sketch are downloaded to the adapter through ICSP (SPI pins) with USBasp or simply Arduino as ISP.
For more information about programming the Freematics OBD-II Adapter, please refer to the programming guide.
There is no worry if you don't do any programming. We will publish different ready-to-go firmware for the adapter in the future.
What can it really do?
For more information about programming the Freematics OBD-II Adapter, please refer to the programming guide What can it really do?
It can do a lot with enough imagination, as it is fully programmable and can work standalone. Here are some possible or carried-out applications of Freematics OBD-II Adapter.
Vehicle data and GPS track logger
The most straight-forward purpose of Freematics OBD-II Adapter is vehicle data logging. Driving routes can be recorded together with real-time vehicle data. The logged data can be later illustrated and analyzed for various purposes. The on-board BLE module provides connectivity with mobile devices which can also be used as the data terminal.
Before we can have a real fancy data terminal software, we have already set up an online data charting service which accepts and illustrate data log files generated by our data logger sketches into interactive chart and Google Earth track.
Controller and power supply for other hardware
As Arduino-compatible micro-controller is embedded, Freematics OBD-II Adapter can control other hardware by data interfaces like I2C or SPI (with lead-out cable) and make the hardware interacting to real-time vehicle data. An example is a HUD (head-up display) made of 8×8 RGB LED matrix driven by I2C (as slave device), powered and controlled by the adapter's built-in MCU.
Providing vehicle and GPS data for another hardware system
Freematics OBD-II Adapter connect with another hardware system, for example, an Arduino with TFT shield when live data display is required, an Arduino with GPRS shield when Internet connectivity is needed, or when car video is to be recorded with overlaid vehicle data. The following video is a real case we have done with the adapter and a tablet PC installed in car.
Smart vehicle monitoring/testing device
Running a sketch that monitors vehicle's status (sensors and trouble code), the adapter can work as a smart vehicle monitoring device which can signal you by attached buzzer, LCD, or LED when your vehicle has any incurred or potential problems. It can also works for vehicle testing or performance benchmarking. A real example is an Arduino device with OLED display attached to the adapter, working like a Performance Box which monitors car's acceleration procedure and display the acceleration time (0~60km/h, 0~100km/h, 0~200km/h).
After working out the hardware, our focus is now on making better software for the hardware. If hardware is the body, software is the soul. As a smart programmable device, Freematics OBD-II Adapter requires software (or more precisely firmware) running on it to achieve different functionality. As an Arduino device, the software running on it is called sketch. We have already developed several sketches for functionality test and will publish more different open-source firmware for different purposes.
All open-source firmware (sketch) we provide for Freematics OBD-II Adapter can be downloaded from GitHub. One firmware available now named datalogger is a good example to start with. It turns Freematics OBD-II Adapter into a OBD-II data logger and transmitter. Data is logged to microSD card and at the same time transmitted wirelessly to smartphone. This is also the pre-flashed firmware for Freematics OBD-II Adapter to be shipped. It makes the adapter work out-of-box with the iOS App named Freematics OBD (already available in App Store). The App can display live data received from the car and perform some car performance benchmarking.
Actually a fancy smartphone App is the most significant part of our future development and that is what we mainly funding for. A user-friendly and feature-rich App will definitely unleash the power of Freematics OBD-II Adapter.
A professional vehicle data measurement and analysis tool, with identical features of VBOX Circuit Tools, working on smartphones and tablets is our current direction.
Our goal is to implement following features in our future App:
- Loading history data stored in Freematics OBD-II Adapter
- Illustrating collected data into more professional and fancy charts
- Video logging in sync with data logging
- Video replay with overlaid data
- Lap timer
- Car performance benchmarking and comparison
- Re-programming / updating firmware for Freematics OBD-II Adapter
I (Stanley Huang) am the initiator and the core developer for this project. I started learning programming since age of 9 (1990). Being a young programmer for many years and later majored in electronics in university, I had accumulated rich experience and expertise in both software and hardware design and development. After working as full-time software engineer for 3 years, I started developing and maintaining MediaCoder since 2005, which has taught me what's important for creating a popular product.
The ability of an individual is always limited. While I have been focusing on the product design and coding for firmware, Arduino sketches/libraries and PC software, my team (members are all part-time at the moment) works out the hardware design (PCB), smartphone App development and website/graphic design. Our team has co-worked for 3 years and is very productive.
Timeline & Funding Goals
Most of our rewards are ready to ship right after the campaign succeeds.
The BLE module can be substituted with Bluetooth 2.1 module. If Bluetooth 2.1 is needed, please leave a note to us.
For BLE version, a TI CC2540 based module is used for transparent serial communication with BLE enabled devices, like latest iPhone or iPad and some Android devices. App-side programming is required. So we also provide an App called Freematics OBD for use with our pre-developed Arduino sketches.
For BT 2.1 version, a CSR BC417 module is used for transparent serial communication with Bluetooth enabled devices, including most laptops and many existing mobile devices (except iOS devices).
Backers will have chance to choose the version of Bluetooth in the survey after the campaign succeeds.
For the GPS included version of Freematics OBD-II Adapter, a Fastrax UP501 10Hz GPS module with self-contained ceramic antenna will be embedded and wired to the STM32 processor. The programmable AVR chip queries GPS data with AT commands.
A cable of 4-pin or 6-pin can be led out from the adapter for providing I2C or SPI data connection and 5V/3.3V (up to 2A) power output. Backers will have the chance to specify the type of cable, the output voltage, the connector type and pin order in the survey after the campaign succeeds.
USB BLE Dongle
USB BLE dongle is a USB device which adds BLE communication capability to a desktop or laptop PC. The BLE version of USB dongle is based on TI CC2540. The Bluetooth 2.1 version is also available and is based on CSR chip.
With the dongle, PC can exchange data with Freematics OBD-II Adapter through BLE. The wireless connection can also used for serial debugging and firmware updating. All that is needed on the PC is just a serial terminal program.
Freematics OBD-II Dev Bundle
The bundle includes Freematics OBD-II Emulator. The emulator provides OBD-II port identical to that in a real car and simulates data bus of a real car. It provides an efficient way for testing and debugging OBD-II applications without the need for a real car and consuming fuels. The values of OBD-II PIDs can be adjusted by the 9 physical knobs. The list of 9 adjustable PIDs can be customized. Backers will have the chance to specify the list of OBD-II PIDs (or just keep the default set-up) in the survey after the campaign succeeds.
Arduino OBD-II/GPS Data Logger Kit (Final spurt reward)
This kit is a combination of hardware parts putting up a complete OBD-II and GPS data logger kit with Arduino sketch (source code) and libraries which make it ready-to-go. This kit is the device appearing in the top banner and is the most popular product in our hardware store. See here for more information about the kit.
Head-Up Display Kit (Final spurt reward)
This kit puts up a head-up display which is exactly same as in the video above. It is made up of a Freematics OBD-II Adaper (with 4-pin I2C cable) and a I2C-driven 8x8 RGB LED matrix. The head-up display sketch (source code) is also provided, which allows forward and mirrored projection.
Yes, we need the funds. There is still plenty of work to be done and that's why we are here. In addition to lowering the per-unit cost by enlarging the scale of hardware manufacturing, the funds will allow us to devote more time (so that my fellow team members may work full-time on this project) and allocate more resources to building up good software and services for the hardware. They are:
- Developing more useful Arduino sketches (open-source firmware) for running on Freematics OBD-II Adapter
- Implementing remote programming via BLE
- Developing the App described above for both iOS and Android
- Developing and publishing a SDK that simplifies App developers' work for developing a vehicle aware App
- A cloud-based service for storing and retrieving vehicle data (live and historic)
Finally thanks for your support! We will cherish your trust and are really looking forward to devoting all our expertise to the realization of our ideas and plans that we, and hopefully you, are really excited about.
Risks and challenges
The hardware design was already proven as a batch of production of Freematics OBD-II Adapter (without GPS) has already been undertaken and delivered to some beta users. The GPS version has not been formally manufactured yet as we need a higher volume of orders to help us to lower the per-unit price, but the prototype was already fully verified. We will also need to face the challenge of large scale manufacturing. The good news is that everything about the manufacturing is ready to roll out and we have good and established access to the world's manufacturing center - Shenzhen China.
A good smartphone App is our goal and is so important that it will significantly improves the usability of the hardware (making it not only useful for makers). We have already practiced developing a basic App for iOS which is able to receiving and show live data streamed out by the adapter. The development of a sophisticated App requires a great amount of time and effort. The given time frame of the development is an estimation and may affected by various factors.
The cloud-based service is our bigger idea and is the most challenging part. We have so many ideas about it. Setting up and running the service will require us to further expand the team, which could only be carried out with greater amount of funds.Learn about accountability on Kickstarter
The adapter gets power from the DC output from the OBD-II port.
For wired programming, it can be done on your desk with SPI (which also provides power). For future wireless programming, you can program the adapter in your car with it plugged in the OBD-II port, or providing DC 12V feed for it some way else (e.g. by using Freematics OBD-II emulator).
They are interfaced with serial UART (Serial1 in Arduino). ELM327 alike AT command-set is used as data interface
The following link is a complete list of standard OBD-II PIDs.
However, the number of supported PIDs varies with different car makes.
The OBD-II PIDs are polled one after another. The time for a polling depends on the speed of car’s ECU computer and how busy the computer is in different status. With a typical modern car with CAN bus, the time can be as low as 20ms. In other word, up to 50 times of data polling can be done in one second.
The BLE module provides transparent serial communication via BLE. The module appears in Arduino as Serial. No special API is required on the Arduino side for perform data communication (the only limit is sending no more than 20 bytes of data for once) . On mobile device side, we will publish some sample code (and hopefully SDK) for developers building their own App. If you want to transmit data to your laptop via BLE, a BLE USB dongle is required as most laptop doesn't support BLE (Bluetooth 2.1 is supported instead).
Most existing OBD-II Apps use Bluetooth or WIFI for connecting with OBD-II reader. Freematics OBD-II Adapter (with Bluetooth 2.1) can be used to emulate a conventional ELM327 compatible Bluetooth OBD-II reader with a sketch that proxies the ELM327 AT commands and responses via Bluetooth. As there is not any known general-purpose OBD-II App using BLE for connection at the moment, BLE version of Freematics OBD-II Adapter is not likely to work with existing Apps.
The GPS module in the GPS version is wired to the signal processor and the receiving NMEA is decoded by that processor. The parsed data (latitude, longitude, altitude, date, time, no. of satellite) can be fetched by the AVR chip (Arduino) with AT command via serial UART, with very little overhead and processing time on the AVR chip. The operation is encapsulated in the provided Arduino library for the adapter.
If the adapter can be fed with 12V DC via OBD-II connector (VCC @ pin 16, GND @ pin 5/6) but not plugged in a real OBD-II port, all the features (accelerometer, gyro, temperature, microSD, BLE, GPS), except for OBD-II of course, will still work. So technically it is still useful with vehicles without OBD-II port.
Freematics OBD-II Adapter is a programmable OBD-II device which can work standalone. So it's not just a OBD-II reader. Basically that's the difference between a temperature meter and a computer. You may not know anything about programming. But a programmable device still give a freedom to alter it's functionality by flashing the firmware which we will and possibly the community will also provide. Freematics OBD-II Adapter can interact with smartphone with Bluetooth Low Energy (more power efficient than WIFI), so it is able to work as a OBD-II reader but obvious it can do much more than that. For example, it can not only push live data to your smartphone but also history data stored in the device. Moreover, it can interact or control other hardware devices, like an Arduino, a LED strip or a LED matrix. It is Arduino compatible and that makes it very easy to be programmed and turned into a device with a user designed behavior and accomplishing a typical or special task without the need of a smartphone which has to be turned on and consuming battery.
Support this project
- (47 days)