RESISTANCE METER

An area to discuss 8-bit PIC specific problems and examples

Moderator: Benj

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: RESISTANCE METER

Post 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

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RESISTANCE METER

Post 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.
Martin

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: RESISTANCE METER

Post 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

medelec35
Matrix Staff
Posts: 9520
Joined: Sat May 05, 2007 2:27 pm
Location: Northamptonshire, UK
Has thanked: 2585 times
Been thanked: 3815 times
Contact:

Re: RESISTANCE METER

Post 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,
Martin

User avatar
Steve001
Valued Contributor
Valued Contributor
Posts: 1189
Joined: Wed Dec 31, 2008 3:37 pm
Has thanked: 460 times
Been thanked: 523 times
Contact:

Re: RESISTANCE METER

Post 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
Success always occurs in private and failure in full view.

siliconchip
Posts: 392
Joined: Wed Jan 05, 2011 11:24 am
Has thanked: 101 times
Been thanked: 24 times
Contact:

Re: RESISTANCE METER

Post 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

Post Reply