androidbluetoothobd-ii

how to request OBD parameters and receive them


I'm new to android and I thought to develop a bluetooth app to retrieve parameters from an OBDII device. I have downloaded the sample bluetooth chat application and configured it. The problem is how and what is the message that I need to send to the OBDII device in order to receive the parameters? and how should I handle them in the application side?

Thank you.


Solution

  • You're question is not very specific, but I will give you some guidelines.

    First of all, test with an exisiting OBD-II reader application if your car actually works.

    The ELM327-bluetooth-connector you have (I assumed it's a ELM327) translates ASCII commands to voltages. So all you have to do, is send some ASCII commands, and you get ASCII-values back.

    The OBD protocol knows several modes and parameter's, but I will explain to get real-time data. That's mode 1.

    Mode 1 Sending
    This is kinda simple as it is. Mode 1 is '01'. After that part, you have to send a parameter ID with it. 0C is for RPM, 0D is for speed. (Look into the link below). And after each command you have to send a Carriage Return. (CR = '\r')

    So basically, for speed, you have to send:

    '010D\r'
    

    Receiving Mode 1
    The answer you will get back from a Mode 1 query, starts with '41'. After that the parameter ID is returned, and then the value. The value is most of the time in hex. You will have to do some conversion to read a human readable value. For more information, see the link, as formula's to convert are provided too.

    Example:

    '410D17'
    

    So 17 is the value of your current speed in hex. 17 to decimal is 23, so you're driving with 23 km/h.

    This wikipedia page has some good information about it:
    OBD-II Parameters