[SOLVED] Potentiometer using ADC

Status
Not open for further replies.

vilfred

Member level 1
Joined
Mar 21, 2018
Messages
37
Helped
0
Reputation
0
Reaction score
0
Trophy points
6
Activity points
368
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
 

You can connect a ACS712 current sensor in series with Potentiometer. The ADC0 channel will then provide voltage across the measured resistance and the ADC1 will give the current through the resistance. With V and I you can calculate R of the POT.
 

Hi,

* no need to know/measure pot_total_resistance.
But it's important to use this setup:
* connect one end of the pot with GND
* connect the other end of the pot with VCC (ensure clean properly decoupled VCC)
* connect the wiper with ADC. (A decoupling capacitor to GND could help to reduce noise)
* use VCC as ADC_VRef

Then (independent of pot_total_resistance) 80% of pot will result in 80% x 1024 of ADC_value = 819 (rounded to next integer value).
The use of float value makes no sense.

Thus your concept was (almost) correct.

Klaus
 
Status
Not open for further replies.

Similar threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…