Closed bborisov567 closed 2 years ago
Run the code with the lib in debug mode and post BOTH the sketch and the debug printouts. Be sure to use proper code tags
I did some more testing ang got the following results: Functions:
rpm()
mafRate()
intakeAirTemp()
work correctly!
But the functions:
engineCoolantTemp()
shortTermFuelTrimBank_1()
shortTermFuelTrimBank2()
don't work.
I attach the debug return as a text file because line formatting is lost when i paste it. Here is my code, i change the function accordingly every time. debug_return.txt
#include <SoftwareSerial.h>
#include "ELMduino.h"
SoftwareSerial mySerial(2, 3); // RX, TX
ELM327 myELM327;
uint32_t rpm = 0;
void setup()
{
Serial.begin(115200);
mySerial.begin(38400);
myELM327.begin(mySerial, true, 2000);
}
void loop()
{
float tempRPM = myELM327.shortTermFuelTrimBank_2(); // I change the function here.
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();
}
When the ELM327 responds with "STOPPED" it means the Arduino sent data to the scanner before it was finished with the current query. Not sure why that would happen, but perhaps try adding some delays? Otherwise, I'm not sure how to fix.
Adding 1000ms delay did indeed helped! One last question - is it possible the returned trim value to go negative or the library calculates the value to be always positive?
Yes, it can go negative. I used the formula found on the OBDII PID wiki:
Okay, than you!
I have a problem with reading PIDs. When requesting data through directly from the ELM device through Terminal i get a correct response, also ELM is working fine with the Android app. With intakeCoolanttemp() i am getting a value of 168 on a cold engine. With manifoldPressure() i am getting a value of 208 that is not changing. With rpm() i am getting value of 0, on a running engine. There is definatelly something wrong. COnncetion between ELM and arduino is ok. I am using the example code. https://imgur.com/uhBQyaS https://imgur.com/lyM69La