Page 2 of 2

Re: RESISTANCE METER

Posted: Thu Oct 11, 2018 12:59 pm
by siliconchip
hi martin
ive compiled your flowchart but i changed the pull up resistance to 1003 ohms as this is what was measured with a fluke and on hardware for a 270 ohm resistor measured again with a fluke at 266 ohms the display now shows 263.75 ohms so not far out and more importantly the display is stable, how could this be made more accurate,im guessing if i used a 510 ohm ohm pull up resistor i would gain a bit more accuracy as i only want to measure a max of 500R also can you explain the calculation to me please

cheers bob

Re: RESISTANCE METER

Posted: Thu Oct 11, 2018 10:45 pm
by medelec35
Hi Bob,
For that resistance 0.8% error is not bad for a 10bit ADC.
In theory as I stated in my previous post
medelec35 wrote:The nearer the pull-up resistor value is to test resistor then the more accurate the results would be.
So yes in theory with 510R you should indeed gain more accuracy

The formula was derived form the following:
Using Potential divider formula

Code: Select all

Vout = Rtest / (Rtest + Rpullup) * Vsupply 
& with microcontroller

Code: Select all

 ADCvalue = Vadc*1023/Vsupply
Replace

Code: Select all

Vadc
above with

Code: Select all

Rtest / (Rtest + Rpullup) * Vsupply
The result is

Code: Select all

ADCvalue = Rtest / (Rtest + Rpullup) * Vsupply * 1023 / Vsupply
The Vsupply simply cancels out leaving

Code: Select all

ADCvalue = Rtest / (Rtest + Rpullup)  * 1023
Therefore it does not matter what the supply voltage is.
Rearrange to make Rtest the subject:

Code: Select all

Rtest = Rpullup / (1023 / ADCvalue - 1)
Which is the same as

Code: Select all

 Rtest = Rpullup * ADCvalue / (1023 - ADCvalue)
So either one should work.

Re: RESISTANCE METER

Posted: Fri Oct 12, 2018 9:54 am
by siliconchip
hi martin
thanks for the taking the time for the explanation thats brilliant, its a pity my calculations are voltage sensitive ie as the battery drains then the accuracy is out the window plus display instability such as always changing value, hence my asking about a buck convertor to provide a steady supply with battery use,but i guess this is the learning process and without the help of yourself and others who have helped on this people like myself would be up against a brick wall,so a big thank you its much appreciated, and although your calculations are far better than mine i will still experiment with mine to see what i can get out of it as part of the learning curve, thank you :D :D

bob

Re: RESISTANCE METER

Posted: Fri Oct 12, 2018 10:15 am
by medelec35
Hi Bob,
You're welcome.
I have a suggestion for constant value changing.
Use With the pot use GetAverageInt instead of GetInt and set both fields to 255.
Good luck with your learning,

Re: RESISTANCE METER

Posted: Fri Oct 12, 2018 12:56 pm
by Steve001
Hi Bob,

Can I add a slightly different approach ..

have you tried a constant current generator ? - maybe set at 10ma and measure the voltage across the unknown device
Then using ohms law 500 ohms would give you 5 volts. This dose also depend on your lower level of resistance too 100 ohms would give you 1 volt

see Fig 1 - for example circuit

http://www.ti.com/lit/ds/symlink/xtr110.pdf

Steve

Re: RESISTANCE METER

Posted: Sat Oct 13, 2018 1:13 pm
by siliconchip
hi steve
thanks for the suggestion i think at this stage id rather stick with getting my head round what ive done so far, constant current generator means for me learning something new and at this point im getting the results im after but thank you

bob