The MP3car.com Store The MP3car.com Store    

Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development

Reply
 
LinkBack Thread Tools Display Modes
Old 06-29-2008, 07:06 AM   #1
Newbie
 
Join Date: Jun 2008
Posts: 6
How to begin OBD development?

Hello there,
i'am planing to play a little bit with the OBD capabilities of modern cars. Before digging a bit deaper into the topic, in nead some guidance. So i it would be very nice, if someone could answer these questions

(1) Were to find structured information about getting data from OBD-Interface? Plugin in the Interface, connecting a computer via USB/Seriel and then - how to get the first data?

(2) Is there a car emulator for Windows PCs? So a program which acts like a car and sends the information to the usb or serial interface as a real car would do?

This would be a very helpful set of beginner instructions, to grab the first signal with a self developed OBD software.

Thank you so much for any guidance
Bye
Mork0075 is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 06-29-2008, 08:08 PM   #2
Newbie
 
Join Date: Jun 2008
Posts: 5
Quote:
(1) Were to find structured information about getting data from OBD-Interface? Plugin in the Interface, connecting a computer via USB/Seriel and then - how to get the first data?

I recently started a project to make a digital gauge cluster useing the OBD-II interface. The cable I bought (on ebay) connects via USB. However, it is nothing more than an emulated Serial port (COM port). So, to request and receive information from the car, I needed to communicate through the COM port. I'm not sure what language you plan on programming in, so your route may be a bit different than mine.

These are the very basics:

(1.) to start communications, send "ATZ" to the port. It will respond by echoing back "ATZ" and the version of the chip you are using (in my case ELM v1.2)

(2.) to turn off echoing of your commands send "AT0" <--Thats A-T-Zero. It should reply with "OK" or something similar

(3.) To get information for a specific item, you send it's PID. You can get a list of PIDs from here: http://en.wikipedia.org/wiki/Table_of_OBD-II_Codes

(4.) After you send the PID it will respond with the requested information in the form of HEX values. You need to convert the Hex values to decimal values and then use the information from the "Formula" column in the PID table to calclulate your ending value.

(5.) Request the next piece of information to continue the program.

Those are the basic steps. If you need some source code in VB.net 2005, let me know. Its not complete, but it should give you an idea of how to get the information.

Quote:
(2) Is there a car emulator for Windows PCs? So a program which acts like a car and sends the information to the usb or serial interface as a real car would do?

There used to be one called (I believe) Jelmulator. I haven't been able to find any working links to it though. If you find one, please let me know! It would be much easier than running out to my car to program!

Good luck with your project!

-Ray
PC_Cruiser is offline   Reply With Quote
Old 07-03-2008, 12:31 AM   #3
Newbie
 
Join Date: Jun 2008
Posts: 5
My last post is lost on some moderator's desk, so I'll try again:

Once you have an OBD-II USB adapter and install it on your machine, you can use your favorite programming language to talk to it. In my case, I use Visual Basic .Net 2005. The adapter talks to the computer via an emulated serial port (or COM) port. You will need to connect to the COM port and send first an initialization command (ATZ) then the PID for the data you want to recieve. You can get a list of PIDs from wikipedia. If you search for "ODB-II PIDs" in google, you will find the page. The table they supply also gives the formulas you will need to calculate the data once you recieve it back from the COM port (the data is send and recieved as HEX codes that need to be converted to decimal).

Hope that helps. If you need help, let me know and I'll do my best. I'm developing a digital gauge cluster based on the information from my OBD-II port. So far it seems to be working well.

Good Luck,

Ray
PC_Cruiser is offline   Reply With Quote
Old 07-03-2008, 12:33 AM   #4
It ain't easy being a green moderator
 
meddler's Avatar
 
Join Date: Aug 2002
Location: Steps out the front of Henson's workshop or Sydney
Posts: 2,263
Quote: Originally Posted by PC_Cruiser View Post
My last post is lost on some moderator's desk, so I'll try again:

It happens.
__________________
Never let the truth get in the way of a good story

Chat on the mp3car channel on IRC

Server: efnet Channel: #mp3car

No irc client installed? Go to http://chat.efnet.org/. In the channel drop down box select "other" and type in #mp3car.
meddler is offline   Reply With Quote
Old 07-03-2008, 01:34 AM   #5
Newbie
 
Join Date: Jun 2008
Posts: 6
Thank you, i would be very interested in some sample code.

But i think without a PC based testing environment, it's very hard to start. The first point is, that i have to develop in the car, the second that i can damage it

How develop the pros? There must be a testing environment?
Mork0075 is offline   Reply With Quote
Old 07-03-2008, 03:35 AM   #6
Low Bitrate
 
Join Date: Nov 2007
Posts: 105
Write yourself a car emulator. Start by choosing (or defining) an API that your software will use to send and receive bytes. Forget about the OBD2 interface for a moment - just think in terms of bytes sent and received.

At the same time you write your code to send and receive simple packets, also write code that acts like a car, receiving the same packets, parsing them, and responding with the appropriate packets. Test your code by running it against your fake car. When that works, then go test it in a real car. If you've done it right, it'll just work. Realistically though it probably wont work the first time, but if you have your software log all of the bytes that it sends and receives (I suggest writing to a text file, in hexadecimal), then you can study the logs to see what you're doing wrong. If the response from the car isn't what you expected, then revise your car emulator so that it behaves just like the car itself.

Once your test harness emulates the car correctly, you can make a lot of progress in the comfort of your home. Then you can just periodically test in the car to verify that things still work there too.

Do some research and see if your car speaks only OBD2, or if the manufacturer has a proprietary extension to OBD2 that gives better performance. Subaru uses SSM, Mitsubishi uses MUT, and so on. Then look for documentation on those protocols. Basically it's just a matter of creating the right series of bytes to send to the car, and parsing out the bytes that you receive in response. If you can find a document that describes those byte sequences, then you can write code to send and receive them.
NSFW is offline   Reply With Quote
Old 07-03-2008, 04:41 AM   #7
Newbie
 
Join Date: Jun 2008
Posts: 6
Thanks a lot for your reply My concern is, that i'am doing something wrong, sending wrong bytes through the channel, which causes a damage. I've done some socket programming in Java, which is really close to what you've described (sending some bytes, waiting for the answer, adjusting the program). But writing your own test environement makes a lot of assumptions, which are perhaps wrong. So a pre build car emulator would give me the confidence, to not damage my car.
Mork0075 is offline   Reply With Quote
Old 07-03-2008, 07:00 AM   #8
Newbie
 
Join Date: Mar 2008
Posts: 14
Quote: Originally Posted by PC_Cruiser View Post
.....

(5.) Request the next piece of information to continue the program.

Those are the basic steps. If you need some source code in VB.net 2005, let me know. Its not complete, but it should give you an idea of how to get the information.


Hi Ray - I'm just about to begin this part of my project as well and would love to see any vb.net code that you are willing to share.

Thank you so much!!!!!

JoeBerni
joeberni is offline   Reply With Quote
Old 07-03-2008, 07:45 AM   #9
MySQL Error
 
Sonicxtacy02's Avatar
 
Join Date: Sep 2004
Location: Woodbridge, VA
Posts: 5,028
Quote: Originally Posted by PC_Cruiser View Post
I recently started a project to make a digital gauge cluster useing the OBD-II interface. The cable I bought (on ebay) connects via USB. However, it is nothing more than an emulated Serial port (COM port). So, to request and receive information from the car, I needed to communicate through the COM port. I'm not sure what language you plan on programming in, so your route may be a bit different than mine.

These are the very basics:

(1.) to start communications, send "ATZ" to the port. It will respond by echoing back "ATZ" and the version of the chip you are using (in my case ELM v1.2)

(2.) to turn off echoing of your commands send "AT0" <--Thats A-T-Zero. It should reply with "OK" or something similar

(3.) To get information for a specific item, you send it's PID. You can get a list of PIDs from here: http://en.wikipedia.org/wiki/Table_of_OBD-II_Codes

(4.) After you send the PID it will respond with the requested information in the form of HEX values. You need to convert the Hex values to decimal values and then use the information from the "Formula" column in the PID table to calclulate your ending value.

(5.) Request the next piece of information to continue the program.

Those are the basic steps. If you need some source code in VB.net 2005, let me know. Its not complete, but it should give you an idea of how to get the information.



There used to be one called (I believe) Jelmulator. I haven't been able to find any working links to it though. If you find one, please let me know! It would be much easier than running out to my car to program!

Good luck with your project!

-Ray


I've been looking into creating an rr extension plugin for OBD-II. If you could provide your sample code that would definitely help me get started.
__________________
03 Acura RSX Coupe
a K.I.S.S Flash, VB, and Autoit Programmer
HARDWARE PROGRESS: 90%[/////////-]
Developer of: RRFusion, MovieTimes, (new)RRMail
Coming Soon:RRChrome, RR Plugin Browser & CentraFusion
Sonicxtacy02 is offline   Reply With Quote
Old 07-03-2008, 10:03 AM   #10
Variable Bitrate
 
NeonDev's Avatar
 
Join Date: Feb 2008
Posts: 416
Quote:
But i think without a PC based testing environment, it's very hard to start. The first point is, that i have to develop in the car, the second that i can damage it

So I am new to this as well... and I would like to know how it is possible to damage your car through OBD-II
__________________
check us out at: www.neonboombox.com
NeonDev is offline   Reply With Quote
Old 07-03-2008, 10:21 AM   #11
Newbie
 
Join Date: Jun 2008
Posts: 6
Quote:
So I am new to this as well... and I would like to know how it is possible to damage your car through OBD-II

Is this a sarcastic question? In my unterstanding it is possible to send bytes to the controller which cause him to do a little bit more (perhaps reseting the service counter is one of the harmless actions), then sending back some simple status information. Isnt it this way?
Mork0075 is offline   Reply With Quote
Old 07-03-2008, 11:18 AM   #12
Variable Bitrate
 
NeonDev's Avatar
 
Join Date: Feb 2008
Posts: 416
I don't know thats why i'm asking... I just wouldn't think you could jack up your car with a diagnostic tool, but maybe you have a looser definition of harming your car...

What is the worst thing that you can do to your car over OBD-II? I'm not really worried about resetting flags or anything...
__________________
check us out at: www.neonboombox.com
NeonDev is offline   Reply With Quote
Old 07-03-2008, 11:56 PM   #13
Variable Bitrate
 
Join Date: Dec 2006
Posts: 261
Last time I checked, through standard OBD-II, the worst you can do is reset your MIL indicator -- which has it's side effects.
colin is offline   Reply With Quote
Old 07-04-2008, 12:52 AM   #14
Low Bitrate
 
Join Date: Nov 2007
Posts: 105
Quote: Originally Posted by Mork0075 View Post
Thanks a lot for your reply My concern is, that i'am doing something wrong, sending wrong bytes through the channel, which causes a damage. I've done some socket programming in Java, which is really close to what you've described (sending some bytes, waiting for the answer, adjusting the program). But writing your own test environement makes a lot of assumptions, which are perhaps wrong. So a pre build car emulator would give me the confidence, to not damage my car.

I wouldn't worry about damaging the car. If you send the wrong series of bytes, the car is most likely to just ignore the data. Especially if you stick to just the read side of the protocol - where you send packets that mean "what is the value in register X?" with a response from car like "register X contains value Y." If you just implement that stuff you're very unlikely to cause any trouble. When you're confident that you have that stuff working, and working well, then ask yourself if you're ready to tackle writes. If you are, you are. If you aren't, then find some more cool stuff to do with reads. There's plenty of opportunity there.

Frankly I wouldn't bother even trying to do writes. Mostly the software I use just reads data to display it or log it, and that's enough for me. I do use one piece of software to write (for tuning), and it makes me nervous every time I run it.
NSFW is offline   Reply With Quote
Old 07-04-2008, 01:16 AM   #15
Newbie
 
Join Date: Jun 2008
Posts: 6
Can please someone provide us with sample code?

Quote:
then ask yourself if you're ready to tackle writes.

How does a write look like? Reading from a register means also writing some bytes to the bus.
Mork0075 is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are Off
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
1999 Saab 9-5 OBD, and more nblracer Newbie 1 05-08-2008 10:52 PM
OBD II connector on an OBD I car HearseNurse Engine Management, OBD-II, Engine Diagnostics, etc. 3 01-20-2008 11:24 PM
OBD or special hardware? Jirka Jirout General Hardware Discussion 2 03-04-2007 05:01 AM


All times are GMT -5. The time now is 07:38 PM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.2.0
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics