Hi Jeff, Andrew.
Follow up to my previous reply.
Regarding using “PULLUP” resistor as upper leg of voltage divider to ADC input.
I have just carried out an experiment and arrived at the following approximations.
Arduino UNO, Freetronics version, Freetronics Eleven.
DMM. UNI-T Model U771B.
Firstly, contrary to my previous thoughts you can use the “PULLUP” feature and ADC functions at the same time.
I wrote a small simple sketch to initiate the PULLUP on A0.
Measured the open circuit voltage at A0 at 4.87V.
Terminated A0 to ground with 10kΩ and measured 1.047V.
Calculated PULLUP resistance value as 36.5kΩ.
Using a second method as a check, Voltage ratio is 4.65:1.
R Pullup = (4.65 * 10) – 10 = 36.5kΩ
Added “analogRead” to sketch and monitored ADC numbers.
Open circuit = 1005.
Terminated with 10kΩ = 226.
This ratio 4.45
(4.45 * 10) – 10 = 34.5kΩ.
The small discrepancies could be caused by any number of things. DMM and resistor tolerances, slight DMM loading, Actual DC accuracy and tolerances, rounding of numbers and it goes on.
These 2 results are respectably close and I would say the value of PULLUP resistance would be ≈ 36kΩ. Now I have only checked 1 analog input and may expect some small variation but for the intended use (pullup resistors) this would not matter at all. BUT to modify this and use this as the top leg of a voltage divider I don’t think would be predictable enough and would be too high to use with anything like a LDR. This is once again an example of suggesting to use something it was not designed for.
It is my humble opinion that for the application stated at the start of this post the better way would be to forget about using PULLUP and use the lower value resistor suggested. You will then have a better chance of predicting any result.