PIC ADC floating I think

Thread Starter

gdallas

Joined Apr 25, 2012
74
Please see image attached. Whenever i remove my position sensor from my device, my displayed input which was previously 0% begins slowly floating up, and stops about 12% the sensor is just a variable resistor. so when disconnected the ADC input has nothing on its input other than a cap and a fixed resitor but the other end of he fixed resistor has no potential now obvioulsy. any ideas on what i can do either software or hardware to keep the reading at 0% when the sensor is disconnected?

thanks
 

Attachments

Markd77

Joined Sep 7, 2009
2,806
Sure, but having nothing connected is also over 10K.
If you really want to check if the sensor is connected, you could switch the pin to output high, switch back to ADC and measure how the voltage on the capacitor is changing, then repeat with output low. Driving an output straight into a capacitor would probably exceed the current recommendation of the pin, so an additional resistor at the pin might be a good idea.
 

ErnieM

Joined Apr 24, 2011
8,377
i meant when the sensor is conncted. will that pull down not affect it?
Of course it will, but a better question is how much will the effect be.

You have a source resistance (the pot) and the fixed R from the RC in series feeding a large value resistor.

Construct the voltage divider this forms and see how much the effect is.

Keep in mind that any voltage change less them 1/2 of a LSB * is basically undetectable.


* LSB or least significant bit. The width of each input voltage step for a single count change. Equal to the A2D reference voltage divided by the number of states (1024 for a typical 10 bit converter).
 
Last edited:

ErnieM

Joined Apr 24, 2011
8,377
I suppose I should also add the maximum equivalent series resistance of a potentiometer divider is just R/2, or 2.5K for your 5K pot.

(I can prove that if anyone wants to "see the work.")
 
Top