I’m trying to determine the resistance value of a variable resistor (pot) on a battery powered microcontroller. If I don’t have a constant voltage reference, and the battery voltage varies from 4.6V to 3.3V, how can I do this with the analog input. I have a voltage divider with a constant resistor of 10K-ohm, and the variable resistor is…say 1K-ohm to 20K-ohm.
It seems like if I read the analog voltage and say the scale is 0 to 60,000 counts…and ADC reading is 30,000 counts (half of full scale), then I can say that the variable resistor the same value as the known resistor, so it’s 10K-ohm. Half of the battery voltage dropped across the first resistor, so he second resistor must be the other half.
Similarly, if the ADC reading is 20,000 counts, that’s 1/3rd of 60,000, so (depending on if the variable resistor is on the high side or on the ground side), the variable resistor is 1/3 of the total resistance, so (x)/(x+10k)=1/3, x=3330 ohms.
I’ve been reading this online, and a couple of articles touched on it, but they didn’t explain it in a way that I understood. Is the way I understand it correct?