AnsweredAssumed Answered

ADC ports noise with force sensor

Question asked by JAEYONG SONG on Sep 27, 2018
Latest reply on Oct 3, 2018 by JAEYONG SONG

Hi,

 

I connected a force sensor to ADC0_SE16 of K66F and printed out an output value on the terminal.

It seems like it was very noisy for some reason. when force was applied, the maximum value went up to 58000. but when no force was applied, the value varied from 12000 to 19000.

So I tried ADC1_SE16 with exactly the same initialization and it showed a lot less noise without force being applied.
Then I tried another board (K66F) and the same behavior was observed.

I don't think it is a problem of the sensor or board so I guess it must be my code.

 

-----------------------------------------------------------------------------------------------------------------

void ADC_Initialize (void){
adc16_config_t ADC_configInput;
ADC_configInput.resolution = kADC16_Resolution16Bit;
// ADC0, Pin : AD16 (ADC0_SE16)
ADC16_Init(ADC0, &ADC_configInput);
// ADC1, Pin : AD16 (ADC1_SE16)
ADC16_Init(ADC1, &ADC_configInput);

#if defined(FSL_FEATURE_ADC16_HAS_CALIBRATION) && FSL_FEATURE_ADC16_HAS_CALIBRATION
/* Auto calibration */
ADC16_DoAutoCalibration(ADC0);
ADC16_DoAutoCalibration(ADC1);
printf("Auto Calibration Done!\n");
#endif

#if defined(FSL_FEATURE_ADC16_HAS_HW_AVERAGE) && FSL_FEATURE_ADC16_HAS_HW_AVERAGE
/* Use hardware average to increase stability of the measurement */
ADC16_SetHardwareAverage(ADC0, kADC16_HardwareAverageCount32);
ADC16_SetHardwareAverage(ADC1, kADC16_HardwareAverageCount32);
printf("Set Hardware Average Done!\n");
#endif /* FSL_FEATURE_ADC16_HAS_HW_AVERAGE */

ADC16_SetChannelConfig(ADC0, 0U, &ADC16_channelConfig);
ADC16_SetChannelConfig(ADC1, 0U, &ADC16_channelConfig);

/* Wait for the conversion to be done */
while (!ADC16_GetChannelStatusFlags(ADC0, 0U))
{
}
while (!ADC16_GetChannelStatusFlags(ADC1, 0U))
{
}
}

------------------------------------------------------------------------------------------------------------------

 

Did anyone have the same problem or anyone have any idea about this?

 

Thanks.

 

 

mcuxpresso forcesensor adc configurationn adc noisek66ffrdm-k66f

Outcomes