I was working with a Nucleo f411re (STM32 MCU) in order to read several analog sensors.
I started testing a single temperature sensor (LM35) and all was fine. When I added a linear potentiometer for reading its extension, a strange fact happened: the temperature read increased proportionally to the extension of the potentiometer. Here's the circuit:
PA0 and PA1 are analog pins, connected to stm32 ADC. Here you can find the ADC datasheet.
So I measured the output voltage from LM35 with multimeter and it was stable even when I was extending the potentiometer; while, if read from Nucleo, the temperature was "following" the potentiometer read.
I solved this problem adding a 1 µF capacitor between ground and the V_out of LM35. But I'm not satisfied, because I would like to know the reason of the strange temperature read behavior. Any Idea?
EDIT: I have found something that could explain this problem at section 3.4.1 of the ADC datasheet. It seems a known issue, due to the sampling switch in the internal sampling circuit of the ADC. Can you confirm this?