5

I've been tasked with interfacing with the on-board diagnostics of a vehicle.

Some systems use 7V signalling, some use 5V signalling, some signal up to the battery voltage (which can be as high as 28 V on some bigger vehicles). I need some way to handle these high voltage inputs which may exceed my microcontroller's 5V rating. I was thinking of an optoisolated system but communications need to be bidirectional and fast (100kbits second maximum). As it's OBD-II, I'll need two channels; some vehicles use transmit and receive channels, while others use one channel for both transmit and receive. Are there any options for me to consider?

PeterJ
  • 17,131
  • 37
  • 56
  • 91
Thomas O
  • 31,546
  • 57
  • 182
  • 320
  • do you have to build the OBD interface yourself? There are quick a few relatively cheap OBD interfaces that handle the variations in signaling and provide serial/bluetooth interfaces for your micro-controller to talk with. – Mark Dec 21 '10 at 15:12
  • @Mark, Ideally it would be me building the OBD interface, as I don't want to rely on external modules, and cost is not a massive concern (product may retail for ~£500.) – Thomas O Dec 21 '10 at 15:13
  • Is this OBD2 or just OBD? – Kellenjb Dec 21 '10 at 15:27
  • Do also may need access to the CAN bus on the vehicle. – Jim C Dec 21 '10 at 15:49
  • @Kellenjb, OBD-II. – Thomas O Dec 21 '10 at 15:53
  • @Jim C - OBD-II sometimes provides access to CAN, but support for plugging into CAN bus will be included. – Thomas O Dec 21 '10 at 15:54
  • @thomas O when I first read the shifter tag I thought you were wanting to interface with the cars transmission and do auto-shifting or something – Kellenjb Dec 21 '10 at 17:34
  • @Thom: I changed your question title as it seems like this is *only* about ODB-II. If I'm wrong, please clarify in the question itself rather than additional comments. – Nick T Dec 21 '10 at 18:23

2 Answers2

3

Maybe look at using an off the shelf chip solution such as the ELM327. This looks like it will handle all of the various voltage and protocol issues.

timrorr
  • 1,713
  • 10
  • 10
  • AFAIK, these are just rebranded PIC microcontrollers. Look at the datasheet - they have MCLR, Vss, Vdd and Xtal pins in exactly the same positions as 24F chips (and possibly 18F chips, though I don't have a datasheet on hand.) So I doubt they actually handle the high voltages, although they do handle the various protocols, which is useful for me, so I might get one just to see how it works. – Thomas O Dec 22 '10 at 00:17
  • Looking more closely at the datasheet you're probably correct. That said however, you can see that the connections to the various vehicle signals either go through IC drivers (for example J1939/CAN) or discrete transistor level shifters. All recevied signals are simply passed to the microcontroller pins using only series resistors for protection. Most input pins include parasitic diodes so you can supply higher voltages to these pins as long as you limit the current. – timrorr Dec 22 '10 at 04:02
  • @timrorr - Intentionally using the IC's built-in parasitic diodes is a bad, bad practice. I would have little or no confidence in a design that used the integral diodes for voltage limiting. – Connor Wolf Jun 21 '13 at 09:00
1

To read from a higher voltage just use a voltage divider.

To write to a higher voltage, use a line driver with a disable. Two MOSFETs will do the job. possibly one extra on each gate to help step up your output voltage so that the Final mosfet is closer to a short.

On your side of the voltage divider use a zener or similar device to protect against over-voltage and use large resistors in the divider so that there is very low power dissipation. This will protect your inputs. I would use a Schottky diode in reverse to protect against reverse voltage, their low turn on voltage will protect your micro.

Kortuk
  • 13,362
  • 8
  • 60
  • 85
  • At higher speeds, this might struggle, because the series resistors form an RC circuit with the pins capacitance. Good idea on the dual MOSFET though. I am just considering whether or not to just signal at 5V and use an input driver which can handle signals up to the battery voltage. – Thomas O Dec 21 '10 at 17:48
  • @thomasO, what is your pin capacitance, just trim the resistor divider, this is one of the fastest ways to do shifting. Use 1K resistors, you will not run into problems. – Kortuk Dec 21 '10 at 17:50
  • @thomasO 100kbps seems like it is plenty slow. – Kellenjb Dec 21 '10 at 19:26
  • @kellenjb, I'm dealing with 400kHz I2C and with 1k pull-ups it's hitting the limits, so it might be okay with 1k resistors, but I want to make sure it will work. What if the input was 5V, and the divider was configured for 28V? – Thomas O Dec 21 '10 at 19:38
  • @thomasO, build it, use smaller resistors, if you start to have speed issues go to smaller resistors. Use 140 ohm and 1k, see if it works for you. – Kortuk Dec 21 '10 at 20:00
  • @Kortuk, How do I handle the possibility of the transmitter using 5V or 7V signalling? – Thomas O Dec 21 '10 at 20:14
  • @ThomasO, I am not sure what you mean. Whom are you referencing as a transmitter, why could you not tie directly to a 5V line? – Kortuk Dec 21 '10 at 20:45
  • @Kortuk, As I mentioned in my original question, the signals may range from 5V to 28V and I need to handle ALL possibilities. – Thomas O Dec 21 '10 at 20:52
  • @thomasO, I am sorry, I thought you meant on different line they varied, I did not know you meant that they could vary that much on a single line. Welcome to digital pots. I thought there was some spec to which pins had which signal possibility. – Kortuk Dec 21 '10 at 20:59
  • @thomasO, why are you not buying a simple OBD connector? – Kortuk Dec 21 '10 at 20:59
  • @Kortuk, because I am designing a product. It costs too much to include one of those devices mentioned. I need to have a simple solution, not a complex one involving me integrating a special device. – Thomas O Dec 21 '10 at 21:46
  • @Kortuk, digital pots would probably not work, as they would require a supply voltage greater than 5V, and how many operate off ~28V? Not many. – Thomas O Dec 21 '10 at 21:46
  • @thomasO, you can give them supply voltage, and then they can handle higher on their Resistor lines... – Kortuk Dec 21 '10 at 21:53
  • @Kortuk, Most digipots I've found only handle up to Vcc. Either way, it seems far more expensive than using a zener. Would there be any unforeseen problems with a zener and resistor? I imagine capacitance could be one. In which case protection diodes could be used. This still doesn't solve the problem of transmitting back to the vehicle at up to 28V, although 5V may work. – Thomas O Dec 21 '10 at 22:09
  • @thomasO, you can do it with a zener, but you will need to use a large enough resistor to never cause problems. it will work just fine. – Kortuk Dec 21 '10 at 22:14
  • 1
    @ThomasO @Mark and @NickT gave very good reasons as to why just buying one or contacting a manufacture is the better then building your own. If your budget is £500 for the end retail device I don't know how you are going to be able to compete with devices that sell for £29. – Kellenjb Dec 21 '10 at 23:40
  • @Kellenjb because it will do much more than talk, the plan is to make a fully functional unit with a touchscreen LCD or PC interface. But the project is proprietary (for now, although open source is on the table), so I can't go into much detail other than this. – Thomas O Dec 22 '10 at 00:22
  • @thomasO, sort of like http://gopointtech.com/blog/products/landing-page-usa-desktop?gclid=CMa9786XgKYCFY9l7AoduU2_rA ? This product interfaces with OBD and connects to an iPhone and gives useful readouts, but using pre-existing hardware the cost is only hardware, and it can be very affordable. This is bad news for your solution. – Kortuk Dec 22 '10 at 15:34