Hello,
I tried searching a lot regarding Car OBD2 reader with Arduino on Google and I found one working sketch.
The problem is that I need to specify OBD Header with value: da10f1 while Arduino starts connecting with OBD2 ELM327 Bluetooth adapter to read the values of specified PIDs from ECU sice the PIDs on my car are not "common" from Wiki.
I can do it with mobile app Torque very simply but I want to display values on LCD display mounted on dashboard instead of using mobile app.
Does somebody have an idea how can I declare the OBD header with implementation into this code?
Without declared OBD Header I'm not able to read the PID values.
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
LiquidCrystal_I2C lcd(0x3F, 2, 1, 0, 4, 5, 6, 7, 3, POSITIVE); //LCD PINout
byte inData;
char inChar;
String BuildINString="";
String DisplayString="";
String WorkingString="";
long DisplayValue;
long A;
long B;
void setup() {
// LCD setup columns, rows:
lcd.begin(20, 2); //16, 2
//LCD turn on message
lcd.setCursor(0, 0);
lcd.print("My Car");
lcd.setCursor(0, 1);
lcd.print("engine");
delay(3000);
lcd.clear();
Retry:
lcd.setCursor(0, 0);
lcd.print(" ");
lcd.setCursor(0, 1);
lcd.print("Connecting... ");
//9600 baud communication
Serial.begin(9600);
Serial.println("ATZ");
lcd.setCursor(0, 0);
lcd.print("ELM327 TZ ");
delay(2000);
ReadData();
if (BuildINString.substring(1,3)=="TZ") // ECU on command: substring(1,3)=="TZ" or: substring(1,4)=="ATZ"
{
lcd.clear();
lcd.setCursor(0, 0);
//lcd.print("Hello");
lcd.setCursor(9, 0);
lcd.setCursor(0, 1);
lcd.print("Connected ");
delay(1500);
lcd.clear();
}
else
{
lcd.setCursor(0, 0);
lcd.print("Error ");
lcd.setCursor(0, 1);
lcd.print("No Connection! ");
delay(1500);
lcd.clear();
goto Retry;
}
//*****************************************************************
//Data reading from ECU
//*****************************************************************
Serial.println("0100");
lcd.setCursor(0, 0);
lcd.print("Initializing... ");
delay(4000);
ReadData();
lcd.setCursor(0, 0);
lcd.print("Initialized. ");
delay(1000);
lcd.clear();
}
Thank you so much for any suggestions.