Search code examples
pythonpyserialobd-ii

pyserial python obd vin


I am writing python script to read the VIN from a OBDII ELM327 device. I can successfully connect to the device and issue commands but I am now trying to figure out how to decode the response. The response from the current code is. Any help is appreciated. Thanks in advance.

>
0902
7E8 10 14 49 02 01 4C 46 56
7E8 21 33 42 32 38 52 38 41
7E8 22 33 30 32 35 33 31 30

cat test.py import serial import time

ser=serial.Serial('/dev/rfcomm0', 115200)
ser.write(b'0902\r\n')
time.sleep(5)
rcv  = ser.read(ser.in_waiting)

while True:
    print rcv

Solution

  • 7E8 10 14 49 02 01 4C 46 56
    7E8 21 33 42 32 38 52 38 41
    7E8 22 33 30 32 35 33 31 30
    

    0x7E8 is the return address for a PID request, 10, 14, 49, 02, 01, are describing how much data and in reponse to what, for the later messages 21, is saying its another message for the same PID,

    Strip all that away and your left with:

    4C 46 56 33 42 32 38 52 38 41 33 30 32 35 33 31 30

    LFV3B28R8A3025310