Read Arduino ADC Value Stable and Low Noise

Posted on

Arduino ADC

How to read ADC Arduino becomes stable reducing noise – in certain applications, the ADC becomes very important. Reading a stable value will affect the final results of the reading.

Like the example in the following image using a 10k potentiometer connected to the A0 analog pin.

Please use the circuit above, turn the potentiometer to the middle and leave position, the results of the ADC will be found that the final score sometimes changes like 515, 516, 517, 515, 517 and so on.

How do we make this change not happen too? The answer is with a smooting technique. So, the program will be made to read the ADC value for 10 times and from 10 times it will be taken on average.

Read The Arduino ADC Value Stable and Low Noise

Code Program

The progam is as follows:

int adc = 0;                 
const int read_total = 10;
int read[read_total];
int arrayTotal = 0;
int value = 0;

void setup()
{
  Serial.begin(9600);
}

void loop()
{
  value = value - read[arrayTotal];
  read[arrayTotal] = analogRead(A0);
  value = value + read[arrayTotal];
  arrayTotal = arrayTotal + 1;

  if (arrayTotal >= read_total) {
    arrayTotal = 0;
  }

  adc = value / read_total; //get average value

  Serial.println(adc); 
}

Please upload it and viewed on the monitor series, if you want more smoot again, change the value of the number_baca to even greater. Thank you for visiting the website Chip Piko.

Hopfully this Read Arduino ADC article is useful.