I'm trying to Connect and get an error message what I'm doing wrong

# Help Connect to obd2

- Show all your relevant blocks (e.g. how you make the list view elements)
- What is in your listview selection ?

Hi

First and foremost, what is the exact bluetooth version number of the OBD2 device?

Here are two samples ...

Thanks for the help

I solved the problem.

I removed the match from the cell phone and made a new one and now I can connect.

Now I have a new and more difficult problem.

I'm looking for the command that returns distance traveled

Hi,

are you sure that the CAN service that you are looking for is really available on your ECU ?

Not all the diagnostic services are available on all cars.

To know what services your ECU is supplying you have to send the following commands:

(if you use an ELM 327 OBDII interface) PID 0 to know which services between 0 and 20hex are available, PID 20 to know which services are available between 21Hex to 40hex and so on....

The annexed file could help you in decoding the bitwise answer of your ECU.(I hope ).

OBD_PIDs.pdf (723.5 KB)

Best wishes.

He is supportive. I downloaded some applications that manage to read this figure.

I could not figure out how to use the codes

Take a look to the pdf file I annexed. The explanation on how to decode each byte is reported there:

And the numbers you are showing are base 10 (decimal), while you have to consider them as hexadecimal (i.e 48d = 30Hex = '0' ASCII).

Go to https://www.asciitable.com/ and translate each number from decimal to the letter or number it represents.

I got:

```
0100\n\n<CR>?<CR><CR>> which looks like
0100
?
>
```

Does that help?

Sorry this is too hard for me.

Thanks for all the kind help somewhere I got lost.

I was naive to think I was writing a command and getting a numeric value.

I am trying to perfect the app that will know how to calculate the exact distance I traveled each trip so that I know how to price the trip.

The routes are flexible and not pre-determined and often change while traveling

I understand your concern !

To get the distance travelled I have implemented (in MIT AI2) the algorithm that performs the integral over time of the average speed in one second (timebase in millesecond). The speed is read from the OBDII line.

Maybe not the simplest way, but it works (very) precisely: the residual error on 100 kilometers is less than 100 meters.

But maybe you can use a GPS instead, and use it to compute the distance, or ask it to give you the travelled trip data, if this is your target.

Kind regards.

EDIT: I've searched in the PID's map (the file that I've annexed in my previous post) if there is the travelled distance, but there isn't. Probabably the application that you say was capable to show it, was calculating the distance with some algorithm, like I do,and not just retrieving its data on the OBD.

Second edit:

this is the basic algorithm: Clock5 is fired every 1000 ms (one sec), while the speed is read through the ELM327 from the engine ECU every 10 ms using another clock whose tick is 10 ms. Moreover since the clock5 could have a jitter, this algorithm takes into account also if the clock5 does not really ticks precisely every 1 second. I don't know if it is understandable (some variables names are in italian ) but maybe it can give you an idea. Best wishes.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.