ADC is very noisy

DrScanlon
Posts: 11
Joined: Tue Oct 04, 2016 8:46 pm

ADC is very noisy

Postby DrScanlon » Wed Mar 29, 2017 8:44 pm

I'm testing the adc1 for use in an application. With the 2V scale attenuation and using a 1.6 volt battery at the input, the average readings are about 860 or so. I'm aware of some linearity problems, but the main issue is that the readings from 660 to about 990. I am using the following code snippet in main():

Code: Select all

	int level = 0;
	int newlvl;
	int maxlvl = 0;
	int minlvl = 4095;
	adc1_config_width(ADC_WIDTH_10Bit);
        adc1_config_channel_atten(ADC1_CHANNEL_6, ADC_ATTEN_6db);
       delay(2000);
       
       // toggle led on each loop
       // output values to terminal

		while(1) {
		  level ^= 0x01;
		  gpio_set_level(LED_BUILTIN+1, level );
                  newlvl = adc1_get_voltage(ADC1_CHANNEL_6);

                 // update min/max
                 if(newlvl > maxlvl)
			maxlvl = newlvl;
		 if(newlvl < minlvl)
			minlvl = newlvl;
		
		  printf("***************************\n");
		  printf("level = %d\n", newlvl);
		  printf("max level = %d\n", maxlvl);
		  printf("min level = %d\n", minlvl);
		  printf("***************************\n");
		 delay(500);
	       } 
For this test, I am not using FreeRTOS tasks or WIFI. Is there a plan to fix this very noisy behavior? Also, is the ADC circuitry using a sample/hold? If so, how do we set parameters for it?
Thank you.

Frank

Who is online

Users browsing this forum: No registered users and 17 guests