2021-11-28 06:26 AM
Hello, I'm using stm32f103c8t6 board and trying to get simple voltage divider readings. I'm also using multimeter to measure voltage and well I'm getting 0.2 sometimes 0.4 V error. Is this normal? I really need precision, 0.2 or 0,4 volts are really to much for me. I'm using regular conversion on 1 channel every 10 seconds with maximum 239.5 cycles sampling time. This is the code I use (yes I try to calibrate it and that doesn't work)
HAL_ADCEx_Calibration_Start(&hadc1);
HAL_Delay(10);
HAL_ADC_Start(&hadc1);
HAL_ADC_PollForConversion(&hadc1,100);
ADC_VAL=HAL_ADC_GetValue(&hadc1);
HAL_ADC_Stop(&hadc1);
voltage=ADC_VAL*3.3/4096;
#[STM32 MCUs] #ADC #STM32F1
2021-11-28 07:40 AM
Multimeters take their reading by long term averaging. Perhaps the signal you're reading is oscillating.
2021-11-28 07:52 AM
nope, I'm trying to measure Li-ion cell's voltage through voltage divider and it should be around 2.7 volts I get 2.4-2.8 volts and sometimes 3.2 volts for no reason. Are stm32f1's ADC really so inaccurate ? Maybe the problem is that I bought this mcu on alliexpress, so maybe it's faulty or something like that?