It is currently Fri May 26, 2017 8:56 am

OBD2 Car Diagnostic Script

All times are UTC - 6 hours

Post new topic Reply to topic  [ 2 posts ] 
Author Message
 PostPosted: Mon Jun 08, 2009 4:07 pm   

Joined: Mon Jun 08, 2009 12:59 pm
Posts: 1
Hello Guys

i need help with creating a bash script which connect over an obd2 cable to my car.

The bash script must open a Termial connection to /dev/ttyUSB0 (baud rate 9600 8N1).
After that you can write "010C" at the promt, and you get an HEX dump of the RPM signal.

i found with google a way to decode hex numbers with the follow command:
linux:~ echo $((0x7B))

it gives me 123 back

A short example what i mean:
i write "010C" at the termial and get this:
41 0C 00 00

Note: The echo function is on.

For me are the last 4 numbers important:
Mode(hex) = 01
PID(hex) = 0C
Data bytes returned = 2
Description = Engine RPM
Min value = 0
Max value = 16,383.75
Units = rpm
Formula = ((A*256)+B)/4

wikipedia says i must calculate the first "00 = A" with the second "00 = B".
This is the formula what i need to get the right "((A*256)+B)/4" RPM Speed.
Note: i know it is 00 my engine was not running.

Another Example:
Mode (hex) = 01
PID (hex) = 05
Data bytes returned = 1
Description = Engine coolant temperature
Min value = -40
Max value = 215
Units = °C
Formula = A-40

ok i write the OBD2 Pid "0105" to the Terminal and get this:
41 05 39

wikipedia says i must subtract my hex encoded answer with 40.
linux:~# echo $((0x39))

57-40 = 17
OBD2 tells me my current Engine coolant temperature is: 17 °C.

i dont know how can i open a terminal session and grab the output.

Thanks for help

Links: Wikipedia OBD2 PID List

 PostPosted: Wed Jul 22, 2009 1:21 pm   
User avatar

Joined: Wed May 03, 2006 2:05 pm
Posts: 269
Hi Robert, I remember seeing you post this originally and though it was an interesting project. I didn't have much to contribute at the time. Have you gotten anywhere with it?

 Profile YIM  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC - 6 hours

Who is online

Users browsing this forum: No registered users and 7 guests

You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Jump to:  

BashScripts | Promote Your Page Too
Powered by phpBB © 2011 phpBB Group