Forum >OBD2 UART with Arduino UNO is not working
Telematics General

OBD2 UART with Arduino UNO is not working

userHead dev.sultan 2014-01-17 01:26:25 6389 Views3 Replies
I used the below:
Library:
[url=https://github.com/stanleyhuangyc/ArduinoOBD/tree/master/libraries/OBD]https://github.com/stanleyhuangyc/ArduinoOBD/tree/master/libraries/OBD[/url]

ino code:

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

COBD obd; /* for Model A (UART version) */

void setup()
{
// we'll use the debug LED as output
pinMode(13, OUTPUT);
// start communication with OBD-II adapter
obd.begin();
// initiate OBD-II connection until success
while (!obd.init());
}

void loop()
{
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 > 1000 ? HIGH : LOW);

}
}

Cable:
[url=http://arduinodev.com/hardware/obd-kit/]http://arduinodev.com/hardware/obd-kit/[/url]

Wiring Connection:
Red: +5 Arduino
Black: Ground Arduino
Blue: TX Arduino side
Yellow: RX Arduino side

Test with below Cars:
2009 KIA Opima
1998 Ford Crown Victoria

i changed RPM in code from 3000 to 1000 and the same issue the LED 13 isn't be HIGH.

Gents, Please i need your support to solve this issue.
2014-01-23 03:37:18 Guys, Please your support  :) userHeadPic dev.sultan
2014-01-19 14:54:11 Ok thanks for your reply, sorry can you check if the below code is correct to check if it pass or not? thank you for usual support  :)

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

COBD obd; /* for Model A (UART version) */

int led = 13;
int led2 = 12;

void setup()
{
  // we'll use the debug LED as output
  // start communication with OBD-II adapter
  obd.begin();
  pinMode(led, OUTPUT);
  pinMode(led2, OUTPUT);
  // initiate OBD-II connection until success
}

void loop()
{
  if (obd.init())
  {
  digitalWrite(led2, HIGH);  // turn the LED2 on (HIGH is the voltage level)
  delay(100);              // wait for a second
  digitalWrite(led2, LOW);    // turn the LED2 off by making the voltage LOW
  delay(100);
  }
  else
  {
  digitalWrite(led, HIGH);  // turn the LED on (HIGH is the voltage level)
  delay(100);              // wait for a second
  digitalWrite(led, LOW);    // turn the LED off by making the voltage LOW
  delay(100);
  }
}
userHeadPic dev.sultan
2014-01-17 09:06:08 it's UART Adapter V1.2 userHeadPic dev.sultan