Quantcast
Channel: ArduinoDev.com
Viewing all articles
Browse latest Browse all 77

Programming Guide for Freematics OBD-II Adapter V2 (Arduino compatible)

$
0
0

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.

freematics_obd_1 freematics_obd_2

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.

Freematics OBD-II adapter breakout pins

Freematics OBD-II Adapter V2 Pinouts

SPI pins as ICSP

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:

usbasp_10pinAdapter SPI         USBasp

 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.

Wiring with USBaspProgramming 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.

freematics_obd_wiring_2

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.

arduino_ide_freematics

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:

 

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.

 

Links


Viewing all articles
Browse latest Browse all 77

Latest Images

Trending Articles



Latest Images