The value of the internal pullup resistor (Rup) is around 20k.
In A0 you will find (voltage divider Rx/Rup):
Vx=Vcc*Rx/(Rx+20k)
So you will never obtain the full-range voltage (0-5 Volts), but less than 5V, depending on the maximum value of the resistance of the potentiometer.
For example, considering the formula, with Rx at its maximum,
- if you have a 1k potentiometer, the range will be 0-0.2V
- if you have a 20k potentiometer, the range will be 0-2.5V
- if you have a 100k potentiometer, the range will be 0-4.16V
When the knob is versus the ground, you will always find a value close to 0V (it depends on wiring resistance)
Usually the free wire of the potentiometer is connected to the central one: this reduces noise for large resistors and reduces glitches dued to mechanical defects.
Without external power supply, you will never burn your pin, for sure...
Hope this helps
Thanks advansis for the detailed description. indeed it helps and it's more clear now. But it seems my application may not work on this setting because my
sensor only has 2 wires, and I think the only solution is to use Peter Simpson's example of water sensor because it's similar in this case. In other words, to use a brake-out module.
https://www.b4x.com/android/forum/threads/reading-a-fc-37-water-sensor-2-pin-black.96335/ (thanks Pete)
You can use your 2wires sensor: my schema uses a 3wires and transforms it in 2wires
Well done. Forgive me for not responding before... Your module seems an amplifier.
Well done. Forgive me for not responding before... Your module seems an amplifier.
You can also use the attached schema. The value of Rup should be 1k or more (not less otherwise the circuit will waste a lot of energy).
Put a ceramic capacitor in series with your probe, to reduce noise. Disable the internal pullup resistor.
The formula for calculating your resistance is the same Vx=Vcc*Rx/(Rx+RUp) where Rx is your resistance and Vx is the value read on A0