Hi,
I am searching a formula/concept to measure the resistance of Potentiometer through ADC of microcontroller. I'm using 10-bit ADC and +5V microcontroller, but not a fixed potentiometer (potentiometer may be of different values such as 10K,1K,100R). My project is to measure 80% and above of any potentiometer resistance, where above 80% should be indicated through LED. How it is possible to measure?
Formula i've taken is, digital value= (voltage output/drop * Maximum ADC value)/total voltage
From this formula i calculated the 80% of digital value, for eg. i assumed 80% of total voltage first for substituting i.e. voltage output = 4V, Max ADC value = 1024(2^10), total voltage = 5V
When substituting it in digital value formula i get 819.2
So Whether it is correct to written a condition as
if adc_read value is above 819.2
{
led_glow;
}
else{
led_off;
}
or is there any different formula or concept available. Please give me some suggestions and clarifications