Anyone ever try this?

So I'm working on connecting an OBD II cable directly to the arduino board. Before I go any further though let me say that if this is just a dumb question or is completely impossible let me know I'm just wondering if this would work or not.

Here is what I want to use for this

Arduino Uno REV 3

DIY OBD II cable using this connector https://www.sparkfun.com/products/9911

It will have an LCD display and a few buttons too but I don't know if that is relevant for this or not.

You can see possible OBD protocols here OnBoardDiagnostics.com - OBD-II Network Standards
In all the protocols there are two OBD pins for ground one for the 12 volt power and in all but the VPW protocol two data pins (VPW has only one

I have 2 ideas for this.
1 connect the 12v power pin from the OBD II port to the DC power jack on the Uno then the ground pins to the ground pins on the board and the data cables to the serial tx and rx points on the arduino ( I really don't know if that would work but it would be cool to make use of the DC input. Also serial rx and tx are the right spots for the data wires right? That was what the OBD II ttl adapter used for the data wires so I figured it would be the same here)

2 wire the 12v power and the two ground pins on the OBD II port to the power and ground pins on the Uno and the data wire(s) to the serial rx and tx pins.

Is either one of these viable as an option for connecting without additional interfaces like the TTL adapter or an ELM327 or a UART connector? Or is there another way of doing this that someone has tried?

What are the electrical signals on the wires that you're proposing to connect to the Arduino? If any of them are outside 0 .. 5V relative to Arduino ground, it won't work and will damage the Arduino. If any of them are sourcing or sinking more than 40mA on an I/O pin that the Arduino is using as an output, it won't work and will damage the Arduino.

Note that in an automotive environment, even if the signals are nominally 0 .. 5V the EM noise can easily be enough to put it outside the voltage range that the Arduino can tolerate. You will need to condition and filter the incoming signal to avoid damaging the Arduino.

Thanks for the reply! I'll try to answer everything as best I can. I'm new at this so I'm kind of learning as I go so if I don't answer everything correctly please bear with me.

I'll use the SAE J1850 PWM as an example. I think the description answers most of your questions so I'll copy it to here

SAE J1850 PWM (Pulse Width Modulation at 41.6 Kbps, two wire differential)
Pin 2: BUS+ signal
Pin 10: BUS- signal
Active bus state: BUS+ is pulled high while BUS- is pulled low
High signal voltage level: +5V (min/max 3.80 to 5.25)
Low signal voltage level: 0V (min/max 0.00 to 1.20)
Up to 12 message bytes, excluding frame delimiters
Bit Timing;
"1" Bit: Bus state active for 8uS (within 24uS bit period)
"0" Bit: Bus state active for 16uS (within 24uS bit period)
Start-Of-Frame: Bus state active for 48uS

Pins 2 & 10 actually carry data those are the ones I said could go into the serial pins of the arduino if I'm understanding all this right

Pin 16 is the 12v power. Because it is 12v I know it can't go to one of the power pins of the arduino without a resistor to reduce the voltage but that was why I had the idea of connecting a DC power jack to plug into the DC input of the Uno since that can handle 12 volts. I don't really know if it would work but it would be kind of neat if it did. However I'll probably just use a resistor to bring it down to a manageable voltage since that has been done before.

Looking at your post again though I think that I won't be able to use the serial pins to plug the data wires into as I think the voltage is too high?

Would an OBD to DB9 cable fix that? Like this one OBD-II to DB9 Cable - CAB-10087 - SparkFun Electronics would the cable maybe bring the voltage down enough to work? Then just add on a serial port to the arduino?

If it would help I could try to make a schematic of what I'm thinking of.

Yes, you certainly can use the 12V supply to power your Arduino - that is exactly what it is provided for, but you will need an interface circuit to “condition” it for the Arduino including spike suppression and pre-regulation to supply something more like 9V to “Vin”. “Regulation” specifically does not mean a resistor.

Similarly, you cannot (safely) directly connect the RS-485-style data interface to the Arduino, you need a suitable interface chip. You need to research that a bit more as there are no doubt chips purpose-designed.

backpacker3:
Would an OBD to DB9 cable fix that? Like this one would the cable maybe bring the voltage down enough to work? Then just add on a serial port to the Arduino?

Read the article itself! It gives you a very significant clue:

This cable is not meant to be plugged directly into a computer’s serial port. It is meant to plug into some sort of hardware interface.

That info you posted describes a 0 .. 5V nominal signal level, so it's conceivable that your Arduino could send and receive it - but you'd need to check the current levels and provide adequate noise protection.

Paul, thanks for the reply and for making me find the answer too! I actually found some interesting stuff researching some of the things in your post. I forgot to post the link to the serial interface I found but here it is

Is that what you were talking about and would it work to connect to the arduino?

PeterH

It's still ok even though the max is 5.25v?

Also would these other protocols work with it I'm a bit worried about the voltage outputs on some of them like the VPW protocol it says this
SAE J1850 VPW (Variable Pulse Width at 10.4/41.6 Kpbs, single wire)
Pin 2: BUS+ signal
Idle bus level is low
High signal voltage level: +7V (min/max 6.25 to 8.00)
Low signal voltage level: 0V (min/max 0.00 to 1.50)
Up to 12 message bytes, excluding frame delimiters
Bit Timing;
"1" Bit: Signal low for 128uS or high for 64uS
"0" Bit: Signal low for 64uS or high for 128uS
Start-Of-Frame: Signal high for 200uS

So if it's around 7 volts with a maximum of 8 that would cause issues then right? And if that's the case then the ISO protocols would also be a problem since they have a maximum of 13.5v
ISO 9141-2 (Asynchronous serial communication at 10.4 Kbaud)
Pin 7: K-line bidirectional for communication
Pin 15: L-line (optional) unidirectional for waking up the ECU
Idle signal levels are high
Signals are active pull-down to 0V (0.00 to 2.40)
High signal voltage level: +12V (min/max 9.60 to 13.5)
Up to 12 message bytes, excluding frame delimiters
Bit Timing;
UART signaling at 10.4K baud, 8 data bits, no parity, 1 stop

ISO 14230 KWP2000 (Asynchronous serial communication up to 10.4 Kbaud)
Pin 7: K-line bidirectional for communication
Pin 15: L-line (optional) unidirectional for waking up the ECU
Idle signal levels are high
Signals are active pull-down to 0V (0.00 to 2.40)
High signal voltage level: +12V (min/max 9.60 to 13.5)
Message may contain up to 255 bytes in the data field
Bit Timing;
UART signaling up to 10.4K baud, 8 data bits, no parity, 1 stop

CAN should be ok though since the maximum is only 4.5v

ISO 15765 CAN (250kbit/sec or 500kbit/sec)
Pin 6: CAN high (CANH)
Pin 14: CAN low (CANL)
Dominant or active bus state: CANH driven high while CANL driven low
Recessive or idle bus state: CANH and CANL signals are not driven
CANH signal voltage level: 3.5V (min/max 2.75 to 4.50)
CANL signal voltage level: 1.5V (min/max 0.5 to 2.25)

I'm only asking about the multiple protocols because I might use the finished product (which will be kind of like a scangauge) in multiple vehicles I don't plan on selling it but I would like to share how it's made so anyone could build one and so being able to use all or at least some of the protocols would be good.

backpacker3:
I forgot to post the link to the serial interface I found but here it is

Is that what you were talking about and would it work to connect to the Arduino?

No, that is an RS-232 interface, the OBD is more like RS-485 or in fact, USB - two differential lines with non-differential states as "flags". Sorry, I must leave you to it regarding the actual details.

Oh that is 232 my mistake. Here is a rs 485 one for arduino http://www.amazon.com/gp/aw/d/B00BXDTV80/ref=mp_s_a_1_11?qid=1402486995&sr=8-11&pi=AC_SX110_SY165_QL70

I think that might be closer to what you meant since it has short circuit protection too. I'm just not sure how you would plug the cable into it though. Is there something else I'm missing?

The second lot of info is giving higher voltages outside the range the Arduino can cope with directly. You also haven't addressed how much current it would need to source or sink at those levels.

A quick search for "Arduino OBD" suggests that lots of people have already solved this problem and if you read up on their solutions I think you will soon find out what the best approach is. You can probably also find a ready-made solution, if you aren't set on developing your own.

Ive read a ton of the articles on it but the problem is that most are using the ELM327 or something similar which is an added $40 cost that pretty much doubles the cost of the project. I was hoping to find a way to make one without the extra chip/interface that would also work with multiple protocols. The second problem was that many of the articles that are more detailed (like the OBDunio on ecomodder) are older so the images and schematics are missing from links and things changing over time.

I’m willing to develop my own solution I just need help on some things I don’t understand or have the experience to figure out

I haven't found anything that shows how much current the OBD port needs to source or sink. Is there a way I can test for this?

Scavenge parts from this?

I'm surprised no one has mentioned the product Sparkfun stocks that cable for. It seems quite applicable...

The one I posted from Amazon is less than 1/3 the price, and throws in bluetooth. I figured the OP can scavenge the ELM327 chip to use in his own project at a great price.

kd7eir:
Scavenge parts from this?

kd7eir:
The one I posted from Amazon is less than 1/3 the price, and throws in bluetooth. I figured the OP can scavenge the ELM327 chip to use in his own project at a great price.

Though it makes vastly more sense, to use it with a bluetooth-equipped computer. :smiley:

I completely concur.

I’ve seen the UART interface but I’m trying to avoid using it because of the price I can get all the other components for less than the cost of the UART interface and I’d rather not more than double the cost of the project for it.

I was looking at this a little more http://www.amazon.com/gp/aw/d/B00BXDTV80/ref=mp_s_a_1_11?qid=1402486995&sr=8-11&pi=AC_SX110_SY165_QL70#productDescription_secondary_view_pageState_1402665022419 and seems like it could work and it has short circuit protection which should protect the arduino somewhat.

So if I were to wire the OBD II plug to a serial cable using the OBD II connector so I could make a custom one that wired only one of the ground pins and the data pins to the serial cable then connect it to the UART TTL serial connector from amazon with the connector going to the serial input and output of the arduino then take the other ground pin and the 12v pin and wire those separate from the serial cable to power the arduino with an interface to bring the voltage down to a safe level for the Arduino would that work?

I didn't want to make another thread for this so I'll ask my question here but what do you think of adding a data logger function that saves to an SD card I've seen a thread on here about saving to an SD card by adding a slot to the arduino so that I know you can do . But I think it would be cool to be able to create a chart showing MPG to speed or RPM to speed or even MPG to throttle position.

It could display something like this perhaps

And then save to the sd card to download to a computer later.

Adding an SD card seems perfectly feasible.

I'm thinking about using this shield from Sparkfun https://www.sparkfun.com/products/9802 it seems like I'll need to get the headers separately though which is no big deal since they're cheap.

Also completely unrelated but what size do you think the LCD in the picture I posted is? I think it would be just about the perfect size for my project.

And do you think the uno or Leonardo is a better choice for all this? The Leonardo has a few more digital pins but I'm not sure of all the differences between them of the sake of simplicity since there are a few different versions of the uno out there these are the ones I'm looking at
The uno. https://www.sparkfun.com/products/11021
The Leonardo Arduino Leonardo with Headers - DEV-11286 - SparkFun Electronics