This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ADC interfacing Problem

Hi am using a thermistor of 10 k with a known resistor of 10 k ,and am giving the voltage divided input to ANI2 (p0.02).The suppply voltage for thermistor is external of 1.5 volts battery.So normally the voltage input to adc seems to be 0.720volts .Since am using 10 bit adc configuration ,the expected output should be from 430 to 511 right ? (1023/2~=511 ) but am always getting low values of range 200-250 .. Here is my adc configuration

uint16_t adc_init() { uint16_t adc_result; // interrupt ADC NRF_ADC->INTENSET = (ADC_INTENSET_END_Disabled << ADC_INTENSET_END_Pos);

// config ADC
NRF_ADC->CONFIG	= (ADC_CONFIG_EXTREFSEL_None << ADC_CONFIG_EXTREFSEL_Pos)  
				| (ADC_CONFIG_PSEL_AnalogInput2 << ADC_CONFIG_PSEL_Pos)					
				| (ADC_CONFIG_REFSEL_VBG << ADC_CONFIG_REFSEL_Pos)							
				| (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling << ADC_CONFIG_INPSEL_Pos)                             
				| (ADC_CONFIG_RES_10bit << ADC_CONFIG_RES_Pos);									

// enable ADC		
NRF_ADC->ENABLE = ADC_ENABLE_ENABLE_Enabled;					  															

// start ADC conversion
NRF_ADC->TASKS_START = 1;

// wait for conversion to end
while (!NRF_ADC->EVENTS_END)
{}
NRF_ADC->EVENTS_END	= 0;

//Save your ADC result
adc_result = NRF_ADC->RESULT;	
	
		return adc_result;

}

Could you please where i had made the mistake !!

Parents
  • Hi,

    Please check the reference manual page 176 and product specification on page 49.

    You're using internal ADC reference which is 1.2V (ADC_CONFIG_REFSEL_VBG) so you're 1024 ADC is 1.2V, then you're using 1/3 voltage divider for input (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling). I believe that you should use the following equation:

    ADC = (Vin / 3) * 1024 / 1.2
    

    e.g. for 0.75 Vin is:

    ADC = (0.75 / 3) * 1024 / 1.2 = 213
    

    which is roughly what you get.

    Krzysztof

Reply
  • Hi,

    Please check the reference manual page 176 and product specification on page 49.

    You're using internal ADC reference which is 1.2V (ADC_CONFIG_REFSEL_VBG) so you're 1024 ADC is 1.2V, then you're using 1/3 voltage divider for input (ADC_CONFIG_INPSEL_AnalogInputOneThirdPrescaling). I believe that you should use the following equation:

    ADC = (Vin / 3) * 1024 / 1.2
    

    e.g. for 0.75 Vin is:

    ADC = (0.75 / 3) * 1024 / 1.2 = 213
    

    which is roughly what you get.

    Krzysztof

Children
Related