1970 Eldorado - Converting Automotive Voltage Sensor Ranges to 0 - 5V

Greetings everyone,

This is my first post on the Arduino Forum, so be gentle with me.

I am at the planning stage of a project that, when complete, will quantitatively display various things on a 1970 Cadillac Eldorado. For those of you not familiar with the Eldorado, which I expect to be most people, the instrument cluster on the dash consists of a fuel gauge and speedometer. That's it. If you are lucky, an idiot light will come on if your oil is low or the engine is on fire. And although there are aftermarket gauge clusters that you can bolt on your dashboard, hood or anywhere else, I wouldn't learn anything by simply bolting on an aftermarket part. Plus, they never look good.

To begin with, I'm sticking with the basic oil pressure, temperature and battery voltage. Of course, modern sensors are readily available for oil pressure and temperature. And reading the battery voltage is...reading the battery voltage. So generating analog values is not an issue. The original, stock "sensors" aren't sensors at all but simple switches that close at some threshold to tell you that you are about to turn your engine into a very large paper weight.

Then there are, of course, different types of modern sensors. Those that put out a variable voltage based on what is going on and those that change resistance based on what is going on. I have the latter figured out. What I haven't [satisfactorily] figured out is the route to take for the sensors that output a voltage range. Not because I haven't found a route, but because I have found several. And I'm having a difficult time deciding which will actually do what I want and as simply as possible.

For the moment, let's forget about what/how I'm going to use the end data and simply focus on not burning up the Arduino. I need to take a voltage range from 0 -14V+ (I've been told it can peak as high as 18V) and linearly scale it down to 0 - 5V. From there, I can use the Arduino's A/D converter to neatly turn the 0 - 5V into values of 0 - 1,023. And then, from there, I can worry about the next leg of my journey.

At it's most basic, I want to reduce fluctuating automotive voltage levels to TTL logic levels. I could build a simple voltage divider that results in my highest voltage being 5V. But that won't be very robust as spikes/peaks aren't common or expected sensor values. So I'm going to need to work a bit harder than that. "Normal" battery voltage levels in an automobile are typically between 13 and 14V. And even that goes up and down as various things occur within the electrical system. So I am likely going to have to average out sensor values over some period of time or filter out fluctuations beyond some threshold.

It's also probably worth mentioning that although I have played with controlling stepper motors with the Arduino and written a sketch or two, I'm certainly not an electronics engineer. In fact, that's part of the point of this exercise. It gives me a concrete project with a set of process control problems to solve. Although I won't actually be controlling anything, only measuring it (at least for now).

So, with all of the above in mind, how would those of you in-the-know approach this problem? How do I regulate the automotive voltage fluctuations without errantly regulating sensor values? Of course, car companies have already figured this out. However, as of yet, I have not.

Also, keep in mind that this is not a real-time, mission-critical application. Engine temp doesn't spike in two seconds. If it takes 1000ms to adequately filter and process an input, so be it. In fact, that's preferable to seeing an indicator bouncing all over the place (which is exactly what they did in my 1952 Buick). The thing that averaged my Buick's values out was your brain. That is, if you didn't have a seizure from watching the instruments.

Thanks for your time,

Brandon

O.k., I believe I have a plan...

I am going with a voltage divider. I am going to map 0 - 20V to 0 - 5V. Voltage, even at peak, should never get to 20V. The divider will use a 5.1V Zener diode to prevent any issues if a value above 20V does somehow happen. 3.9K Ohm on Vin and 1.3K Ohm to ground. I may get fancy and add a capacitor to smooth out changes (probably not).

I need to determine if my Arduino is a 5V or 3.3V default. If 3.3V, I can set it to external regulation and set it to 5V. Or re-do my divider math sigh.

From there, it's a simple matter of reading the analog input values and sending the resulting digital value to an output connected to a Raspbery Pi input. At that point, I can write whatever crazy filtering and algorithms I want to drive the display. I've already got the Arduino sketch written. Next...a lot of Python. Guess it's time to learn Python...

A simple voltage divider would help for the On/OFF sensors.
For analog data, you should use voltage dividers or optocouplers and also read the momentary battery voltage and compare it with the sensor values.
Good AD-conversion depends on a stable reference voltage.

Look at this:
http://forum.arduino.cc/index.php?topic=170560.0

5.1V zener is too close to the 5V, so your reading will not be linear.

From there, it's a simple matter of reading the analog input values and sending the resulting digital value to an output connected to a Raspbery Pi input. At that point, I can write whatever crazy filtering and algorithms I want to drive the display. I've already got the Arduino sketch written. Next...a lot of Python. Guess it's time to learn Python...

For this project, I'd expect that the arduino itself could handle the display, unless it's really complex. Or is learning Python another one of the objectives?

o_lampe:
A simple voltage divider would help for the On/OFF sensors.
For analog data, you should use voltage dividers or optocouplers and also read the momentary battery voltage and compare it with the sensor values.
Good AD-conversion depends on a stable reference voltage.

The On/OFF sensors are actually being replaced with analog data sensors. For example, the stock oil "switch" simply closes if the pressure drops below 9psi. I am replacing this with an oil sending unit that fits the same 1/4" - 18 thread hole, but has a range of resistance based on pressure (say 0 - 180 Ohms). My plan for that is to use the oil sending unit in a voltage divider such that it will give a range between 1 - 3 V.

As far as a stable reference voltage, I am looking at off-the-shelf cigarette-to-USB adapters (which I'll take apart). I need to make sure that the one I end up using provides a steady 5V regardless of what the car's battery voltage is doing. If I have to, I can build my own circuit with a voltage regulator and filters.

wildbill:

From there, it's a simple matter of reading the analog input values and sending the resulting digital value to an output connected to a Raspbery Pi input. At that point, I can write whatever crazy filtering and algorithms I want to drive the display. I've already got the Arduino sketch written. Next...a lot of Python. Guess it's time to learn Python...

For this project, I'd expect that the arduino itself could handle the display, unless it's really complex. Or is learning Python another one of the objectives?

I should have been more clear by what I meant by "display". I am actually going to use a 7" HDMI display. If I were going to use an LCD display then, yes, the Arduino would be sufficient. However, I am actually designing a GUI "dashboard" that I will be able to add sensor "widgets" to. And, no, learning Python wasn't an objective. lol. In reality, I may use PHP. I'm planning to run a web server on the Raspberry Pi and build an HTML interface. Any server-side language will suffice. And a MySQL database will log data over time. At some point (in the distant future), I will add an analytics component that charts historical data to show trends (such as a slow drop in oil pressure or slow increase in engine temp).

pito:
Look at this:
Zener Diode usage in Voltage Divider - General Electronics - Arduino Forum

5.1V zener is too close to the 5V, so your reading will not be linear.

I think, based on that thread, that I will do something like pito's "ultimate" plan.

bgohsman:

pito:
Look at this:
Zener Diode usage in Voltage Divider - General Electronics - Arduino Forum

5.1V zener is too close to the 5V, so your reading will not be linear.

I think, based on that thread, that I will do something like pito's "ultimate" plan.

They were only discussing a switch situation, not AD conversion like you want to do

bgohsman:
....... I am actually going to use a 7" HDMI display. .....I am actually designing a GUI "dashboard" that I will be able to add sensor "widgets" to. ......I will add an analytics component that charts historical data to show trends (such as a slow drop in oil pressure or slow increase in engine temp).

[2016/May] How is this project going?

Dr B