#7766
Hello Marco,

Sorry I haven't played this module before, but I think I could help a bit.

The wire color might be changed, while the tutorial about the wiring not. And you can let it go, just wire them up to see if it works?

Red&Black - power supply 5V
green-Tx or Rx(I am not sure)
white-Rx or Tx(opposite to green)
#7772
Hi leff,

The doubt was about the connected end of the red and black wires, the corresponding pins (5v and gnd) on the board are separated by the RST one.
Btw I tried the hard way and as you said the correct configuration is:
red - 5v
black - GND
white - TX
green - RX

Thank you for support,

Marco
#7881
I'm getting an unable to connect message when writing 'writeUARTMessage("010C\r\n");' to the device.

Here's my Init code:

writeUARTMessage("ATZ\r\n");
responseMsg = waitForMessage(100);
writeMessage(responseMsg);
delayTenUs(100000);
writeUARTMessage("ATE0\r\n");
responseMsg = waitForMessage(100);
writeMessage(responseMsg);
delayTenUs(100000);
writeUARTMessage("ATL1\r\n");
responseMsg = waitForMessage(100);
writeMessage(responseMsg);
delayTenUs(100000);
setProtocol(PROTO_AUTO);
writeUARTMessage("ATDP\r\n");
responseMsg = waitForMessage(100);
writeMessage(responseMsg);
delayTenUs(100000);



Where:

bool setProtocol(OBD_PROTOCOLS h)
{
char buf[80];
if (h == PROTO_AUTO) {
writeUARTMessage("ATSP00\r\n");
} else {
sprintf(buf, "ATSP%d\r\n", h);
writeUARTMessage(buf);
}
responseMsg = waitForMessage(10);
if(strcmp(responseMsg,"") == 0) {
return false;
}
else {
return true;

}
}

Should i ask for a replacement part?
#8227
Hey guys. I hope that someone is still viewing this thread. I have recently purchased the OBD-II Adapter for Arduino - Model A (UART) as I am working on a project that needs to read dfrobot vehicle data.

I have tried the following code to get some vehicle data and display it.

Code: Select all
#include <Arduino.h>
#include <Wire.h>
#include <OBD.h>

COBD obd; // - Declare OBD object
int currSpeed, distance, fuelLevel, engineLoad, rpm;

void setup()
{
  Serial.begin(115200);
  Serial.println("Started");

  obd.begin(); // - Start communication with OBD-II UART adapter
  while (!obd.init()); // - Initiate OBD-II connection until success
}

void loop()
{
  Serial.println("OBD-II STATE: " + String(obd.getState()));
  Serial.println("VOLTAGE: " + String (obd.getVoltage()));

  obd.read(PID_RPM, currSpeed);
  obd.read(PID_DISTANCE, distance);
  obd.read(PID_FUEL_LEVEL, fuelLevel);
  obd.read(PID_ENGINE_LOAD, engineLoad);
  obd.read(PID_RPM, rpm);

  Serial.println(currSpeed);
  Serial.println(distance);
  Serial.println(fuelLevel);
  Serial.println(engineLoad);
  Serial.println(rpm);
}


The OBD state and the voltage can be read successfully, so no problems there. The problem is with the PIDs. I keep getting values of 0 printed for each of the vehicle data.

Also, when using read() the data displayed becomes really slow. If I comment out the obd.read() lines and keep the state and voltage, then that data is displayed a lot of times in a second, however when reading the PIDs, this gets a lot slower, like once per 5 seconds.

I'm pretty sure it is connected correctly. I am using the MEGA 2560 and I connected the RX and TX to pins 18 and 19 (Serial1) as instructed.

Am I doing something wrong code-wise? Thank you for reading, any input is appreciated!

---UPDATE---

It seems the PID_FUEL_LEVEL does not work. I tried retrieving vehicle data again (excluding the fuel level) and everything worked perfectly. The data is being retrieved at a fast rate as I had hoped. Also, I have discovered that as soon as one PID fails (in this case, the pid for fuel level) then the other PIDs that initially worked will also end up failing.

Did anyone else have issues with the Fuel Level PID? The vehicle I'm testing this on is a Toyota Yaris 2006 (Hatchback).
  • 1
  • 5
  • 6
  • 7
  • 8
  • 9