Hey everyone , i've been trying to get information from a standard elm327 bluetooth adapter for the past days with no success, i managed to connect and i get blinking everytime i send a command from the serial monitor, but it is always responding "No Data".
Ps: I tried two different ELM327 adapters and the output was the same
The HC-05 is version 3.0 and its responds to "AT+STATE" with "Connected"
Any help is appreciated since this is for a important university project.
Code:
#include <SoftwareSerial.h>
#include "ELMduino.h"
SoftwareSerial mySerial(2, 3); // RX, TX
#define ELM_PORT mySerial
ELM327 myELM327;
uint32_t rpm = 0;
void setup() {
#if LED_BUILTIN
pinMode(LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
#endif
Serial.begin(38400);
ELM_PORT.begin(38400);
Serial.println("Attempting to connect to ELM327...");
if (!myELM327.begin(ELM_PORT, true, 2000)) {
Serial.println("Couldn't connect to OBD scanner");
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 if (myELM327.nb_rx_state != ELM_GETTING_MSG)
myELM327.printError();
}
Serial Monitor Output:
Delimiter found.
All chars received: 010C1NODATA
ELM responded with errror "NO DATA"
Received: 010C1NODATA
ERROR: ELM_NO_DATA
Service: 1
PID: 12
Normal length query detected
Query string: 010C1
Clearing input serial buffer
Sending the following command/query: 010C1