Closed githubUnknownUser closed 2 years ago
What year is your car? If it was made before 2008 I can't guarantee this library will work with your car. If your car was made after 2008, your ELM327 is most likely faulty and should replace it with a new one. I've had good luck with these units
My car is from 2010, But the stranger thing is that the module works fine with phone apps. I'm using the latest version of the library. I've noticed that the bytes 0 and 3 seem to carry the information... I don't know what to do
If different bytes carry the info, you can use lower level functions of the library to directly query the PID and use the built-in response byte objects to process the data yourself in the sketch.
Good evening, @PowerBroker2! Congratulations on the amazing job you did here!!!
I'm trying to use the library but I'm facing some problems. First, let me give you a hint of my hardware setup:
2010 Honda -> ELM327 -> ESP32-WROVER-B (Bluetooth)
I tried the default example code but I couldn't get the esp to connect, so I took some code from the BluetoothSerial library and then worked.
When I tried to use the default ELMduino initializer (Auto protocol detector) I got 'ERROR: ELM_TIMEOUT'.
When I set the protocol, the setup completes gratefully, but I'm getting random reads using 'myELM327.rpm()'.
I've tried some workarounds like the #123 or #92 but unfortunately, none of them worked for me.
Can you help me? I might be doing something wrong...
Here's my code and the Logs: (The Bluetooth connection is an absolute mess but I waiting for everything to workout first to clean it)
'
include "BluetoothSerial.h"
include "ELMduino.h"
BluetoothSerial SerialBT;
define ELM_PORT SerialBT
define DEBUG_PORT Serial
define BT_DISCOVER_TIME 10000
esp_spp_sec_t sec_mask = ESP_SPP_SEC_NONE; // or ESP_SPP_SEC_ENCRYPT|ESP_SPP_SEC_AUTHENTICATE to request pincode confirmation esp_spp_role_t role = ESP_SPP_ROLE_SLAVE; // or ESP_SPP_ROLE_MASTER
ELM327 myELM327;
uint32_t rpm = 0;
void bluetoothConnect();
void setup() { bluetoothConnect();
// while (!myELM327.begin(ELM_PORT, true, 2000, '4')) { while (!myELM327.begin(ELM_PORT, true, 2000)) { Serial.println("Couldn't connect to OBD scanner - Phase 2"); }
Serial.println("Connected to ELM327"); }
void loop() { float tempRPM = myELM327.rpm();
if (myELM327.nb_rx_state == ELM_SUCCESS) { rpm = (uint32_t)tempRPM; Serial.print("RPM: "); Serial.println(rpm); } else if (myELM327.nb_rx_state != ELM_GETTING_MSG) myELM327.printError(); }
void bluetoothConnect() { Serial.begin(115200); if (!SerialBT.begin("ESP32test", true)) { Serial.println("========== serialBT failed!"); abort(); }
Serial.println("Starting discoverAsync..."); BTScanResults btDeviceList = SerialBT.getScanResults(); // maybe accessing from different threads! if (SerialBT.discoverAsync([](BTAdvertisedDevice pDevice) { // BTAdvertisedDeviceSetset = // reinterpret_cast<BTAdvertisedDeviceSet>(pDevice); // btDeviceList[pDevice->getAddress()] = * set; Serial.printf(">>>>>>>>>>>Found a new device asynchronously: %s\n", pDevice->toString().c_str()); })) { delay(BT_DISCOVER_TIME); Serial.print("Stopping discoverAsync... "); SerialBT.discoverAsyncStop(); Serial.println("discoverAsync stopped"); delay(1000);
} else { Serial.println("Error on discoverAsync f.e. not workin after a \"connect\""); } } , hondaObd2.txt LogAutoProtocol.txt LogSettingProtocol.txt