3 replies [Last post]
mark
Offline
Joined: 2010-02-11

Macchina is a pretty capable piece of hardware. However, without decent libraries, this hardware doesn't do much. We need your help to take advantage of the OBD2 hardware interface. Here is a summary of the 5 OBD2 protocols and status of library development.

It might be cool to have 1 big library for ALL THE ODB2 PROTOCOL, and some fancy auto-detect system, but for now, maybe separate, robust libraries. It would also probably be cool to have libraries be as portable as possible so that they can be easily adopted for use with other processors - not just Atmega 2560.

OBD2 protocol libraries:

SAE J1850 PWM, Status: very early in development
pulse-width modulation — 41.6 kB/sec, standard of the Ford Motor Company

OBD2 connectorpin 2: Bus+
OBD2 connectorpin 10: Bus–
High voltage is +5 V
Message length is restricted to 12 bytes, including CRC
Employs a multi-master arbitration scheme called 'Carrier Sense Multiple Access with Non-Destructive Arbitration' (CSMA/NDA)

SAE J1850 VPW, Status: very early in development
variable pulse width — 10.4/41.6 kB/sec, standard of General Motors

OBD2 connector pin 2: Bus+
Bus idles low
High voltage is +7 V
Decision point is +3.5 V
Message length is restricted to 12 bytes, including CRC
Employs CSMA/NDA

ISO 9141-2, Status: very early in development
This protocol has an asynchronous serial data rate of 10.4 kBaud. It is somewhat similar to RS-232; however, the signal levels are different, and communications happens on a single, bidirectional line without additional handshake signals. ISO 9141-2 is primarily used in Chrysler, European, and Asian vehicles.

OBD2 connector pin 7: K-line
OBD2 connector pin 15: L-line (optional)
UART signaling
K-line idles high, with a 510 ohm resistor to Vbatt
The active/dominant state is driven low with an open-collector driver.
Message length is Max 260Bytes. Data field MAX 255.

ISO 14230 KWP2000, Status: very early in development
(Keyword Protocol 2000)

OBD2 connector pin 7: K-line
OBD2 connector pin 15: L-line (optional)
Physical layer identical to ISO 9141-2
Data rate 1.2 to 10.4 kBaud
Message may contain up to 255 bytes in the data field

ISO 15765 CAN, Status: library well developed.

250 kBit/s or 500 kBit/s.

The CAN protocol was developed by Bosch for automotive and industrial control. Unlike other OBD protocols, variants are widely used outside of the automotive industry. While it did not meet the OBD-II requirements for U.S. vehicles prior to 2003, as of 2008 all vehicles sold in the US are required to implement CAN as one of their signaling protocols.

OBD2 connectorpin 6: CAN High
OBD2 connector pin 14: CAN Low

More information found here:

http://rechargecar.com/forums/macchina-and-protocols/development-canbus-...

AttachmentSize
OBD2_STERN.zip59.88 KB
josh
Offline
Joined: 2010-02-10

In order to help move forward with this OBD2 library development for Macchina, we are posting an excellent set of code written by Trampas Stern as a starting point. His project uses a AT90CAN128 part, but some of the non-CAN code may be tweaked to work with the other OBD2 protocols. Project is found here:

http://www.sterntech.com/obdii_avr.php

The same code we posted above can be found here:

https://code.google.com/p/avrobdii/

The goal here is to use this code as a starting point to create some portable easy-to-use Arduino libraries.

allardiced
Offline
Joined: 2012-08-01

ISO9141-2 protocol impl

Anyone aware of an open source implementation for ISO9141-2 protocol? Or is there any chance it is supported already in the MCP2515 library? Apparently that is what my car (2004 Porsche Boxster) uses, and I don't get any data when trying to use a simple data logger program. I'm guessing that it is because the lower-level protocol is not supported in the mcp2515 library I am using. Can you confirm? Can you provide any pointers to help me implement something? Thanks!

UPDATE - I see in the "avrobdii" project there is an "iso" class (.h/.c files) which appears to be K/L-line oriented, which would be ISO9141-2 protocol. I'll study this further. Any other implementations available?

-Darryl Allardice

josh
Offline
Joined: 2010-02-10

Hey Darryl, That is pretty funny about your Porsche not even being CANbus. I know that everyone was transitioning to CAN around that time. Also note that the MCP2515 library would only be for CANbus.

Regarding ISO compatibility: This needs work. We found some decent starting points and that avrbdii project you mentioned is a very good start, but will need a little work to make it work with Arduino/Macchina.

Another thing to mention is that Macchina 1.0 only has a software serial connection to the ISO interface, while Macchina 1.1 has an option to connect to hardware serial. I'll send you an email about getting you a different board.