Obdii mode 9 request

can anyone help me out with a OBDII request Mode 09 04 Calibration ID
Up to 16 ASCII chars. Data bytes not used will be reported as null bytes (0x00). Several CALID can be outputed (16 bytes each)
im requesting the data but am trying to figure out why its not the same as the scan tool (efi live) im using to verify if its correct.

i was trying this sample from the apps section i just changed the message to my request.

void readVIN() {
  Serial.println("Reading VIN");

  // Send request to read VIN
  CANMessage message;
  message.id = OBD_CAN_BROADCAST_ID;
  message.len = 8; // just always use 8
  message.data[0] = 0x02; // 0 = single-frame format, 2  = num data bytes
  message.data[1] = 0x09;
  message.data[2] = 0x04;
  carloop.can().transmit(message);

  OBDMessage obd;
  unsigned long start = millis();
  unsigned long timeout = 200; // ms
  while(millis() - start < timeout) {
    if (carloop.can().receive(message)) {
      if (message.id == 0x7E8) {
        Serial.println("Got reply from ECU");

        // Add the data to our OBD message
        bool needsFlowControl = obd.addMessageData(message);

        if (needsFlowControl) {
          // Sending flow control
          CANMessage flowControl = obd.flowControlMessage();
          carloop.can().transmit(flowControl);
          Serial.println("Sent flow control");
        }

        // Use the data when the message is complete
        if (obd.complete()) {
          String vin = "";
          // VIN is 17 character and can be left-padded with zeros
          for (int i = obd.size() - 17; i < obd.size(); i++) {
            vin += String((char)obd.data()[i]);
          }
          Serial.println("VIN: " + vin);
          if (Particle.connected()) {
            Particle.publish("vin/result", vin, PRIVATE);
          }

          obd.clear();
          Serial.println("Done");
          return;
        }
      }
    }
  }

the problem im having is the data im gettig back with this code is not the same as in efi live. i can see the request if i sniff the tool and the response im just figureing out why the code snippet is messing up the response. it just comes back as squares and random stuff lol

@dubb45,

It looks like in your code that you are taking the raw data coming back and adding it to your string as if it was ASCII data.
When it comes back as squares and random stuff, it convinces me that the raw data is not ASCII, but something else that will need to be converted.

One way to get started is to convert the raw data to HEX characters and send that to your string. That way we can see the data in bytes. If you provide an example of that, along with an example of what your scan tool is providing, then we should be able to sort it out by comparing them.

thanks for the clarification!!!
going to add this and try it out.

vin += String((char)obd.data()[i], HEX);

i added HEX on the end of it

according to wiki mode 09 04 is Calibration ID comes Up to 16 ASCII chars. Data bytes not used will be reported as null bytes (0x00). Several CALID can be outputed (16 bytes each)
Mode 09 04
7E0 [8] 02 09 04 00 00 00 00 00_

  can0  7E8   [8]  10 83 49 04 08 31 32 36
  can0  7E0   [8]  30 00 00 00 00 00 00 00
  can0  7E8   [8]  21 34 36 31 32 38 00 00
  can0  7E8   [8]  22 00 00 00 00 00 00 31
  can0  7E8   [8]  23 32 36 34 32 36 37 36
  can0  7E8   [8]  24 00 00 00 00 00 00 00
  can0  7E8   [8]  25 00 31 32 36 34 36 34
  can0  7E8   [8]  26 34 30 00 00 00 00 00
  can0  7E8   [8]  27 00 00 00 31 32 36 33
  can0  7E8   [8]  28 33 35 31 38 00 00 00
  can0  7E8   [8]  29 00 00 00 00 00 31 32
  can0  7E8   [8]  2A 36 33 37 30 32 39 00
  can0  7E8   [8]  2B 00 00 00 00 00 00 00
  can0  7E8   [8]  2C 31 32 36 33 37 30 33
  can0  7E8   [8]  2D 33 00 00 00 00 00 00
  can0  7E8   [8]  2E 00 00 31 32 36 33 37
  can0  7E8   [8]  2F 30 33 38 00 00 00 00
  can0  7E8   [8]  20 00 00 00 00 31 32 36
  can0  7E8   [8]  21 33 37 30 33 35 00 00
  can0  7E8   [8]  22 00 00 00 00 00 00 AA

can0 7DF [8] 02 09 04 00 00 00 00 00

  can0  7E8   [8]  10 83 49 04 08 31 32 36
  can0  7E0   [8]  30 00 00 00 00 00 00 00
  can0  7E8   [8]  21 34 36 31 32 38 00 00
  can0  7E8   [8]  22 00 00 00 00 00 00 31
  can0  7E8   [8]  23 32 36 34 32 36 37 36
  can0  7E8   [8]  24 00 00 00 00 00 00 00
  can0  7E8   [8]  25 00 31 32 36 34 36 34
  can0  7E8   [8]  26 34 30 00 00 00 00 00
  can0  7E8   [8]  27 00 00 00 31 32 36 33
  can0  7E8   [8]  28 33 35 31 38 00 00 00
  can0  7E8   [8]  29 00 00 00 00 00 31 32
  can0  7E8   [8]  2A 36 33 37 30 32 39 00
  can0  7E8   [8]  2B 00 00 00 00 00 00 00
  can0  7E8   [8]  2C 31 32 36 33 37 30 33
  can0  7E8   [8]  2D 33 00 00 00 00 00 00
  can0  7E8   [8]  2E 00 00 31 32 36 33 37
  can0  7E8   [8]  2F 30 33 38 00 00 00 00
  can0  7E8   [8]  20 00 00 00 00 31 32 36
  can0  7E8   [8]  21 33 37 30 33 35 00 00
  can0  7E8   [8]  22 00 00 00 00 00 00 AA

Mode 09 06
can0 7E0# 02 09 06 00 00 00 00 00

  can0  7E8   [8]  10 23 49 06 08 00 00 86
  can0  7E0   [8]  30 00 00 00 00 00 00 00
  can0  7E8   [8]  21 42 00 00 0B 9F 00 00
  can0  7E8   [8]  22 01 B4 00 00 2C 12 00
  can0  7E8   [8]  23 00 94 27 00 00 E5 42
  can0  7E8   [8]  24 00 00 E4 2F 00 00 51
  can0  7E8   [8]  25 CF AA AA AA AA AA AA

7DF [8] 02 09 06 00 00 00 00 00

  can0  7E8   [8]  10 23 49 06 08 00 00 86
  can0  7E0   [8]  30 00 00 00 00 00 00 00
  can0  7E8   [8]  21 42 00 00 0B 9F 00 00
  can0  7E8   [8]  22 01 B4 00 00 2C 12 00
  can0  7E8   [8]  23 00 94 27 00 00 E5 42
  can0  7E8   [8]  24 00 00 E4 2F 00 00 51
  can0  7E8   [8]  25 CF AA AA AA AA AA AA

but when i use the carloop and the OBDII vin request sample app 09 04 im getting this data back

313236333730333500000000

on another tool EFI live im able to verify the calibration ID “12646438”
ive tried a few things but lost a bit, going to try and make own “request” handler and see if that is whats messing me up. anyone with some info welcome to comment.

I took the calibration ID “12646438” and converted it to hex using this ASCII table

I got:
31 32 36 34 36 34 33 38

This row of data matches the first part:

Look into it more and see if there is a certain way that the Calibration ID data should be interpreted…
I think things are getting closer to solving it.

yea that number is similar im able to refence EFI live to determine what it is, and none of numbers are the actual “calibration ID” ive gotten “Slave Calibration” and a few others listed from requesting 02 09 04
which got me to belive 02 09 06 should be the Calibration ID. but still cant get the correct data. even my elm327 can get the info lol im overlooking something i know it.

funny part is i can read/write a new vin no problem on GM and Chrysler, but requesting this calibration iD is something i cant do yet lol

heres a request from my elm327 an raspberry pi

>0906
7E8 10 23 49 06 08 00 00 50 
7E8 21 B2 00 00 E1 38 00 00 
7E8 22 28 6B 00 00 2C 12 00 
7E8 23 00 22 11 00 00 E0 8F 
7E8 24 00 00 11 03 00 00 9A 
7E8 25 E6 AA AA AA AA AA AA
>0904
7E8 10 83 49 04 08 31 32 36 
7E8 21 34 32 34 30 35 00 00 
7E8 22 00 00 00 00 00 00 31 
7E8 23 32 36 35 37 31 35 30 
7E8 24 00 00 00 00 00 00 00 
7E8 25 00 31 32 36 35 37 31 
7E8 26 34 38 00 00 00 00 00 
7E8 27 00 00 00 31 32 36 33 
7E8 28 33 35 31 38 00 00 00 
7E8 29 00 00 00 00 00 31 32 
7E8 2A 36 32 39 38 37 32 00 
7E8 2B 00 00 00 00 00 00 00 
7E8 2C 31 32 36 34 32 35 37 
7E8 2D 34 00 00 00 00 00 00 
7E8 2E 00 00 31 32 36 34 32 
7E8 2F 35 37 38 00 00 00 00 
7E8 20 00 00 00 00 31 32 36 
7E8 21 34 32 35 37 36 00 00 
7E8 22 00 00 00 00 00 00 AA