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 noise#k66f#frdm-k66f
Hi, JAEYONG,
Firstly, if you connect the ADC0_SE16 pin to VDDA or GNDA, read the ADC sample, what is the result?
I suspect the the FORCE sensor output impedance is too large, in the case, you have to design a buffer based on OP AMP(the OP AMP non-inverter pin is connected to the FORCE sensor output voltage, the inverter pin of OP AMP is connected to output pin of OP AMP), and connect the OP AMP output to ADC analog channel.
Hope it can help you
BR
Xiangjun Rong
Thanks. I actually was using too high resistance with force sensors that exaggerate noise. but then I also implemented Non-inverting OP AMP as well and it works fine now.
Thanks