ADC Readings change?

I have an Arduino Duemillanove that I use for a data logger in my car. The arduino is powered by the +12v form the car. It is running perfect, but there is one thing that annoys me big time. The readings from the ADC changes - depending on the load on the +12v in the car.

I have a reference voltage that I measure, it is 1.16V. When the engine is on and nothing uses any power in the car, I get a perfect reading of 1.16V. But if I turn on the defroster, wipers, seat haters etc. then the voltage drops to 1.02V - according to the arduino. I have tried to measure the reference voltage with a Fluke, and it stays perfect stable.

So why does the arduino think it is dropping?

I take 25 readings, and return the average. The code is straightforward, just 25 samples divided by 25.

How is the Arduino powered? When you measure the VCC of the Arduino is it perfectly stable?

When you measure with the Fluke multimeter are you measuring at the Arduino pins?

THe Arduino is powered from the +12V in the car, and it fluctuates from 12.2V to 14.4V.

When measuring with the fluke, I measure at the same points as the arduino.

THe Arduino is powered from the +12V in the car, and it fluctuates from 12.2V to 14.4V.

That's a really really bad idea. Car 12V is anything but 12V - it has massive interference and noise spikes and will drop to less than 8V if you use the starter motor. Do whatever you can to isolate yourself from this supply - probably need an RF choke, followed by smoothing cap, followed by 10V or 8V regulator chip.

When you measure the VCC of the Arduino is it perfectly stable?

  • a question that can only be answered with an oscilloscope, a multimeter hides all the noise and spikes from you.

I have a reference voltage that I measure, it is 1.16V.

The words reference voltage means the voltage to which all A/D measurements are referenced. On the arduino this is by default the power supply rail. However it is possible to put an external reference voltage into it but software has to switch it over. There is also an internal 1.1V stabilised reference voltage but again you have to switch to it using software. Is that what you mean or is this 1.16V an external voltage?

If the arduino gives a different reading to your meter it could be because:-

  1. The arduino reference voltage is changing
  2. There is noise or oscillations on the voltage that the arduino is picking up but the meter is not (scope needed to see which)
  3. There is noise being picked up by the internal arduino A/D circuitry from your environment.

Just chiming in with an anecdote: I have an Arduino powered from a pack of AA NiMH batteries (10V). If I drive too many LEDs from the Arduino, the ADC will not get a reliable reference voltage. Even the regulator on the Arduino board has a hard time providing a stable 5V if there is too much current drawn.

I would start with MarkT's suggestion of RF choke, smoothing capacitor, then regulator (all of that external to the Arduino, just as a starting point for any in-car electronics project). In addition, I would source a decent voltage reference (Analog Devices or Maxim have a decent range). What I don't know yet is how much current the Arduino's ADC draws - if it is significant you would need to put a voltage follower between the voltage reference and the Arduino's AREF pin.

But that's my future plan, I haven't actually done it yet. I don't even have an oscilloscope to watch what's happening on the various pins (but I can get a cheap storage scope for about $300).

Which leads me to ask, are there any tutorials/walkthroughs available to show what the impact of variable voltage on the ADC, and how to implement a voltage reference for the Arduino? That is, starting with the symptoms of, "I'm getting unreliable reads from the ADC" through diagnosing the problem, adding a voltage reference, still having problems, adding a voltage follower (if such a thing is needed).

what the impact of variable voltage on the ADC

The impact is simply if the voltage reference changes so does the reading you get from the A/D for a given fixed voltage.
When the external fixed voltage you want to measure is the same or greater than the reference voltage you get a reading of 1023.

For more details see:-
http://www.arduino.cc/en/Reference/AnalogReference