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
  • @ Krzysztof: Thanks for your input and observation.

    In addition to Krzysztof's input, it could be better to choose VDD/2 as reference voltage. That way, you will get a steady voltage measurement on the ADC AIN input pin when the battery drains and the supply voltage drops.

    Update 16.10.2014 If you have a battery voltage of 3.0V and choose VDD/2 as reference, your reference voltage is 1.5V. This means that you should not have higher input voltage than 1.5V, because that is the saturation point of the ADC where you will see value 1023 on the output when using 10 bit resolution. So if you have 1.5V as the source input to your voltage divider, and you have the resistor at 10kohm and thermistor at 10kohm then you will get 0.75V at the input and that should give you value 512 when you have no prescaler (option ADC_CONFIG_INPSEL_AnalogInputNoPrescaling). So with this setup, no prescaler would be needed on the input.

    Anyway, in order to utilize the range of the ADC in the best way and to maximize accuracy, the input voltage range should span as much of the reference voltage as possible. For example, if the reference voltage is 1.5V, then it would be best to dimension the voltage divider on the input so that temperature changes will make the input voltage vary between 0V and 1.5V

Reply Children
No Data
Related