Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I'm only explaining how you can retrieve data from the OBD-II device by sending data to it, because in my understanding that's the problem you're struggling with.</p> <p>OBD-II will never send data on it's own, it listens for a command you send and based on that command it will send an answer. So basically you have to do two things if you have a running connection:</p> <ul> <li>Send the correct commands to the OBD-II device.</li> <li>Parse the answers into human-readable data.</li> </ul> <p>The ELM327-bluetooth-connector you have translates ASCII commands to voltages. So all you have to do, is send some ASCII commands, and you get ASCII-values back. </p> <p>The OBD protocol knows several modes and parameter's, but I will explain to get real-time data. That's mode 1.</p> <p><strong>Mode 1 Sending</strong><br> Mode 1 is '01'. After that part, you have to send a parameter ID with it. 0C is for RPM, 0D is for speed. And after each command you have to send a Carriage Return. (CR = '\r') So the connector knows when a request is complete.</p> <p>So basically, for speed, you have to send:</p> <pre><code>'010D\r' </code></pre> <p><strong>Receiving Mode 1</strong><br> 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.</p> <p>Example:</p> <pre><code>'410D17' </code></pre> <p>So 17 is the value of your current speed in hex. 17 to decimal is 23, so you're driving with 23 km/h.</p> <p>This wikipedia page has some good information about it:<br> <a href="http://en.wikipedia.org/wiki/OBD-II_PIDs">OBD-II Parameters</a></p> <p>And for the bluetooth part:</p> <p><strong>STEP 1: Connect to the desired device over RFCOMM</strong></p> <pre><code>PeerFinder.AlternateIdentities["Bluetooth:PAIRED"] = ""; var available_devices = await PeerFinder.FindAllPeersAsync(); if (available_devices.Count == 0) { return false; } else { PeerInformation pi= // Get the required device using // index or searching for the device name } StreamSocket socket = new StreamSocket(); await socket.ConnectAsync(pi.HostName, "1"); </code></pre> <p><strong>STEP 2: Direct winsock to perform an SPP lookup</strong></p> <pre><code>await socket.ConnectAsync(pi.HostName, pi.ServiceName); </code></pre> <p>Source: <a href="http://developer.nokia.com/Community/Wiki/Introduction_to_Bluetooth_support_on_Windows_Phone_8">Windows Phone 8 Bluetooth SSP</a></p> <p>I hope this helps you out, I'm getting excited about it. ^^ If you need help, let me know.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload