Page 1 of 1

Read VIN?

Posted: Sun Aug 24, 2014 8:37 am
by Henke
Any ideas how to read out the VIN number?

I can see that there is a declaration of a variable called vin in odb.h
line 123: // current VIN
line 124: byte vin[17];

but I can´t find any function that reads the actual VIN from the OBD interface...

Do I need to implement that function or am I missing something here?

Re: Read VIN?

Posted: Sun Aug 24, 2014 10:52 am
by Henke
Found the answer :)

write 0902 to ask for the VIN.

With a VIN of WP0ZZZ99ZTS392124 in the OBD-simulator a got this respond back:

014 0: 49 02 01 57 50 30
01: 5A 5A 5A 39 39 5A 54
02: 53 33 39 32 31 32 34

According to the ELM327 specification:

014 - 014 bytes of information (HEX)
0:-sequence number
4902-response to an 0902 request
01-numbers of data items

So if I discard this bytes and convert the remaining hex numbers to ASCII I get:

57 50 30 5A 5A 5A 39 39 5A 54 53 33 39 32 31 32 34
W P 0 Z Z Z 9 9 Z T S 3 9 2 1 2 4

Perfect :D

Hope this can help someone that needs the VIN.

Re: Read VIN?

Posted: Mon Aug 25, 2014 11:35 am
by stanley
Thanks! :D

Re: Read VIN?

Posted: Thu Oct 02, 2014 5:26 pm
by lukeau
Where are you putting the code to write 0902 to ask for the VIN? Are you putting it in OBD.h or OBD.cpp?
I'm trying to get the VIN myself, would you be willing to share the code snippet please?

I tried adding a definition to OBD.h like this:

Code: Select all

#define PID_VIN 0x02

.. but I can't see how the mode is defined (all other PIDs have a 'mode' of 1, request vehicle data is 9.

I'd love to add this to the OBD library as a definition so that the VIN can be requested in the same way as any other PID, but I can't work out how to account for the different 'mode'.
I also suspect that the string might need to be normalised and formatted in OBD.cpp?

Re: Read VIN?

Posted: Sat Oct 04, 2014 10:02 am
by stanley
In current implementation of OBD library, only mode 01 is handled. You can though send "0902\r" to request for the VIN data and parse it.

Re: Read VIN?

Posted: Sat Oct 04, 2014 1:50 pm
by lukeau
1. Can I make this request from datalogger.ino, or do I need to do this in the OBD library? Something like this?

Code: Select all

    write("0902\r");
    receive();

2. To make requests of the OBD-II, does "0902\r" need to be prefixed with an special AT command? For example:
    a. requests to the GPS depending on need are prefixed with ATBR2 to set baud rate, ATSGC to set NMEA update rate and ATGRR to get NMEA data.
    b. requests to the OBD-II appear to be prefixed by ATSP.
3. Do you have a code example of how to make the "0902\r" request?

Apologies if my questions seem basic, I am trying to understand how serial requests to the different attached components work.

Re: Read VIN?

Posted: Fri Sep 01, 2017 12:28 pm
by ronaldpace
I am sending a "0902"<CR> and I am get back 84 bytes of VIN data. Is there another command that can help me parse this VIN data?

Re: Read VIN?

Posted: Sat Sep 02, 2017 10:59 am
by stanley
Please refer to our Arduino library for how to parse the response.

Re: Read VIN?

Posted: Fri Sep 08, 2017 11:09 pm
by richardjews
I can´t find any function that reads the actual VIN from the OBD interface...

Re: Read VIN?

Posted: Fri Sep 15, 2017 5:02 am
by Ramon08
thanks