I've set up an Adroid application doing just that through bluetooth. You can find the source code here: https://github.com/eiannone/CBT-Diagnostic (see also here: http://forum.canb.us/discussion/comment/580/#Comment_580)
I would like to port it to a desktop app using serial port. It shouldn't be too difficult.
I got all information about OBDII protocol on wikipedia page: https://en.wikipedia.org/wiki/OBD-II_PIDs
Basically you have to send a broadcast CAN request using msgId/address 07DF and then listen for responses from id 07E0 - 07E7 .
The first byte of the CAN packet data is the "command mode", the second is the PID command, and the others are command data.
For example, to get all supported OBDII PIDs you must use mode 01 - "Show current data", and then command 00 - "Show supported pids".
The CAN packet request is the following:
07DF 02 01 00 0000000000
07DF is the broadcast address
02 is the number of data bytes
01 is the OBD mode (Show current data)
00 is the command PID "Show supported PIDS"
The rest of 0s are unused data bytes
To send this command with CBT you have to send the following serial port command:
02 01 07 DF 02 01 00 00 00 00 00 00 08
On my Mazda 3 I receive this CAN response:
07E8 06 41 00 98 3B 80 11 00
07E8 is the device id
06 is the number of additional data bytes
41 is the OBD mode, same as request mode (01h) with 40h added
00 is the PID code (same as request)
98 3B 80 11 is hex string with supported PIDs encoded, which translates to PID supported: 01, 04, 05, 0B, 0C, 0D, 0F, 10, 11, 1C, 20 (see Wikipedia for decoding)
To ease dealing with OBD protocol I implemented mask filtering on firmware for CAN messages id. That's because ODB II CAN messages id are only in the range from 0x7E8 to 0x7EF.
last edited by