The Godfather talking
Share your stuff or I will make you regret it.
Sonsivri
 
*
Welcome, Guest. Please login or register.
Did you miss your activation email?
March 19, 2024, 11:42:18 11:42


Login with username, password and session length


Pages: [1]
Print
Author Topic: Arduino Mega based OBD Display for my F250 Diesel  (Read 11355 times)
0 Members and 1 Guest are viewing this topic.
Some Anon Guy
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 58
-Receive: 25



« on: November 18, 2014, 03:50:34 15:50 »

Here is a sketch that I modified to pull specific OBD data out of my F250 Diesel.
It isn't the prettiest or most efficient code I'm sure, but it works and I am ok with that.

It was built on the Sparkfun OBD interface and an Arduino Mega (multiple Serial ports)


Maybe someone will find this useful.


Code:

/*
* OBD-II-UART Quickstart Sketch
* Written by Ryan Owens for SparkFun Electronics 7/5/2011
* Updates for Arduino 1.0+ by Toni Klopfenstein
*
* Modified by Some Anon Guy 11/2014
* Customized for my specific needs on a Diesel Ford F250 Truck
*
* Released under the 'beerware' license
* (Do what you want with the code, but if we ever meet then you buy me a beer)
*
* This sketch will grab Exhaust Gas Temps, DFP Status, Regen Status, Engine Coolant,
* and Engine Oil Temp data from a vehicle with an OBD port  using the OBD-II-UART
* board from SparkFun electronics. The data will be displayed
* on a serial 16x2 LCD. See the tutorial at https://www.sparkfun.com/tutorials/294
* to learn how to hook up the hardware:
*
*/

// Uncomment to print debud data to serial console
//#define debug

// include the LCD library code:
#include <LiquidCrystalFast.h>

// initialize the library with the numbers of the interface pins
LiquidCrystalFast lcd(12, 10, 11, 5, 4, 3, 2);
         // LCD pins: RS  RW  EN  D4 D5 D6 D7

//This is a character buffer that will store the data from the serial port
char rxData[32];
char rxWord1[32];
char rxWord2[32];

char rxIndex=0;

long EGT1, EGT2, EGT3, EGT4, REGEN, EngineCoolant, EngineOil;
double DPFpercent;
int DPFp;
int i=0;

void setup(){
  //Both the Serial console and the OBD-II-UART use 9600 bps.
#ifdef debug
  Serial.begin(9600);  // Used for the USB Serial Console
#endif
  Serial1.begin(9600); // Used to communicate with the OBD2 controller from SparkFun
 
  // set up the LCD's number of rows and columns:
  lcd.begin(20, 4);
  // Print a message to the LCD.
  lcd.print("F250 EGT/DPF Display");
   
  //Wait for a little while before sending the reset command to the OBD-II-UART
  delay(1500);
 
  //Reset the OBD-II-UART
  Serial1.println("ATZ");
  //Wait for a bit before starting to send commands after the reset.
  delay(2000);
 
  // Setup Display Headers
  lcd.clear();
  //Left Columns
  lcd.setCursor(0, 0);
  lcd.print("EGT1:");   // Exhaust Gas Temp 1
  lcd.setCursor(0, 1);
  lcd.print("EGT2:");   // Exhaust Gas Temp 2
  lcd.setCursor(0, 2);
  lcd.print("EGT3:");   // Exhaust Gas Temp 3
  lcd.setCursor(0, 3);
  lcd.print("EGT4:");   // Exhaust Gas Temp 4
 
  //Right Columns
  lcd.setCursor(10, 0);
  lcd.print("ReGen: ");   // DPF Regen Cycle
  lcd.setCursor(10, 1);
  lcd.print("DPF %: ");   // DPF Percent Full
  lcd.setCursor(10, 2);
  lcd.print("Cool : ");   // Engine Coolant Temp
  lcd.setCursor(10, 3);
  lcd.print("Oil  : ");   // Engine Oil Temp
 
 
  //Delete any data that may be in the serial port before we begin.
  while(Serial1.available())
  Serial1.read();
 
}

void loop(){
  //Fill rxdata array with zeros
  memset(rxData, 0, sizeof(rxData));
  //Delete any data that may be in the serial port before we begin.
  while(Serial1.available()>0)
  Serial1.read();
 
    //++++++++++++++++++++++++++++++++++++++++++
  //Query the OBD-II-UART for the Engine OIL Temp
  Serial1.println("22f45c");
  delay(200);
 
#ifdef debug
  Serial.println("PID: 22f45c");
  Serial.println("Response: ");
#endif
  getResponse(); // READ ECHO AND DISCARD
  getResponse(); // READ REAL DATA AND THEN STORE IN rxWord1
  memcpy( rxWord1, rxData, sizeof(rxWord1));
  for (i=0; i++; i<sizeof(rxWord1)){
    #ifdef debug
    Serial.print(rxWord1[i]);
    #endif
  }
  // Calculate Engine Oil Temp
  EngineOil = (((strtol(&rxWord1[9],0,16)-40)*9)/5)+32;
 
#ifdef debug
  // Print to serial console for debug
  Serial.println();
  Serial.print("Oil Temp: ");
  Serial.println(EngineOil);
  Serial.println("DONE PID: 22f45c");
  Serial.println();
#endif
 
  //Display Engine Oil Temp.
  lcd.setCursor(16, 3);
  lcd.print("    ");
  lcd.setCursor(16, 3);
  lcd.print(EngineOil);


  //Delete any data that may be in the serial port before we begin.
  while(Serial1.available()>0)
  Serial1.read();
 
  //++++++++++++++++++++++++++++++++++++++++++
  //Query the OBD-II-UART for the Engine Coolant
  Serial1.println("0105");
  delay(200);
 
#ifdef debug
  Serial.println("PID: 0105");
  Serial.println("Response: ");
#endif 
  getResponse(); // READ ECHO AND DISCARD
  getResponse(); // READ REAL DATA AND THEN STORE IN rxWord1
  memcpy( rxWord1, rxData, sizeof(rxWord1));
  for (i=0; i++; i<sizeof(rxWord1)){
    Serial.print(rxWord1[i]);
  }
  EngineCoolant = (((strtol(&rxWord1[6],0,16)-40)*9)/5)+32;

#ifdef debug
  Serial.println();
  Serial.print("Engine Coolant: ");
  Serial.println(EngineCoolant);
  Serial.println("DONE PID: 0105");
  Serial.println();
#endif

  //Display Coolant Temp.
  lcd.setCursor(16, 2);
  lcd.print("    ");
  lcd.setCursor(16, 2);
  lcd.print(EngineCoolant);

  //Delete any data that may be in the serial port before we begin.
  while(Serial1.available()>0)
  Serial1.read();

 
  //++++++++++++++++++++++++++++++++++++++++++
  //Query the OBD-II-UART for the Regen Status
  Serial1.println("22f48b");
  delay(200);

#ifdef debug
  Serial.println("PID: 22f48b");
  Serial.println("Response: ");
#endif 
  getResponse(); // READ ECHO AND DISCARD
  getResponse(); // READ COUNTER? OR LENGHT? AND DISCARD
  getResponse(); // READ REAL DATA AND THEN STORE IN rxWord1
  memcpy( rxWord1, rxData, sizeof(rxWord1));
  for (i=0; i++; i<sizeof(rxWord1)){

#ifdef debug
    Serial.print(rxWord1[i]);
#endif

  }
  getResponse(); // READ REAL DATA AND THEN STORE IN rxWord2
  memcpy( rxWord2, rxData, sizeof(rxWord2));
  for (i=0; i++; i<sizeof(rxWord2)){

#ifdef debug
    Serial.print(rxWord2[i]);
#endif

  }
  REGEN = bitRead(strtol(&rxWord1[15],0,16), 0);

#ifdef debug
  Serial.println();
  Serial.print("Regen Status: ");
  Serial.println(REGEN);
  Serial.println("DONE PID: 22f48b");
  Serial.println();
#endif 
  //Display Regen Status
  lcd.setCursor(16, 0);
  lcd.print("    ");
  lcd.setCursor(16, 0);
  lcd.print(REGEN);

  //Delete any data that may be in the serial port before we begin.
  while(Serial1.available()>0)
  Serial1.read();
 
 
  //++++++++++++++++++++++++++++++++++++++++
  //Query the OBD-II-UART for the DPF PERCENT
  Serial1.println("22042c");
  delay(200);

#ifdef debug
  Serial.println("PID: 22042c");
  Serial.println("Response: ");
#endif 
  getResponse(); // READ ECHO AND DISCARD
  getResponse(); // READ REAL DATA AND THEN STORE IN rxWord1
  memcpy( rxWord1, rxData, sizeof(rxWord1));
  for (i=0; i++; i<sizeof(rxWord1)){

#ifdef debug
    Serial.print(rxWord1[i]);
#endif
  }
  DPFpercent = strtol(&rxWord1[9],0,16)*256;
  //Serial.println(DPFpercent,4);
  DPFpercent += strtol(&rxWord1[12],0,16);
  //Serial.println(DPFpercent,4);
  DPFpercent *= 0.0015259021896696;
  //Serial.println(DPFpercent,4);
  DPFpercent -= 1;
  //Serial.println(DPFpercent,4);
  DPFpercent /= 1.75;
  //Serial.println(DPFpercent,4);
  DPFpercent *= 100;
  //Serial.println(DPFpercent,4);
  DPFp = DPFpercent;

#ifdef debug
  Serial.println();
  Serial.print("DPF %: ");
  Serial.println(DPFp);
  Serial.println("DONE PID: 22042c");
  Serial.println();
#endif 
  //Display DPF Percent on LCD
  lcd.setCursor(16, 1);
  lcd.print("    ");
  lcd.setCursor(16, 1);
  lcd.print(DPFp);
 
  //Delete any data that may be in the serial port before we begin.
  while(Serial1.available()>0)
  Serial1.read();

  //+++++++++++++++++++++++++++++++++++++++++
  //Query the OBD-II-UART for the Vehicle EGT
#ifdef debug
  Serial.println("PID: 22f478");
#endif   
  Serial1.println("22f478");
  delay(200);
 
  getResponse(); // READ ECHO AND DISCARD
  getResponse(); // READ COUNTER? OR LENGHT? AND DISCARD
  getResponse(); // READ REAL DATA AND THEN STORE IN rxWord1
  memcpy( rxWord1, rxData, sizeof(rxData));
  getResponse(); // READ REAL DATA AND THEN STORE IN rxWord2
  memcpy( rxWord2, rxData, sizeof(rxData));

#ifdef debug
  Serial.println("DONE PID: 22f478");
  Serial.println();
#endif 
  // Generate Display Data
  EGT1 = (((strtol(&rxWord1[15],0,16)*256)+strtol(&rxWord1[18],0,16))*0.18)-40;
  EGT2 = (((strtol(&rxWord2[3],0,16)*256)+strtol(&rxWord2[6],0,16))*0.18)-40;
  EGT3 = (((strtol(&rxWord2[9],0,16)*256)+strtol(&rxWord2[12],0,16))*0.18)-40;
  EGT4 = (((strtol(&rxWord2[15],0,16)*256)+strtol(&rxWord2[18],0,16))*0.18)-40;

  lcd.setCursor(5, 0);
  lcd.print("     ");
  lcd.setCursor(5, 1);
  lcd.print("     ");
  lcd.setCursor(5, 2);
  lcd.print("     ");
  lcd.setCursor(5, 3);
  lcd.print("     ");
  lcd.setCursor(5, 0);
  lcd.print(EGT1);
  lcd.setCursor(5, 1);
  lcd.print(EGT2);
  lcd.setCursor(5, 2);
  lcd.print(EGT3);
  lcd.setCursor(5, 3);
  lcd.print(EGT4);
  delay(100);

}

//The getResponse function collects incoming data from the UART into the rxData buffer
// and only exits when a carriage return character is seen. Once the carriage return
// string is detected, the rxData buffer is null terminated (so we can treat it as a string)
// and the rxData index is reset to 0 so that the next string can be copied.
void getResponse(void){
  char inChar=0;
  //Keep reading characters until we get a carriage return
  while(inChar != '\r'){
    //If a character comes in on the serial port, we need to act on it.
    if(Serial1.available()>0){
      //Start by checking if we've received the end of message character ('\r').
      if(Serial1.peek() == '\r'){
        //Clear the Serial buffer
        inChar=Serial1.read();
        //Put the end of string character on our data string
        rxData[rxIndex]='\0';
        //Reset the buffer index so that the next character goes back at the beginning of the string.
        rxIndex=0;
      }
      //If we didn't get the end of message character, just add the new character to the string.
      else{
        //Get the new character from the Serial port.
        inChar = Serial1.read();
        //Serial.print(inChar);
        //Add the new character to the string, and increment the index variable.
        rxData[rxIndex++]=inChar;
      }
    }
    else
      inChar='\r';
  }
  //Serial.println("GetResponseDone");
}


Logged
solutions
Hero Member
*****
Offline Offline

Posts: 1823

Thank You
-Given: 655
-Receive: 900



« Reply #1 on: November 18, 2014, 04:26:08 16:26 »

Where'd you get the OBD command set from?
Logged
Some Anon Guy
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 58
-Receive: 25



« Reply #2 on: November 18, 2014, 04:42:40 16:42 »


Google...
I found these on the Torque Android app forums...
They are specific to Ford F250 Diesel.

OBD info is very difficult to find... :/

Code:

Ambient Air Temperature in °C (Truck External Sensor) –
PID – 22F446 – Done Testing –
Long Name (used in menus) – Ambient Air Temperature C 6.7L
Short Name (used in gauge display) – Air Temp
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – (NOTE: Leave blank, I have my units set to “F” so this will show “C”)
Equation – A-40
OBD Header –

Ambient Air Temperature in °F (Truck External Sensor) –
PID – 22F446 – Done Testing
Long Name (used in menus) – Ambient Air Temperature 6.7L
Short Name (used in gauge display) – Air Temp
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – °F
Equation – A*(9/5)-40
OBD Header – 7E0

Accelerator Pedal Position “E” –
PID – 4a – Done Testing – Custom PID
Long Name (used in menus) – Accelerator Pedal Position E 6.7L
Short Name (used in gauge display) – APP E 6.7L
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – %
Equation – (A-20)*1.22
OBD Header – 7E0

Barometric Pressure (from Torque App) –
PID – 33 – Done Testing – Torque App PID
Long Name (used in menus) – Barometric Pressure (from Vehicle from Torque App)
Short Name (used in gauge display) – Baro
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – psi
Equation –
OBD Header –

Boost (Turbo) – Boost –
PID – 0187 – Done Testing
Long Name (used in menus) – Boost 6.7L
Short Name (used in gauge display) – Boost
Min Value – 0.0
Max Value – 40.0
Scale Factor – x1
Unit Type – psi
Equation – ((((B*256)+C)*0.00393)+2.25)-Baro()
OBD Header – 7E0

DPF Regeneration Status –
PID – 22F48B – Done Testing.
Long Name (used in menus) – DPF Regen Status 6.7L
Short Name (used in gauge display) – Regen
Min Value – 0.0
Max Value – 100.0
Scale Factor – x1
Unit Type – ON/OFF
Equation – {B:0}
OBD Header – 7E0

DPF Distance Since Last Complete Regen –
PID – 220434 – Done Testing
Long Name (used in menus) – Distance Since Last Complete Regeneration 6.7L
Short Name (used in gauge display) – DIA
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – Miles
Equation – ((A < 16)+(B < 8)+C)*0.24
OBD Header – 7E0
Comment : No spaces in equation, only way it would let me post it was with spaces??

DPF Pressure –
PID – 22116C – Still Testing –
Long Name (used in menus) – Diesel Particulate Filter 6.7L
Short Name (used in gauge display) – DPFP
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – psi
Equation –
OBD Header – 7E0

DPF Soot Mass % –
PID – 22042C – Done Testing – From other member
Long Name (used in menus) – DPF Soot Mass % 6.7L
Short Name (used in gauge display) – Soot %
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – %
Equation – ((((A*256)+B)*(100/65535))-1)/1.75*100
OBD Header – 7E0

DPF Soot Mass –
PID – 22042C – Done Testing – Data Value (1.7 = 100% Soot?
Long Name (used in menus) – DPF Soot Mass 6.7L
Short Name (used in gauge display) – Soot
Min Value – 1.0
Max Value – 3.0
Scale Factor – x1
Unit Type – Grams/Liter
Equation – ((A*256)+B)*(100/65535)-1
OBD Header – 7E0

EGT Post Turbo – EGT 11 –
PID – 22F478 – Done Testing
Long Name (used in menus) – Exhaust Gas Temperature Sensor Post Turbo EGT 11 6.7L
Short Name (used in gauge display) – EGT 11
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – °F
Equation – (((B*256)+C)*0.18)-40.0
OBD Header – 7E0

EGT Post SCR/Pre DPF – EGT 12 –
PID – 22F478 – Done Testing
Long Name (used in menus) – Exhaust Gas Temperature Sensor Post SCR/Pre DPF – EGT 12 6.7L
Short Name (used in gauge display) – EGT 12
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – °F
Equation – (((D*256)+E)*0.18)-40.0
OBD Header – 7E0

EGT Pre DPF – EGT 13 –
PID – 22F478 – Done Testing
Long Name (used in menus) – Exhaust Gas Temperature Sensor Pre DPF – EGT 13 6.7L
Short Name (used in gauge display) – EGT 13
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – °F
Equation – (((F*256)+G)*0.18)-40.0
OBD Header – 7E0

EGT Post DPF – EGT 14 –
PID – 22F478 – Done Testing
Long Name (used in menus) – Exhaust Gas Temperature Sensor Post DPF – EGT 14 6.7L
Short Name (used in gauge display) – EGT 14
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – °F
Equation – (((H*256)+I)*0.18)-40.0
OBD Header – 7E0

Exhaust Back Pressure – EBP –
PID – 0173 – Still Testing – 221445? –
Long Name (used in menus) – Exhaust Back Pressure Sensor 6.7L
Short Name (used in gauge display) – EBP
Min Value – 0.0
Max Value –
Scale Factor – x1
Unit Type – psi
Equation – ((B*256)+C)*0.03625
OBD Header – 7E0

Engine Coolant Temperature 1 –
PID – 0105 – Done Testing
Long Name (used in menus) – Engine Coolant Temperature ECT 1 6.7L
Short Name (used in gauge display) – ECT 1
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – °F
Equation – (A*(9/5))-40
OBD Header –

Engine Oil Temperature – EOT –
PID – 22f45c – Done Testing
Long Name (used in menus) – Engine Oil Temperature Sensor 6.7L
Short Name (used in gauge display) – EOT
Min Value – 0.0
Max Value – 400
Scale Factor – x1
Unit Type – °F
Equation – A*(9/5)-40
OBD Header – 7E0

Engine RPM – RPM –
PID – 0c – Torque – Done Testing
Long Name (used in menus) – Engine RPM (Torque) 6.7L
Short Name (used in gauge display) – RPM
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – RPM
Equation – ((A*256)+B)/4
OBD Header – 7E0

Fuel Tank Level –
PID – 22f42f – Done Testing
Long Name (used in menus) – Fuel Tank Level 6.7L
Short Name (used in gauge display) – Fuel Level
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – %
Equation – A*0.39216
OBD Header – 7E0

Fuel Rate KPL Average –
PID – E5 – to make – Custom PID
Long Name (used in menus) – Fuel Rate KPL (Average)
Short Name (used in gauge display) –
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – L/h
Equation – ((A*256)+B)*0.05
OBD Header – 7E0

Intake Air Temperature – IAT –
PID – 0f – Testing –
Long Name (used in menus) – Intake Air Temperature Sensor 6.7L
Short Name (used in gauge display) – IAT
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – °C
Equation – A-40
OBD Header – 7E0

Manifold Abs Pressure – MAP –
PID – 0187 – Testing –
Long Name (used in menus) – Manifold Absolute Pressure Sensor 6.7L
Short Name (used in gauge display) – MAP
Min Value – 0.0
Max Value – 100
Scale Factor – x1
Unit Type – psi
Equation – ((A*256)+C)*0.03625
OBD Header – 7E0

Speed Vehicle MPH (PCM)–
PID – 0D – Testing – Custom PID
Long Name (used in menus) – Speed 6.7L (PCM)
Short Name (used in gauge display) – MPH
Min Value – 0.0
Max Value – 100.0
Scale Factor – x1
Unit Type – MPH
Equation – A*62137
OBD Header –

Speed Vehicle KPH (PCM)–
PID – 0D – Done Testing –
Long Name (used in menus) – Speed 6.7L (KPH)
Short Name (used in gauge display) – Km/h
Min Value – 0.0
Max Value – 100.0
Scale Factor – x1
Unit Type – Leave Blank to display Km/h
Equation – A
OBD Header –

Transmission Fluid Temp – TFT –
PID – 221e1c – Done Testing
Long Name (used in menus) – Transmission Fluid Temperature Sensor 6.7L
Short Name (used in gauge display) – TFT
Min Value – 0.0
Max Value – 100.0
Scale Factor – x1
Unit Type – °F
Equation – ((SIGNED(A)*256)+B)*(9/80)+32
OBD Header –

Vehicle Pitch –
PID – From Phone –
Long Name (used in menus) –
Short Name (used in gauge display) –
Min Value –
Max Value –
Scale Factor – x1
Unit Type –
Equation –
OBD Header –

Vehicle Roll –
PID – From Phone
Long Name (used in menus) –
Short Name (used in gauge display) –
Min Value –
Max Value –
Scale Factor – x1
Unit Type –
Equation –
OBD Header –

Voltage (Control Module) –
PID – [42] – Testing – Make Custom
Long Name (used in menus) – Voltage (PCM) 6.7L
Short Name (used in gauge display) – Volts (PCM) (Volts CM)
Min Value – 0.0
Max Value – 50.0
Scale Factor – x1
Unit Type – Volts
Equation – ((A*256)+B)/1000
OBD Header – 7E0

Voltage (OBD) –
PID – ff1238 – Testing – make custom
Long Name (used in menus) – Voltage (OBD) 6.7L
Short Name (used in gauge display) – Volts OBD (Volts AD)
Min Value – 0.0
Max Value – 50.0
Scale Factor – x1
Unit Type – Volts
Equation –
OBD Header –

Logged
flo0319
Junior Member
**
Offline Offline

Posts: 81

Thank You
-Given: 7
-Receive: 17


« Reply #3 on: November 19, 2014, 07:02:46 19:02 »

Hi all,

the OBD II PIDs are very good documented here http://en.wikipedia.org/wiki/OBD-II_PIDs, how to send commands on Sparkfun is a tutorial for this https://learn.sparkfun.com/tutorials/obd-ii-uart-hookup-guide#obd-commands.

I have seen in your sketch some commands (PIDs) like 22F45C where 5C is Engine oil temperature    (-40,    210,   °C, (A - 40) ). I expect a command like   Serial1.println("015c"); where 01 is the mode (see wiki) and 5C the PID for oil temp.
I cannot find what means 22F4 can you please post the full response when you call   Serial1.println("22f45c"); and also for  Serial1.println("015c"); ?
Thanks!
Logged
Some Anon Guy
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 58
-Receive: 25



« Reply #4 on: November 20, 2014, 08:25:46 08:25 »

Hi all,

the OBD II PIDs are very good documented here http://en.wikipedia.org/wiki/OBD-II_PIDs, how to send commands on Sparkfun is a tutorial for this https://learn.sparkfun.com/tutorials/obd-ii-uart-hookup-guide#obd-commands.

I have seen in your sketch some commands (PIDs) like 22F45C where 5C is Engine oil temperature    (-40,    210,   °C, (A - 40) ). I expect a command like   Serial1.println("015c"); where 01 is the mode (see wiki) and 5C the PID for oil temp.
I cannot find what means 22F4 can you please post the full response when you call   Serial1.println("22f45c"); and also for  Serial1.println("015c"); ?
Thanks!

Yes you are correct. Standard PIDs are documented very well. The PIDs starting with 22 are FORD Extended PIDs. These are manufacturer specific and are not documented unless you spend $$$.
From the Wikipedia document you referenced.
Quote
Vehicle manufacturers are not required to support all modes. Each manufacturer may define additional modes above #9 (e.g.: mode 22 as defined by SAE J2190 for Ford/GM, mode 21 for Toyota)

Also check the section titled Non-standard PIDs in the Wikipedia you referenced.

The output from the 22xxxx PIDs look the same as standard PID output. It is just a different mode supported by my Ford F250 Diesel truck.


Logged
jellybean442
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 128
-Receive: 47


« Reply #5 on: November 20, 2014, 12:11:24 12:11 »

Yes you are correct. Standard PIDs are documented very well. The PIDs starting with 22 are FORD Extended PIDs. These are manufacturer specific and are not documented unless you spend $$$.

Actually, SAE says that J2190 has been canceled, though they suggest more recent ISO standards:

"J2190 is being canceled as it is very old document and has very little current use. This has not been superseded by any later SAE documents, but has been superseded by some ISO documents, which at a very high level include information that was in SAE J2190, but go into considerably more detail. ISO 14230-3:1999 is intended for ISO 14230 (ISO 9141 based) serial data links, ISO 15765-3:2004 is intended for ISO 15765 (CAN) data links, and ISO 14229-1:2006 is "Unified Diagnostic Services" intended for all current and future serial data links."

ISO, in turn, states that 14229-1:2006 has been superseded by ISO 14229-1:2013, which is 392 pages for $408 at the ISO site.

Logged
Some Anon Guy
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 58
-Receive: 25



« Reply #6 on: November 20, 2014, 03:07:02 15:07 »

Actually, SAE says that J2190 has been canceled, though they suggest more recent ISO standards:

"J2190 is being canceled as it is very old document and has very little current use. This has not been superseded by any later SAE documents, but has been superseded by some ISO documents, which at a very high level include information that was in SAE J2190, but go into considerably more detail. ISO 14230-3:1999 is intended for ISO 14230 (ISO 9141 based) serial data links, ISO 15765-3:2004 is intended for ISO 15765 (CAN) data links, and ISO 14229-1:2006 is "Unified Diagnostic Services" intended for all current and future serial data links."

ISO, in turn, states that 14229-1:2006 has been superseded by ISO 14229-1:2013, which is 392 pages for $408 at the ISO site.



Interesting, but isnt the ISO document just going to contain information on the protocol itself, and not the data that is sent on the bus?
Logged
jellybean442
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 128
-Receive: 47


« Reply #7 on: November 21, 2014, 12:53:26 00:53 »

Interesting, but isnt the ISO document just going to contain information on the protocol itself, and not the data that is sent on the bus?

On that, I'm not sure. I haven't been able to find a copy of the ISO document yet. :/
Logged
Some Anon Guy
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 58
-Receive: 25



« Reply #8 on: November 30, 2014, 08:07:17 20:07 »

For anyone that is interested...

I created a Git-Hib repo for the code.
I updated the project to use a 4D Systems serial display.

https://github.com/levonbragg/Arduino-Mega_OBDII_4DDisplay

Logged
Tupperware
Newbie
*
Offline Offline

Posts: 15

Thank You
-Given: 27
-Receive: 24


« Reply #9 on: December 01, 2014, 09:40:54 21:40 »

On that, I'm not sure. I haven't been able to find a copy of the ISO document yet. :/

Which ISO document are you after? 15765 or 14229?
Logged
Some Anon Guy
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 58
-Receive: 25



« Reply #10 on: December 02, 2014, 05:20:59 05:20 »

I would think that both would make for interesting research / reading...
Logged
jellybean442
Newbie
*
Offline Offline

Posts: 22

Thank You
-Given: 128
-Receive: 47


« Reply #11 on: December 02, 2014, 06:29:13 06:29 »

Which ISO document are you after? 15765 or 14229?

I'm not after a particular document. I was just looking for some information for the OP.

It looks like the documents covering OBD implementation are pretty comprehensive. For example, just ISO 14229 covers:

ISO 14229-1:2013 Road vehicles -- Unified diagnostic services (UDS) -- Part 1: Specification and requirements
ISO 14229-2:2013 Road vehicles -- Unified diagnostic services (UDS) -- Part 2: Session layer services
ISO 14229-3:2012 Road vehicles -- Unified diagnostic services (UDS) -- Part 3: Unified diagnostic services on CAN implementation (UDSonCAN)
ISO 14229-4:2012 Road vehicles -- Unified diagnostic services (UDS) -- Part 4: Unified diagnostic services on FlexRay implementation (UDSonFR)
ISO 14229-5:2013 Road vehicles -- Unified diagnostic services (UDS) -- Part 5: Unified diagnostic services on Internet Protocol implementation (UDSonIP)
ISO 14229-6:2013 Road vehicles -- Unified diagnostic services (UDS) -- Part 6: Unified diagnostic services on K-Line implementation (UDSonK-Line)
ISO 14229-7 Road vehicles -- Unified diagnostic services (UDS) -- Part 7: UDS on local interconnect network (UDSonLIN)

Vehicle electronics have advanced quite a bit since their introduction way back when.
Logged
Some Anon Guy
Junior Member
**
Offline Offline

Posts: 43

Thank You
-Given: 58
-Receive: 25



« Reply #12 on: December 05, 2016, 08:35:43 08:35 »

If anyone is interested, I updated the repo with the actual code and hardware I am using.
Nextion 2.4" display
Arduino Mega1284p (MightyCore)
I also included the 3D files for the windshield mount I made. It mounts just above the rear view mirror.


https://github.com/levonbragg/Arduino-OBDII-Display
Logged
techneo
Junior Member
**
Offline Offline

Posts: 51

Thank You
-Given: 120
-Receive: 41


« Reply #13 on: October 09, 2018, 03:01:01 03:01 »


I came across several interpreter ICs including ELM327 and the one given below:

https://www.obdsol.com/solutions/chips/stn1110/


Seems to be interesting stuff ....
Logged
Pages: [1]
Print
Jump to:  


DISCLAIMER
WE DONT HOST ANY ILLEGAL FILES ON THE SERVER
USE CONTACT US TO REPORT ILLEGAL FILES
ADMINISTRATORS CANNOT BE HELD RESPONSIBLE FOR USERS POSTS AND LINKS

... Copyright © 2003-2999 Sonsivri.to ...
Powered by SMF 1.1.18 | SMF © 2006-2009, Simple Machines LLC | HarzeM Dilber MC