Trouble Initializing OBD-II Model B

Inquiry and support for Freematics products
Post Reply
BobbyTheLee
Posts: 1
Joined: Thu Jan 22, 2015 12:17 pm

Trouble Initializing OBD-II Model B

Post by BobbyTheLee »

I'm having issues initializing the OBD-II adapter that I just received. I don't have a display so I couldn't use one of the example sketches included with the library. I am running the code below and I only see the "About to start" message and then the "Ugh!!!" message repeats. The light on Pin13 stays on and never goes off. I've tried it on both I2C connections on my Arduino Mega. I've also tried it on my UNO and my Nano Arduinos. Could someone give me some pointers on how to get my adapter working? I just installed the libraries and have not modified any of the header or cpp files.

Code: Select all

#include <Wire.h>
#include <OBD.h>

COBDI2C obd;

void setup()
{
 
 //start the serial connection
 Serial.begin(115200);
  // we'll use the debug LED as output
  pinMode(13, OUTPUT);
  // start communication with OBD-II adapter
  obd.begin();
  Serial.println("About to start");
  digitalWrite(13,HIGH);
  // initiate OBD-II connection until success
  while (!obd.init()) {
   Serial.println("Ugh!!!");
  }
 
}

void loop()
{
  Serial.println("You're in the loop!!!");
  digitalWrite(13,LOW);
  int value;
  // save engine RPM in variable 'value', return true on success
  if (obd.read(PID_RPM, value)) {
    // light on LED on Arduino board when the RPM exceeds 3000
    digitalWrite(13, value < 3000 ? HIGH : LOW);
  }
}
stanley
Site Admin
Posts: 1039
Joined: Sat Mar 01, 2014 3:15 am

Re: Trouble Initializing OBD-II Model B

Post by stanley »

You may need to make sure the adapter is compatible with your car. Your car must use one of the supported protocols.
doki10000
Posts: 4
Joined: Thu Apr 02, 2015 3:29 am

Re: Trouble Initializing OBD-II Model B

Post by doki10000 »

Same problem here, I have a Model B and it won't connect to the car either, the blue light flashes for a second and then the whole thing hangs in obd.init().

Hardware: OBD-II Model B MPU-9150
Hardware: Arduino Mega 2560
Car: Prius 2014
OBDII Protocol: ISO 15765-4 CAN (11 bit ID,500 Kbaud)
Software: rpm_led_i2c.ino (https://github.com/stanleyhuangyc/Ardui ... ed_i2c.ino)
Wiring: OBD-II MPU -> SDA/SDL ports in Mega

I tried to manually change the protocol in the header file, still doesn't work...
stanley
Site Admin
Posts: 1039
Joined: Sat Mar 01, 2014 3:15 am

Re: Trouble Initializing OBD-II Model B

Post by stanley »

Did you see blue LED inside the enclosure flashing? Have you tried reading from MPU9150?
doki10000
Posts: 4
Joined: Thu Apr 02, 2015 3:29 am

Re: Trouble Initializing OBD-II Model B

Post by doki10000 »

I had to connect GND from the adapter to the arduino for it to work (see my post for more details). When connecting, lights still flash this way but then they flash every 30 seconds or so when connected.
Post Reply