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
COBD obd; // - Declare OBD object
int currSpeed, distance, fuelLevel, engineLoad, rpm;
obd.begin(); // - Start communication with OBD-II UART adapter
while (!obd.init()); // - Initiate OBD-II connection until success
Serial.println("OBD-II STATE: " + String(obd.getState()));
Serial.println("VOLTAGE: " + String (obd.getVoltage()));
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!
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).