Input processing in an automotive environment...

Hi all!

I'm making a custom dash for my car and so far have designed the casing and bits in cad, I have a working model of the basic parts on a breadboard, and and now starting to work with Eagle to figure out how to design a schematic and hopefully then a PCB to have printed.

I've mapped out the different pins and functions that I want to use, and they generally break into these two categories:

  1. Digital input (on/off sensing)
  2. Analogue sensor input (temp sensors and fuel level)

In the case of option 1, I would be looking to read whether something on the car is on or off, so that's going to be a signal somewhere between probably 10 and 16 volts plus spikes and noise.

For this case, what is the best method for protecting the arduino and achieving a reliable digital signal? I've seen voltage dividers and maybe most promising is an opto-isolator. Is there a general consensus on the best way to do it as I imagine that this path is well trodden..?

For the second case I would be trying to read the scale of the sensor. I have coolant temp, intake temp, ambient temp, oil pressure and fuel level. I've seen again a few ways of reading this. I guess you would put 12v to the sensor, then use a voltage divider such as a LM2940 and some capacitors to pull down the signal then use an analogue read to interpret the signal. Again, is there a consensus on the best way to do this? I will obviously be doing this on a few input pins, so is there an efficient way to do it or is it just repeating the same configuration per channel?

Thanks! Nick

I've seen voltage dividers and maybe most promising is an opto-isolator. Is there a general consensus on the best way to do it as I imagine that this path is well trodden..?

Yes it is, and survey says forget about voltage dividers and use opto-couplers.

Read the datasheet for the opto-coupler and calculate the correct current limiting resistor for the led
using the following formula:

RCL=VSENSED/ILEDNOMINAL

An opto-isolator is a "super safe" solution but they are not linear so they don't work for analog.

[u]Over-voltage protection circuits[/u].

In most applications, I'd increase the resistor to between 1K & 10k. It's a current-limiting resistor to protect the diodes and the driving circuit when you over-voltage and the diodes turn-on.

then use a voltage divider

Yes...

such as a LM2940

No... That's a voltage regulator that puts-out a constant voltage... Not what you want! A [u]Voltage Divider[/u] is simply 2 resistors. It's the resistance ratio that's important, but I generally recommend resistors that sum-up to around 10K.

It's a good idea to add a "protection diode" (as above) to the voltage divider.

…Some of your analog sensors may themselves be voltage dividers (with one variable resistance) or potentiometers (variable voltage dividers). The consequence is, your gas gauge may show more-full when the battery voltage is higher, etc. If that turns-out to be a real problem, you can use another analog input to read the battery voltage (through a voltage divider) and compensate in software.

Thanks both! Yes sorry, momentary brain fart on the LM suggestion - had voltage regulators on the brain!

Ok, so Opto-Coupler for the digital reads, and voltage divider for the scaled reads if the signal isn't already 0-5 volt. Sounds like I need to check this. If they are 0-5v then do I require a clamping diode of some kind to prevent over voltage due to the situation you describe or does the arduino (Teensy 3.2 in this case) have input clamps?

If you run into any situations that you can't handle with those approaches you can always use op amps to
interface the instrumentation.

An op-amp...??! How so??

It's complicated. You can google it but don't worry about it yet because it's not something you're going to learn overnight. You can do almost anything with op amps if you know how but it takes some studying to
learn how to use them. If you ever do, I recommend the Linear LT1215 op amp. Wait till you run out of options before you go down that road.

Hahaha wise words indeed. I'm a mechanical engineer by trade and my brain is already feeling quite stretched as it is so I'll leave that rock undisturbed for now... Thanks for the tip though!