Code Monkey home page Code Monkey logo

bluetooth-obd-ii-diagnostic-tool's Introduction

Bluetooth OBD-II Diagnostic Tool

The aim of this project was to create an Android application capable of connecting via a Bluetooth adaptor to the OBD2 car diagnostic socket (in vehicles supporting this protocol) and serve the communication with car's ECU. Application is capable of deciphering, formatting and visualising most of the signals generated by the ECU in real time, as well as providing support to all of the OBD operating modes. To test its functionality, multiple test runs were performed on 2016 Mitsubishi ASX, 2005 Fiat Panda and 2004 Seat Leon.

https://en.wikipedia.org/wiki/OBD-II_PIDs

This project was done using Android Studio.

Screen captures from the App

App ss

Running the application

The application is available for install via the built .apk file in the main directory. To connect with car's ECU, an OBD-2 ELM327 Bluetooth adapter is needed. ELM327 is a ELM Electronics microcontroller designed to translate the signals generated by SAE J1962 diagnostic socket into a byte stream. A standard single message transmitted by the adapter is encoded in 4 bytes long message, called OBD frame. Each byte in the frame has different meaning, an in-depth overwiev of bit-wise OBD frame decryption can be found in the relevant Wikipedia. article, or in my pdf thesis file (as for today available in Polish only):

<--- NOTE --->
IN ORDER TO TEST THE APP YOU NEED A ELM327 BLUETOOTH ADAPTER
<------------>

Response calculators

Flow for handling terminal response:

flow

Example response calculator method:

calculator

Types of coding

Arithmetic

Responses coding in this way are mostly current "live" parameters that the OBD system is queried in MOD 1 and MOD 2. Each of the PID parameters has a formula embedded - a mathematical equation, which result equals to a value that represents a specific physical value or state. The equations can be found on Wikipedia page

aritmetic

Bit-wise

This coding assumes that each and every bit of the response carries a meaningful information, thus each needs to be decoded individually. In the example below, the response is sent on 4 bytes. Each of the bytes is parsed from HEX to 8-bit and then each bit is being looked up

bit

DTC coding

Bit-coding is also fundamental for MOD 3 and MOD 7, the DTC modes. A single DTC is coded on 2 bytes, therefore OBD can send up to three DTC codes in a single frame. In this case, the DTCResponseManager separates the butes from each other and each is sent to DTCBuilder which also workes on bit-wise coding

DTC

Numeric coding

These types of responses are usually reserved for static values, which depending on the vehicle may come in various forms, but they usually represent information that is fixed and doesn't change over time, like f.ex. type of fuel the given engine runs on

numeric

ASCII coding

A narrow type of parameters is encoded in ASCII format, it comes on a larger quantity of bytes (from a dozen to even more). They're mostly queries of serial numbers like VIN, CID or engine ECU driver ID's. In that case, one byte in HEX form represents one character from ASCII table

ASCII

Example outputs

Received from various tests on 2016 Mitsubishi ASX, 2005 Fiat Panda and 2004 Seat Leon.

examples

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.