#5874
[quote="alf"]
[quote="DeWitt"]
[quote="alf"]
Hi, i've recently bought this OBD adapter (model A UART) to use on a 2013 Toyota Auris. I'm using arduino UNO R3 and a Nokia 5110 screen to display data. I'm trying to display 4 PIDs: rpm, coolant temp, speed and hybrid battery percentage. It works but the refresh rate is very slow: about 5 seconds. Additionally, it also has a delay on data reading of about 5-10 seconds. What's wrong? Here is the code:

[code]#include <Arduino.h>
#include <Wire.h>
#include <OBD.h>
#include <Adafruit_GFX.h>
#include <Adafruit_PCD8544.h>

// pin 7 - Serial clock out (SCLK)
// pin 6 - Serial data out (DIN)
// pin 5 - Data/Command select (D/C)
// pin 4 - LCD chip select (CS)
// pin 3 - LCD reset (RST)
// Adafruit_PCD8544(SCLK, DIN, D/C, CS, RST);
Adafruit_PCD8544 display = Adafruit_PCD8544(7, 6, 5, 4, 3);

COBD obd;
int kmh;
int temperature;
int rpm;
int charge;

void setup()  {
  kmh=0;
  temperature=0;
  rpm=0;
  charge=0;
 
  display.begin();
  display.setContrast(50);
  display.clearDisplay();
 
  // start communication with OBD-II UART adapter
  obd.begin();
  // initiate OBD-II connection until success
  //Protocol 6: ISO 15765-4 CAN 11 bit 500 kbaud
  while (!obd.init(6));
 
}

void loop() {
 
  //Read data
  obd.read(PID_RPM, rpm);
  obd.read(PID_COOLANT_TEMP, temperature);
  obd.read(PID_SPEED, kmh);
  obd.read(PID_HYBRID_BATTERY_PERCENTAGE, charge);

  //Display data
  display.clearDisplay();
  display.setTextSize(2);
  display.setTextColor(BLACK);
  display.setCursor(3,0);
  display.print(kmh);
  display.setCursor(53,0);
  display.print(temperature);
  display.setTextSize(1);
  display.setCursor(10,16);
  display.print("km/h");
  display.setCursor(53,16);
  display.print("Temp");
  display.drawLine(0, 25, 83, 25, BLACK);
  display.setCursor(0,28);
  display.setTextSize(1);
  display.print(rpm);
  display.println("rpm");
  display.setCursor(0,38);
  display.print(charge);
  display.print("%");
  display.display();

  delay(100);

}
[/code]

Thanks!
[/quote]

I would try commenting out all the PID's except RPM and see if that updates at the correct rate.  Then add the others one at a time.  The long delay between readings sounds like one of the PID's isn't being supplied by the ECU or it's incorrectly defined.

DeWitt Payne
[/quote]

Thank you! I'll try it tomorrow.
[/quote]

I've commented out all the PIDs except RPM and it updates very fast, about ten times per second. The same happens with the other PIDs: if I only read one PID at a time, it works well. The problem occurs when I read two or more PIDs at a time. I've tried to add a delay between reading one PID and another with no success. What could be wrong?
#5877
Hi Stanley,

more ore less 2 years ago I bought one of yours obd2 to ttl adapter and I had some problems from the first time I tried it.
I wrote to you too, but the problem wasn't solved, then I had no time to work on it for a long time, and now I decided to try again.

I try to explain my problems:
when I connect it to the obd2 port of my car, the car get crazy saying "brake failure, stop immediately" while the engine is off and won't start again if I turn the key.
I think that something brings some car circuit to reset, anyway if I remove the adapter from the obd2 port, I close and re-open the car the problem disappears.

My car is a 2007 Volvo V50 (CAN bus) and I read that such a problem can be caused by a 12V-GND short circuit, for example.
I tested the connector, and there is no short circuit between pin 16 and 4 or 5, and pin 4 and 5 are connected.
What can I do more than that?

Thankyou,
mic
#5878
Hi Stanley, thank you for going on with the library!  :D
ABout my need on Fault Codes:
I seen you added

[code]void COBD::clearDTC()
{
write("04\r");
receive(0, 1000);
}[/code]

That will do the reset. DO you have code also for getting the trouble codes? I aim to clear codes only on certain faults.
Thank you!
#5879
I am having problems with reading data after the car has been turned off and then back on again.  Originally, in my code it was set up in the examples like this:

void setup()
{
  obd.begin();
  while(!obd.init());
}

void loop()
{
  obd.read(PID_RPM,RPM);
}

This code worked correctly for me and I received the RPM values but if I turned my car off, when I restarted it no data was received until I reset the Arduino.  Once I reset the Arduino, it worked again but it is rather annoying and cumbersome to have to reset the Arduino every time I start my car.  I saw in the OBD library that there are functions such as "recover".  Could you please explain to me or help me understand how I can code this so that I do not have to reset the Arduino every time I turn off/on my car.

I also tried this but it didn't seem to help.

void setup()
{
  obd.begin();
  while(!obd.init());
}

void loop()
{
  if(obd.read(PID_RPM,RPM))  {
    ...
  }
  else  {
    obd.begin();
    obd.init();
  }
}

I appreciate any feedback or help that you can provide.  I really enjoy using this product and want to be able to use it even more efficiently!  Thank you!
#7572
I'm not very familiar with OBD-II, but the rpm example sketch should work, or it's broken :?

conors891 wrote:I am testing the rpm example sketch on the website here http://arduinodev.com/hardware/obd-kit/ . My obd.init() keeps failing. Does anybody know how I can further troubleshoot. I'm using a 2008 ford focus and a 2000 fiat punto. Fails on both. Any help would be appreciated thanks
#7752
Hi,

Looking at connecting this up to a TI tm4c123gg microcontroller. Wondering if the board will be compatible with the odb2 reader? I realize that the library will have to be written from scratch, so I'm also wondering how much time is involved with creating a basic library to grab tach readings?

Thanks,
-Mat
#7757
Hi everyone,
I bought an obd-II uart adapter and noticed my cables colors are different from those published on the website.
In particular i have:
-red and black with coupled ends
-green and white with separated ends

while on the website I found:
-red (+) and black (gnd) separated
-yellow (rx) and white(tx) coupled (?)
(ref: http://freematics.com/pages/wp-content/uploads/2014/08/ArduinoTelematicsKit1-Wiring-1024x599.jpg )

I tried googling around but with no luck, I hope some of you can help me figure out this problem.
Thanks in advance,

Marco
  • 1
  • 5
  • 6
  • 7
  • 8
  • 9