ADC input fluctuating

I’m using an Arduino Micro connected to an Arduino TFT display to build a car computer that shows clock, ambient temperature and various other things. Attached you will find the schematics. Most important thing for now is that ACC (coming from the car) is connected to A0 via a voltage divider. Additionally, the signal is smoothed using a 6.8uF capacitor. For testing purposes, ACC and VCC are connected to a lab power supply such that the Arduino can measure its own Vin voltage at A0.

For some reason, the measured value fluctuates badly by about .7V, respectively, .2V directly at PIN A0. I do not have an ocilloscope available, however, my multimeter shows a very stable voltage at A0. Now the strange things: If I decrease the lab power supply voltage to about 3 to 4V, such that there is just enough power to drive the logics and the TFT starts dimming, the values become stable. If I then increase the supply voltage again, everthing stays stable and there is no fluctuation at all.

I then took another older Arduino Micro from another project, flashed it with exactly the same code and replaced the current one. Now, there are no fluctuations from the beginning. But what I wondered about: From powering on, the older Micro takes about 11s until the TFT startes showing values. The new Micro takes only about 3s.

Both boards look very similar, both being of R3. However, one of the boards is more blueish (the older) and the new one is more greenish. Is is possible that the new board is broken? Or is one of the boards possibly not original? Or is the newer board just equipped with a newer bootloader that is quicker and leads to some errors reading from ADC?

schematics.pdf (659 KB)

code.ino (1.95 KB)

The A/D value depends on two things. The input voltage and the reference voltage (5volt). If one of them is unstable, you get unstable readings. Since you have measured A0, and it seems to be stable and decoupled, I suspect there is something wrong with the 5volt rail. I have read posts (can't find them right now) about oscillating regulators. Not enough decoupling on the board. Try electrolytic capacitors, e.g. 100uF, one from 5volt to ground and one from Vin to ground. Short leads, and directly on the pins of the board.

Apart from that, it's dangerous to power an Arduino directly off the car's supply. Spikes could easilly kill it. Leo..

I measured the 5V rail as well as the input voltage and they seem to be good. Oscillating is a good keyword. When the measured voltage is fluctuating, I can hear a very high frequency noise. Once I brought the setup into a state where the measured value is not fluctuating any more, the high frequency noise is gone.

Assuming it is the onboard regulator or something else that is oscillating, is there anything I can do about it? I already added some 100nF capacitors. I remember I aldready tried using more and bigger ones but it didn' help. I'll check again.

EDIT: When I'm adding an electrolytic capacitor to Vin, the noise is gone, but the value is still fluctuating. When I'm adding the big capacitor to the 5V pin, parallel to the 100nF capacitor, the noise as well as the fluctuation is gone. I didn't know decoupling is that important for such simple projects. In future projects I'll always use 100nF and 100uF in parallel for constant voltage rails :)

I have a UNO R3, at least so call UNO r3, for recording gauges with analog output. The result is disappointing, at first I thought the signal noise is terrible compared to the gauge reading. I added long averaging and capping code to try to filter out the bad outliners and smooth the rest. It helps a bit but the recorder's response is dull due to over smoothing. People on this forum also think using that much memory for averaging samples is waste of RAM. So I checked cable shielding, and input, found the input current is stable compared to the gauge reading. I go through the document and found the reference voltage page. After soldering a LM4040 precision voltage unit, and a 1% tolerance resistor, everything calms down without the capping and smoothing code. The calculated values match gauge reading to the last digit, 80% time.

The other day I mentioned the UNO R3 board, on this forum, people think it too cheap knockoff. I guess the $0.4 24v dc-dc switching voltage converter will not be too good either. Both may have contributed to a bad reference voltage.

This post is about a design flaw in the Micro. Maybe only in clones. A badly decoupled onboard regulator. Stable analogue readings is another story. Arduinos have an inbuild reference voltage that seems to be as good as an external one. Use that internal 1.1volt Aref when I you do critical things like temp measurements. Leo..

Good to know, its just the voltage seems too low, not sure if it will give the same precision. Am switching to pro mini, guess I don't have a choice anyway. Will try that in my next test.

zcattacz: Good to know, its just the voltage seems too low, not sure if it will give the same precision.

Sometimes a low reference voltage can give you a better resolution. Default Aref is ~5mV per digital step. 1.1volt Aref is ~1mV per digital step. Leo..