4
votes

Currently I am working on an app where I have established a connection with OBD II ELM 327 adapter and I can read data from OBD II. e.g. I have used OBD command "01 0C" to get rpm of vehicle.

I want to retrieve real time data e.g. speed or rpm from vehicle. This is the point where I am stuck. I am not getting - "How I can continuously fetch such real time data from vehicle?

I know, OBD II is responding to my every AT or OBD command. What I think is, if I send any command to OBD II adapter repeatedly, it will send data back every time.

Can anyone tell me, how I can send single command e.g. "01 0C" continuously? Which method I should use to fetch real data from vehicle?

Please, someone guide me to sort out this. Any guidance will be a great help.

Thank you.

1
I am still not finding the best way for reading real time data from OBD II. I think, I can use service where I will send single command continuously and fetch response from adapter. Please help me and let me know whether this is the best approach or not. Thank you all.KavitaDev
There are some AT commands that you can configure to send an unsolicited response (for example, +CREG sends mobile network information every time the signal strength changes). Do any of your AT commands or OBD commands support Unsolicited Responses? If not, then I guess polling is the solution, as you said.user1725145
Thanks S List for your prompt response. OBD commands do not support Unsolicited Responses. Instead of using Service, is there anything else which I can use? If yes, what could be the other options? Thanks again.KavitaDev
Someone has already asked the same question here: stackoverflow.com/questions/9942174/pulling-data-from-elm327 and the accepted answer says that there is no other option except asking the device.user1725145
I have gone through the link specified by S List. Initially, I was trying to use loop in a separate thread for sending AT command repeatedly. But, It didn't work. Above link has mentioned that we can get unsolicited responses from ELM327 if it is set into a monitor mode. How to set ELM327 device into monitor mode? I have searched on internet, but I didn't find any appropriate help. Please someone help me...KavitaDev

1 Answers

0
votes

To perform continuous communication with an OBD-II ELM-327 there is no other option than to ask the device periodically for the data. I've done that succesfully for an application.

Also, check Eric Smekens' answer in the following thread:

Send multiple OBD commands together and get response simultaneously

to speed up communications.