I am trying to measure resistance with analog input. The only difference is I am not using an external voltage divider. I am trying to use the internal pullup resistor to form a voltage divider with the external resistor.

I know that the internal pullup is not very accurately quoted, maybe up to 40Kohm.

I know that enabling the internal pullup means a transistor is turned on thus a voltage drop will reduce the effective voltage of the divider to something less than 5V, maybe 4.6V.

I am trying to measure this voltage drop V_DS, or the rest of the voltage, V_eff, and the pullup resistor R_int.

Here is what I did, I connected R1=10Kohm resistor between A0 and GND and measured V1=1.119V.

I then connected R2=40Kohm resistor between A0 and GND and measured V22.584V.

I suspect V_ref=5.05V from USB power supply.

The resistors are 1%.

Then I solved the voltage divider equations and found the following:

V1/Veff=R1/(R1+R_int)

V2/Veff=R2/(R2+R_int)

V_int.=30.9Kohm

V_eff.=4.58V

I wonder if these numbers are right or not. My calculations based on these numbers seem a bit off from measurements with different resistors, by a few percent.

What's the best way to figure out these values?