PDA

View Full Version : floating A/D input



muddy0409
- 28th April 2009, 00:58
Hi all.\
Got aa question for the geniuses out there.
I am reading an analogue voltage of 0 to 13.8vDC via a resistor divider to drop it down to 5v max. The divider has one resistor from the pin to ground and one from the pin to the input voltage. Therefore the pin is never actually "floating", but floating is one of the input conditions that I want to read. With a conection from the input resistor to the voltage a divided voltage will be read by the pin.
So far so good. This bit works perfectly.
However when there is no contact between the input resistor and the voltage, the second resistor will pull the pin down to ground. This will give the same reading as if the input was touching 0 volts. So far I have not been able to figure out just how to differentiate between the actual 0 Volt reading and the input floating. ?????
Intriguing, ain't it?
Regards.

tenaja
- 28th April 2009, 01:08
Put an extra R to ground, so your Vin never hits "0". It doesn't take much, and it does limit your range a bit, but it allows you to detect when the input is there.

Charles Linquis
- 28th April 2009, 05:38
If your source is a low impedance, which it probably is -

and if you place a small capacitor (.1uF or so) connected to the
input of the voltage divider, turn your A/D input into a digital output.
Drive it high for several milliseconds (depends or your resistor and
cap values). It is safe to do this because your PIC pin is "protected"
by the voltage divider impedance.
Then turn the pin back into an analog input and read it immediately. If you have a voltage, the input was floating
(the capacitor still has some charge left). If the voltage is zero, the source is connected
and is at zero volts.

By doing some calculations, you can figure out the timing for your application.

amgen
- 28th April 2009, 13:21
add resister from +5V to top voltage divider R that is X10 to X100 the R-divider values to give 2,3 or say 5 point A/D reading with floating (no sensed voltage connected). The low current should not affect the sensed voltage reading. Could add a diode from +5 pointing to the new resister to stop any current from the 13V backing up to the 5V.
don
amgen