How to get more stable analog reading with Arduino..?

I wonder is it the code or little bit of hardware filtering in those commercial voltmeters or multimeters..How are they so stable on voltage display (any kind of analog reading)..?
I admit that those meters write to the display at a delay, but still they are much more stable.

Whereas when we do the same thing on the Arduino the fluctuation is much more.
How can I have a stable analog reading ..?

Can I modify the analog input so that it gets more stable or have to add more coding..?
Please suggest.

  • average several readings over a period
  • only display the value when it has changed significantly

You can use digital filters and hysteresis. Here's what I use: Arduino Helpers: 1.FilteredAnalog.ino

avg += (samp - avg) * K;        // K < 1

As described (in some detail) here

Even doing that keeps the number fluctuating ±3

Like when I am reading amps via ACS712 or other sensors

This usually requires a combination of hardware and software. A bit of filtering in hardware through an RC circuit, and some averaging in software. Usually that gets you pretty close. Keep in mind that if real world values fluctuate a bit, you actually want your device to also pick up on that. So it's not necessarily the best way to try and prevent any fluctuation in your measurement - you may be actually filtering out perfectly valid real-world fluctuations!

Add voltage follower, low output resistance of it will reduce/eliminate noise pickup by wires , capacitor on input.

And …….By default with an analog reading, the 5v supply is used as the reference for the A/D , if you have other loads on the Arduino this can fluctuate .There is the option to use an internal 1.1v reference which will give more stable results .

Can you observe that on oscilloscope ?

Have to see.. Have not seen that

When you put input wire to gnd - do you have fluctuation ?

What is the source of the voltage that you are measuring and how are you converting the analogue reading into a voltage ?

No .. not at all..
I can even read the input voltage also stable just by

float voltage = analogRead(A1) * 5 / 1023;

What fluctuates is all the other voltages I measure.

I don't mind a non calibrated value, but the value keeps fluctuating
Even the analog reading fluctuates.(That's the reason why the calculated voltage is fluctuating too)

My question is how to have a stable value reading. Calibration part can be taken care of.
Its not only me, but I have seen with almost everyone.
I have been living with this for years.
But now I want to make modifications to get a stable reading like the DMM.

Start with putting a 103 ceramic cap into the ARef pin and gnd pin.

Deep in the guts of the A:D converter is a point where the reference voltage is used against the incoming signal. Tied to that reference point is a connection that rises all the way from the deep guts of the A:D converter to the ARef pin. Right now that long connection is nothing more then an antenna that allows corrupting signals to live.

1 Like

So have you put that RC filter on the analog input pin, as suggested?

Yes.. I did use till 104, but still no change..

Just to clarify, you have decoupled the ARef pin, and filtered the analogue input pin?

And you are still getting +/-3 in the raw ADC readings?

Mega2560CSVDataToESP8266.ino from (edited to correct link)
Arduino to Arduino via Serial has an example of averaging.
also for AVR boards see PollingAnalogRead which talks about the need to discard the first reading.