2025-07-15 2:44 AM
Hello,
I’m trying to measure temperature using NTC sensors on four different ADC channels of my STM32 Nucleo‑H7 board. I could previously connect potentiometers to the same pins and get flawless ADC readings with the same code and CubeMX settings. I only added a function to convert NTC readings to temperature and didn’t change any other configuration.
I connected the NTCs to PA6, PA7, PC4, and PC5. In my loop, I call HAL_ADC_Start(), then four times HAL_ADC_PollForConversion() and HAL_ADC_GetValue() to retrieve the raw ADC values. When I measure the sensor output directly with a multimeter, I see about 1.65 V, but the ADC reads ~0.03 V, resulting in completely unrealistic temperatures.
I never had this issue with potentiometers on the same pins and code. Why am I getting such low readings with the NTCs? Is my channel assignment wrong, the pin mode incorrect, or could hardware jumpers/shielding be affecting it?
Has anyone experienced something similar or have suggestions? Thanks!
2025-07-15 3:05 AM
Hello @durna
Did you performe ADC calibration before measuring the temperature?
2025-07-15 3:45 AM
Hello @Saket_Om
yes as it appears in the code
2025-07-15 3:50 AM
Input impedances and sample times play an important role as well.
What impedances and currents/voltages we are talking about here ?
2025-07-15 3:56 AM
Everything seems to be correct both hardware and software wise, but the temperature readings are really ridiculous. I've been trying for 2 days and still can't figure it out
2025-07-15 4:06 AM - edited 2025-07-15 4:10 AM
The following values are valid in my setup:
Divider impedance (Thevenin): 10 kΩ (NTC) ∥ 10 kΩ (fixed) ≈ 5 kΩ
Divider current I = 3.3 V / (10 k + 10 k) ≈ 165 µA
Node voltage (multimeter): ~1.67 V ⇒ ADC raw value ≈1.67/3.3-65535 ≈ 33 000
Sampling circuit time constant:
S/H capacitor ≈ 4 pF, switch R_ON ≈ 100 Ω ⇒ τ = R-C ≈ 5 kΩ-4 pF ≈ 20 ns
ADC sampling times:
I actually ran the ADC at a 15 MHz clock with a ÷10 prescaler, so the ADC clock is 1.5Mhz
so the S/H capacitor must be fully charged. Despite this, the raw reading is ~600 (≈ 0.03 V)
2025-07-15 6:28 AM
Do values change if you increase sampling time to max?
Use DMA to convert multiple channels, but maybe get a single channel working first.