## Best way "resistor meter" with adc?

10 posts / 0 new
Author
Message

is this the best/fastest /most accurate way ?

to find an an uknown resistor value with avr?

single range i.e 0 to 50kohm needed

atc i am claclulating voltage drop oner a known resistor and do all the math, but it seems too much calculation's takes place.

and not very accurate at all, when resistors increased in value

There are a number of methods - 'best' is subjective. The 'best' method might be too expensive to implement. Also the fastest method might be the least accurate. So rather than aim for the 'best', state your requirements and work from there.
What resolution do you need? 1 ohm? 0.1 ohm?
What precision do you need? 1%? 0.1%?
How fast?
What temperature range?
If you look at the hp/agilent/whatever they're called now 6 1/2 digit multimeter specs. Also note they use a kelvin measurement technique for low ohms. This will show you what can be achieved at a moderate price (\$1500 usd)
Usual techniques are:
Constant current source and measure the voltage. You would switch the current source for a number of ranges.
Wheatstone bridge
Rc oscillator or time constant. Where the R is the unit you want to measure.

How bout a voltage divider with a 0.1% or 0.01% R and the unknown R and a 14 or 16 bit a/d? Read the top volts, the middle volts, calc I thru the known R, unknown R is middle V over I.

<

a/d ch1          a/d ch2

o----/\/\/\/\---o----/\/\/\/\-----o

vcc   1K .1%           Rx           gnd

>

Imagecraft compiler user

Last Edited: Wed. Jun 3, 2015 - 04:12 AM

eah sorry for not good explanation

fast i mean by term of software calculation (i.e. fewer commands)

not fast at hardware lever (a few tens per second is good)

room temperature

precision needed is hundred of ohms per 50000, that about 0.2%

and idea is to use internal adc (fewer components)

Last Edited: Tue. Jun 2, 2015 - 05:43 AM

fast i mean by term of software calculation (i.e. fewer commands)

???  So if the calculations finish in a reasonable amount of time, are you rewarded if your program is one or two or three lines shorter?

If you use one floating point calculation in one "command" that takes 1000 words of flash and 1000 microseconds to calculate, is that then better than a few simple lines manipulating the 10-bit ADC result in integer, say 500 words of flash and 500 microseconds?

precision needed is hundred of ohms per 50000, that about 0.2%

Now go back and read and think about all the responses about "changing range".  For that resolution, you cannot go much higher than that 50K with a single range.  And if only using a single range, then the resolution will not be sufficient at lower ohms.

There are many very nice projects around the Web for very useful LC meters with AVRs -- I suggest you find those and study them.

Then, you can invert the logic and instead of using a known R and unknown C, you can use a known C and unknown R.

Ranging is done by using a different "known" component value.

C values can vary greatly from nominal.  That can be overcome by using a known reference R to run a calibration step (perhaps automatically each reading) to determine the actual C value, and then use that value during the test run.

http://lmgtfy.com/?q=atmel+avr+l... You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

For a "simple" Ohmmeter one might try something like the set up below.  <UNTESTED>

This is rather crude, but doesn't require a constant current source, or an output op-amp buffer.

The Resistor under test is connected to however many ranges you need, based upon your accuracy requirements.

A small NFet, such as a 2N7000 is used to individually connect the Resistor under test to another resistor, forming a resistor divider.

The ADC measures the resistor divider voltage.

The range is determined by R2 through R5.

Make a spread sheet, or so some simple calculations, of the output voltage for several known Resistor under Test values, and R2 values.

e.g. R2 - 100K, 50K, 10K, 5K, 2K, 1K, etc....

You turn on or off each "range" by controlling the gates to the NFets, High = On, Low = Off.

The output capacitor is required to smooth (filter) the input signal, and to meet the ADC input impedance requirements, (i.e. charge the sample and hold capacitor inside the uC).

Once you switch ranges, you have to wait for the cap to settle at the new voltage, but its exact value doesn't matter, (e.g. 0.1 uF would be fine).

Averaging multiple measurements would be a good idea.

You need a very clean power supply, (Vcc), for this to work well.

R6-R9 hold the various NFets Off during startup of the uC, they really aren't needed for this application, IF you make sure the driver pins are LOW when the range (channel) isn't being used.

JC We are making an ohmmeter, right?

Google results for "atmel avr ohmmeter" include prior discussions:

https://www.avrfreaks.net/forum/o...

https://www.avrfreaks.net/forum/m...

... but no help for the OP in those.

An Arduino project that appears pertinent:

http://www.engineersgarage.com/c...

An X51 project: https://mpho112.wordpress.com/20...

AN512 from Microchip http://www.t-es-t.hu/download/mi... uses the RC method, and discharge time.  I recommended that earlier, as LC meters are well documented around the Web.  In fact, it sounds exactly like what I was alluding to:

...

• Very low cost

• Few external components required

...

This application uses a capacitive charging circuit

(Figure 1) to convert resistance to time, which can be

easily measured using a microcontroller. First, a

reference voltage (usually V

DD

) is applied to a

calibration resistor, Rc. The capacitor C is charged up

until the threshold on the chip input trips. This

generates a software calibration value that is used to

calibrate out most circuit errors, including inaccuracies

in the capacitor, changes in the input threshold voltage

and temperature variations. After C is discharged, the

reference voltage is applied to the resistance to be

measured (or thermistor). The time to trip the threshold

is then measured and compared to the calibration value

to determine the actual resistance (Figure 2

Worth a peek.  Have you hunted out the LC meter projects yet?

A Google search for "arduino ohmmeter" has very pertinent hits on the first page.  People have been there and done that...

http://www.electronics-lab.com/b... "with autoranging"

http://www.instructables.com/id/...

https://www.youtube.com/watch?v=... uses only a reference resistor, and voltage drop(s)

http://www.circuitstoday.com/ohm...

Arduino Ohm Meter? - Arduino Forum

forum.arduino.cc/index.php?topic=21614.0

May 12, 2009 - I was wondering whether it is possible to use an Arduino as an ohm meter? I have seen a lot of documentation on Arduino voltmeters but ...

Simple Arduino ohm meter & upload reading on the fly to hp via ...

Apr 13, 2015

How to make an Arduino Ohmmeter - Arduino Forum

Feb 23, 2015

Using an Arduino as an autoranging ohmmeter - Arduino Forum

Jul 4, 2013

Topic: Ideas for a precision ohmmeter - Arduino Forum

Feb 6, 2012

More results from forum.arduino.cc

http://www.circuitbasics.com/ard...

...

Now, if I can do these searches in a few minutes, I'd think that you could as well.  Study the projects, and >>you<< decide which is "best".

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

thanx all

DocJC, thats a clever idea ,that i have come up with, wich will give me better precision !

theusch, ican "google" yes saw some of these, but it';s nto my question actually

i just have the feeling that i do too many calculations, i.e

V = 1024 - W
V = 48 * W
I = 48 * W
I = I / 2000

R = I * V

i just have the feeling that i do too many calculations, i.e...

How can we intelligently answer, if we do not know the approach used?

V = 1024 - W
V = 48 * W
I = 48 * W
I = I / 2000

R = I * V

Obviously that is "too many calculations", as both V and I are calculated twice in a row so the first is meaningless.

Did you ever take an algebra class?  If you actually tell us what the formula is supposed to be, then surely W isn't needed, and as W is a part of both terms it can be factored out.

Tell your approach, and show some real code.  And tell why (within reason) size matters so much. (Lines of source code apparently?)

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

Just to clarify my answer above, there is nothing at all wrong with timing an RC discharge to calculate the resistor value.

I sketched out the above example because:

Precision capacitors are not needed

No need to use a Timer/Counter for precise timing, which can also be a significant learning cure

Both techniques, however, generally require the use of the ADC.

If one builds in a calibration circuit, then the Analog Comparator could also be used, instead of the ADC.

There are lots of approaches, as referenced above!

Additionally, what is the resistor value being used for, and is it changing?

If one is displaying the resistor value on an LCD for a human to read, the human factors far outweigh the difference in uSec's that the various calculation methods require.

JC