Noise in ADC data from Xiao SAMD21

Hi,
In Xiao SAMD21, I designed a PCB to measure Voltage using Xiao SAMD21 internal ADC. But always getting Noise data details are attached below. In program

  1. ADC set to 12 bit mode.
  2. Using analogRead function.

Tried many ways to clear the noise, none of them are not working. Pls suggest a way to solve.
DATA_SAMPLES

Hi, Jaishankar
If you just want to remove the noise, I assume you can just average it out, but how did you average it out?
With a little more information, I might be able to make a suggestion.
1.The vertical axis of the graph [volt/div] and the horizontal axis [sec/div]
2.What are you measuring? Approximate voltage and frequency
3.If possible, connection diagram and sketch

Above data is captured by Microcontroller itself with 50mSec time interval

Input to ADC i manually varied three times with + or - 0.5V

To make this graph i subtract the offset value(set voltage) and plot it.

Hi, Jaishankar
I wrote a comment on the following graph, is this correct?
How is the voltage for measurement generated?

I connected DAC and ADC and measured about 1V and 2V. I can measure without any problem.
Would you like to give it a try?

//XIAO SAMD21
void setup() {
  Serial.begin(115200);  
  while(!Serial);
     
  pinMode(A0, OUTPUT);        //DAC output pin
  pinMode(A1, INPUT);         //ADC input pin
  analogReadResolution(12); 
  analogWriteResolution(10);
}

void loop() {
  analogWrite(A0, 310);             //about 1[V]
  for(int i=0; i<100; i++) {        //50mS 100 times        
    Serial.println(analogRead(A1));
    delay(50);
  }
  
  analogWrite(A0, 620);             //about 2[V]
  for(int i=0; i<100; i++) {
    Serial.println(analogRead(A1));
    delay(50);
  }       
}

To capture the noise i have subtract set voltage from the collected. Graph plot with subtracted value(only noise). Each sample is collected with 20ms time interval. So Noise voltage is around 10-40mV.

As shown in the example below, a simple averaging will reduce the noise.
As for hardware, connecting a ceramic capacitor of about 1uF between the ADC input pin and GND and between the 3.3V pin and GND can also be effective.

Okay i will try again with the capacitor