1

I a HC-05 connected to an Arduino's Serial 3. I have also been able to successfully pair with an OBD2-ELM adapter in the car,

I have a code in my sketch to do simple communications with the OBD/ELM

if (Serial3.available()) {
    Serial.write(Serial3.read());
}
if (Serial.available()) {
    Serial3.write(Serial.read());
}

The challenge is this:
If I type ATZ, I get "ELM327 v2.1>"
I type ATTP5, I get "OK>"
Typing ATRV, returns "12.6"
But if I type 0105 I get different responses such as:
"LM327410v2 ELMv241 M2.11099", or "OK>LM7v41A" or "OK> OK > 41055.1 327v"

Other times I get the correct response of "4105 5A >"

I get the same result when I type in 0100 or any other PID code.

Please does anyone have an idea as to what might be causing this and how to fix it.

Thanks

shups
  • 31
  • 6

1 Answers1

0

First, remember that by default, the ELM327 adapter response termination is \r> (you can change this via ATL1). Directly printing this on a console will lead to problems. Try replacing \r with \n and then you should see a better output, e.g.:

>ATRV
11.9V

>0100
18 DA F1 10 06 41 00 B8 7B 30 10 00
18 DA F1 17 06 41 00 80 00 80 03 00

The actual output of course varies with whether you send a PID (such as 0100) or an internal ELM327 command (such as ATRV).

DrMickeyLauer
  • 4,455
  • 3
  • 31
  • 67