This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

ADC values with no input

Hello,

I'm trying to read voltage signals from a sensor using internal ADC and send them OTA. For now, my codes seems to work, but the only problem with my codes is it gives maximum ADC value (e.g. 0xFF at 8 bit resolution) when the analog input pin is not connected to the sensor. It is usually fine when stable voltages are provided to the input pin but at certain condition it seems to cause wrong readings (e.g. 01 FF 02 FF 00 FF... instead of 01 00 02 00 00 00...) So, I'm wondering if there is a way to set ADC values when there is no voltage reading.

Thank you for your help in advance.

Parents
  • Hi comkuk

    As awneil point out, the pin is floating when you do not have anything connected to it, and you could be reading whatever values with the ADC on a floating pin. When you have a pin configured as analog input pin, I do not thing you can define an internal pull for the pin. You could instead connect an external pull-down resistor to the pin, e.g. a 1Mohm resistor between the AIN pin and ground, in order to read zero values on the ADC output when the sensor is not connected.

Reply
  • Hi comkuk

    As awneil point out, the pin is floating when you do not have anything connected to it, and you could be reading whatever values with the ADC on a floating pin. When you have a pin configured as analog input pin, I do not thing you can define an internal pull for the pin. You could instead connect an external pull-down resistor to the pin, e.g. a 1Mohm resistor between the AIN pin and ground, in order to read zero values on the ADC output when the sensor is not connected.

Children
Related