3

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.

Suchith
  • 37
  • 2
  • 6

1 Answers1

7

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

Eric Smekens
  • 1,602
  • 20
  • 32
  • @user2343980 Good to know it helped you. Please accept it as an answer if you are happy with it. – Eric Smekens Jun 03 '13 at 06:17
  • Before sending a code do I need to connect to a specific protocol? or do I need to use '0100' to initiate the process? I have tested a sample app that I ve create according to you method and I've tested it by using an ELM327 adapter in perodua viva elite and a toyota hilux d4d cab. But I did't get any result.. – Suchith Jun 05 '13 at 05:36
  • Well, you can test with another OBD-II application. (Google it) If that works, your car and connector are fine, so it's your application. For Android, you can use the free version of Torque. If you send 'ATSP0\r', the elm connecter will automatically set your protocol to automatic, which should work in most cases. If that doesn't work as well, I think it's a good idea to show your code in a new question. – Eric Smekens Jun 05 '13 at 08:07
  • Do I need to set the protocol even to get the standard obd data such speed and rpm? – Suchith Jun 05 '13 at 09:08
  • You probably won't have to, but it could be that your connector is set to a wrong protocol. – Eric Smekens Jun 05 '13 at 10:20
  • can you guide me for below query :http://stackoverflow.com/questions/21334147/send-multiple-obd-commands-together-and-get-response-simultaneously – NSS Jan 25 '14 at 04:39
  • @EricSmekens app is not working with some cars. Getting "Error running 01 0D, response: NODATA " I could not able to understand why I am getting this error. Do you have any idea. – GNK Oct 16 '20 at 13:48