6
\$\begingroup\$

I have an ADC input that may be connected to an external sensor (based on how the user configures it). If I leave the input floating, I get a wide range of ADC values.

Is there a way to weakly ground this input to get a stable reading if nothing is connected?

\$\endgroup\$
8
\$\begingroup\$

Try using a pull down resistor. 1M might be suitable, try out different values. Higher values may tend to not completely ground your ADC input. Lower values may cause a too heavy load on your sensor.

\$\endgroup\$
4
\$\begingroup\$

A 100k ohm or lower resistor to ground would be suitable. Make sure the resistor does not load down your sensor too much.

OR, if you have a way of the microcontroller determining if the sensor is connected or switched on (for example, the MCU controls power to it), you can disable the analog input. For example, on PIC16F series chips you can set the pin as an output (TRISx), drive it low (PORTx) and turn off the analog input (ANSELx).

\$\endgroup\$
  • \$\begingroup\$ I tried setting the pin to output a low, the the ADC is still reading mid-range values. \$\endgroup\$ – Robert Jan 26 '11 at 22:00
  • \$\begingroup\$ Perhaps then when the output is low make a note in the program to ignore ADC readings? \$\endgroup\$ – Thomas O Jan 26 '11 at 22:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.