cancel
Showing results for
Search instead for
Did you mean:

How to measure the resistance of a resistor connected at adc pin , what is the sink voltage at adc pin

Associate II

Hi , I am working on stm32f070c6 MCU , in that by using adc ,I want to measure the resistance of resistor connected at adc pin, by using simple formula of ohms law , I want to know how much current sink at an single adc pin , by knowing of current(i) value and the voltage differences between vcc and the analog reading gives the voltage(v) drop across the resistor by knowing these i and v i want to measure the resistance of a resistor connected at adc pin , I went through the stm32f070c6 data sheet but I am not understanding the exact current sink value at adc pin. (input frequency is 8 MHZ, and by using PLL i multiplied by 6 times and Fclk is 48MHZ )if you have any idea about of it give a suggestion.

Thanks in advance

@Vengat Raj​

4 REPLIES 4
Lead II

I don't think you can do it if the only thing connected to the pin is your unknown resistor, no matter where the other end of the resistor is connected.

The ADC is set up to measure a voltage. It does not intentionally source or sink current when measuring this voltage.

If you have a potential-divider consisting of two resistors joined at the stm32 ADC pin, one resistor connected to Vdd and the the other to Vss, the voltage at their junction relates to the ratio of these resistors. So that could be measured by the ADC.

The downside to this approach is that you are always passing current through the potential-divider, so you might want to gate this in some way (e.g. rather than having one resistor going to Vdd, connect it to an output pin which you only drive high when you want to measure the resistance).

The stm32 does have built-in resistors on most of its pins (weak pull-up or pull-down) but they are disabled when the pin is programmed to be an ADC input. So you can't use these as references for your unknown resistor. (Also the tolerance on these is very poor). The only way to use them would be to have an additional capacitor from the pin to e.g. Vss; you'd set the pin as an input with pull-up to set up your potential divider, wait for the voltage to stabilise (depends on C and R), then quickly switch the pin to be an ADC and measure the voltage on the capacitor before it has time to drift very far.

Hope this helps,

Danish

Guru

The current used by and ADC pin is very small and isn't constant, which makes reading the resistance in this way not a realistic option.

If you feel a post has answered your question, please click "Accept as Solution".
Associate II

Thanks for your reply @TDK​ what is the best way to measure the resistance , I try with the help of voltage division rule(by using known resistor value find out the unknown resistor value using adc ) but the values are not accurate, if you have any idea can you please suggest me which method is best to measure the resistance value, once again thanks for your reply

Well, you can't measure resistance directly. You can only measure voltage and solve for resistance. The best way will depend on the value you're trying to measure. Using a voltage divider along with a known resistor value can work, but be aware this won't work for very high resistance values, but should work fine up to tens of kOhms.
If you feel a post has answered your question, please click "Accept as Solution".