OBD2 and HC06

Hello,

I am trying to connect an ELM327 BT adapter to my HC06 module. The idea would be to use a builtin Arduino library to read diagnostics etc. As of now, I am unsure on how to pair both modules as the HC06 is a slave and I am not sure what really is contained in the ELM327 Adapter.

Please let me know if this is possible, or if i should consider using a different setup of modules. Thank you.

Look at this link. Might give you some ideas.
https://forum.arduino.cc/index.php?topic=617795.0

Thank you for the quick response. I have read over that link, however, I am more confused on how to actually pair the ELM327 with the HC06. That is where I am more lost.

What kind of Elm 327 device do you have? It should pair with the HCO6 like any other device.
What password are you using?

I am using this ELM327: Amazon.com

How do I actually go by pairing the two? I am going to be attempting AT commands using USB-FTDI to try and pair. Is there a more direct way of handling this?

I used the following AT commands to get my HC-05 to connect to the ELM327 for my initial car HUD prototype:

  • AT
  • AT+UART=115200,0,0
  • AT+CMODE=0
  • AT+ROLE=1
  • AT+RESET
  • AT+INQM=0,5,9
  • AT+INIT
  • AT+INQ
    (discovered the address of the OBD-II scanner is 1D:A5:1F16BB - yours might be different)
  • AT+PAIR=1D,A5,1F16BB,20
  • AT+BIND=1D,A5,1F16BB
  • AT+LINK=1D,A5,1F16BB
  • AT+RESET

Since the HC-06 doesn't have any AT command available to connect to a specific address, I don't think it's possible to connect your HC-06 to the ELM327, you will need an HC-05. Personally, I suggest using an ESP32s with builtin Bluetooth and Wifi - much simpler to pair. ELMduino.h has ESP32 specific examples.

Awesome, this is what I assumed after knowing the HC06 could not become master.

So regarding the pairing of the HC-05 and using an Arduino, once the HC-05 is configured I feel that as in ESP32_Bluetooth_Serial.ino for example, all that is needed is to use SoftwareSerial.h for communication with the ELM327.

Is this true? If it's not, which one of your examples is the best for referencing for using an HC-05?

Thanks again, your library is very promising.

michael9999:
Is this true? If it's not, which one of your examples is the best for referencing for using an HC-05?

No, you would want to use this example instead.

If you have an ESP32, however, you do NOT need an HC-05 and can simply use this example without any extra hardware (other than the ELM327).

Excellent, thank you for your help. I'll let you know how the progress goes.

@powerbroker2

I cannot seem to flash your library to my ESP32. I have tested the ESP32 using your ESP32test.ino and that works properly. When I try to use your ESP32_Bluetooth_serial.ino, at the line myELM327.being(ELM_PORT) I get a guru failure.

Do you know why this is happening?

It seems to be a recent problem that I'm not too familiar with (I don't get the errors myself), but this issue might have the fix you're looking for.

Yep, checked the issues. The solution posted works. I am able to automatically connect as well, no need for specifying protocol in the myElm.begin which is great.