cancel
Showing results for 
Search instead for 
Did you mean: 

ADC reads a mid level value when input is floating, how can we make it read zero?

GGrum.1197
Associate

When the input to the ADC (in the STM8L151G6) is floating, it reads approximately a mid level value. For example, if the ADC's reference voltage is 3 volts it reads around 1.7 volts. Why does this happen?  We can't find a register setting that causes this to happen. We were expecting it to read 0 volts. How can we make it read 0 volts? 

3 REPLIES 3
Stecklo
Senior

If an input is floating that means its voltage is not pulled explicitly to any level on a board. So you can't expect any specific conversion result. You could use pull-down resisor if you need zero

Indeed capacitor is going to need somewhere for the electrons to be going.

Perhaps you can just commit a grounded ADC pin, and interleave to that channel before to the one that might be floating?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Stecklo
Senior

Ocasionally, I have similar question.

I'm using ADC on STM32WB55CG.

It has no specific Vref pin, so the Vref is connected to VDDA inernally. VDDA = 3V.

In a differential mode I have one pin always equal to 1.5V and the other one [0; 3]V. I expect the conversion result to be [-2048; 2047] or at least [0; 4096] as the ADC is 12 bit. But in fact I get about 1985 when inputs are equal and the whole range of results is somewhat [1000; 3000]

What am I doing wrong?