ELMduino: ELM_TIMEOUT

Hi, i tried this code that i got from https://forum.arduino.cc/t/elmduino-library-for-car-hacking/593482/16#msg4679253

#include "ELMduino.h"

BluetoothSerial SerialBT;
#define ELM_PORT SerialBT
#define DEBUG_PORT Serial

//String MACadd = "00:10:CC:4F:36:03"; //enter the ELM327 MAC address
uint8_t address[6] = {0x00, 0x10, 0xCC, 0x4F, 0x36, 0x03}; //enter the ELM327 MAC address after the 0x

ELM327 myELM327;

uint32_t rpm = 0;

void setup()
{
#if LED_BUILTIN
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
#endif

DEBUG_PORT.begin(115200);
//SerialBT.setPin("1234");
ELM_PORT.begin("ArduHUD", true);

if (!ELM_PORT.connect(address)) //"OBDII" replaced by "address"
{
DEBUG_PORT.println("Couldn't connect to OBD scanner - Phase 1");
while (1);
}

if (!myELM327.begin(ELM_PORT,true, 2000, AUTOMATIC))
{
Serial.println("Couldn't connect to OBD scanner - Phase 2");
while (1);
}

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
{
myELM327.printError();
}
}

void printError()
{
Serial.print("Received: ");
for (byte i = 0; i < myELM327.recBytes; i++)
Serial.write(myELM327.payload[i]);
Serial.println();

if (myELM327.nb_rx_state == ELM_SUCCESS)
Serial.println(F("\tELM_SUCCESS"));
else if (myELM327.nb_rx_state == ELM_NO_RESPONSE)
Serial.println(F("\tERROR: ELM_NO_RESPONSE"));
else if (myELM327.nb_rx_state == ELM_BUFFER_OVERFLOW)
Serial.println(F("\tERROR: ELM_BUFFER_OVERFLOW"));
else if (myELM327.nb_rx_state == ELM_UNABLE_TO_CONNECT)
Serial.println(F("\tERROR: ELM_UNABLE_TO_CONNECT"));
else if (myELM327.nb_rx_state == ELM_NO_DATA)
Serial.println(F("\tERROR: ELM_NO_DATA"));
else if (myELM327.nb_rx_state == ELM_STOPPED)
Serial.println(F("\tERROR: ELM_STOPPED"));
else if (myELM327.nb_rx_state == ELM_TIMEOUT)
Serial.println(F("\tERROR: ELM_TIMEOUT"));
else if (myELM327.nb_rx_state == ELM_TIMEOUT)
Serial.println(F("\tERROR: ELM_GENERAL_ERROR"));

delay(100);
}

Problem: ELM_TIMEOUT

Some description: It was successfully connected based on output on the serial monitor and green light on ELM 327. But there is no blue light on ESP32, only red light which seems that the ESP is only turned on but there’s no connectivity. Correct me if I’m wrong. But I’m not sure if this is related to the ELM_TIMEOUT. I also tried your suggested solution but nothing happened. When I did the AT command, nothing comes out too. Is there any error in the code? I appreciate your time in looking into it.

About this issue

  • Original URL
  • State: closed
  • Created 2 years ago
  • Comments: 18 (9 by maintainers)

Most upvoted comments

thank you so much, I’ll try the suggested example and library. will update the outcome later