Freematics OBD-II Adapter V2 is a programmable device with OBD-II and GPS accessibility. Inside it is an ATMega328P (compatible with Arduino UNO) and a bunch of peripherals including accelerometer, gyro, temperature sensor, microSD socket and Bluetooth (BLE or BT 2.1) module. The adapter can optionally lead out a cable for SPI and I2C communication, or analog sensor input/output.
Hardware Programming Interface
The onboard ATMega328P is programmed via ICSP, either by USBasp or Arduino as ISP. Both ways are supported by Arduino IDE.
The 6-pin interface on the top-left is the SPI pins which is also the ICSP port for Arduino.
Programming with USBasp
A USBasp programmer has 6 useful pins. To program with USBasp , connect the adapter’s SPI pins with USBasp’s pins as following:
MISO 2-MISO
SCK 4-SCK
RESET 6-RST
GND 8-GND
VCC 5V 9-VCC (*)
MOSI 10-MOSI
* Please be cautious that as some cheap USBasp programmers do not have good impulse filtering, it is recommended that the adapter is powered from the OBD-II port (12V input) instead of USBasp’s VCC pin in order to prevent possible damage to the board by impulse current on the moment of plugging the USBasp to computer.
Programming with Arduino as ISP
An common Arduino board can work as ISP for another Arduino board with Arduin ISP sketch loaded. To program with Arduino, connect the adapter’s SPI pins to Arduino’s ICSP pins and the reset pin to Arduino’s D10.
Software Development Environment
Arduino IDE is the recommended development environment for Freematics OBD-II Adapter. Set board to Arduino UNO and everything is same as if programming an Arduino UNO.
You can then use Arduino IDE to develop program for the Freematics OBD-II adapter. Following libraries can be used for access the onboard resources of the adaper:
- Arduino OBD-II Library – for accessing OBD-II data (GPS support will be added soon)
- MPU6050 Library – for accessing accelerometer and gyro data
- SD Library – for storing and accessing data on microSD
Firmware
A basic firmware for the adapter is developed in form of an Arduino sketch. When loaded with the firmware (factory default), the adapter works with our Freematics OBD iOS App out-of-box. Users can modify the firmware source code and involve their own one or interact with their own App.
The source code of firmware is on GitHub.