Author Topic: A mcu-based milliohm meter  (Read 19306 times)

0 Members and 1 Guest are viewing this topic.

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
A mcu-based milliohm meter
« on: January 20, 2014, 07:25:55 pm »
In the thread where I was trying to build a minimalist esr meter based on a mcu, I thought that some AVR's adc modules are quite useful in their offering a gain module + differential inputs.

That got me to think about a way to build a minimalist milliohm meter using such modules.

Since I have a few teensy (usb1286, adc modules with differential inputs and 1x/10x/200x gain) so I thought I would start with them.

Goal:

1) milliohm meter, capable of measuring from 1m - 50ohm;
2) minimal external parts;
3) lcd or coil meter output.

================================
https://dannyelectronics.wordpress.com/
 
The following users thanked this post: sipo75

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #1 on: January 20, 2014, 07:30:31 pm »
Operating principles:

It is quite simple: two external resistors (R1 and R2 in the following schematics. They don't have to be equal), + dut (R3).

V1 and V2 are two out of phase excitation sources. R1/R2 limit the current going the dut. Vp/Vn are the voltage pin-up points.

In the chart Vp is shifted up by 0.2v to make the illustration a little easier on the eye.

Essentially, if we measure Vp - Vn, we would know the resistance, together with the current.



================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #2 on: January 20, 2014, 07:33:23 pm »
Schematic for my particular fixture.

ADC2/ADC3 are the differential adc inputs. The rest drives a lcd via HC164 - unique to my particular fixture and you can rearrange it.

The adc module runs at 10x gain for now (adc mode 0x0d).

================================
https://dannyelectronics.wordpress.com/
 

Offline hlavac

  • Frequent Contributor
  • **
  • Posts: 533
  • Country: cz
Re: A mcu-based milliohm meter
« Reply #3 on: January 20, 2014, 07:38:41 pm »
Any particular reason for using square waves instead of simple dc?
Good enough is the enemy of the best.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #4 on: January 20, 2014, 07:41:43 pm »
I took four readings:

1. Just the wire: 110mohm;
2. a 0.47R resistor + wire: 588mohm;
3. 0.47R + 15R resistors + wire: 15,560mohm;
4. 15R resistor + wire: 15,103mohm.

So the reading for the resistor(s) alone would be

2. 0.47R resistor: 478mohm;
3. 0.47R + 15R resistors: 15,450mohm
4. 15R resistor: 14,993

if 2) and 4) readings above are correct, I should have a theoretical reading of 14993+478=15471mohm for 0.47R + 15R resistors, vs. 14,450mohm of actual measurements.

Not bad, for a 3-part instrument (2 resistors + the mcu).

================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #5 on: January 20, 2014, 07:42:14 pm »
Here is a shot of the set-up: just two resistors + the 15R dummy dut.

================================
https://dannyelectronics.wordpress.com/
 

Offline Jon86

  • Frequent Contributor
  • **
  • Posts: 518
  • Country: gb
Re: A mcu-based milliohm meter
« Reply #6 on: January 20, 2014, 07:45:14 pm »
Any particular reason for using square waves instead of simple dc?

Yeah that's confusing me a bit, come on OP, what gives?
Death, taxes and diode losses.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #7 on: January 20, 2014, 07:47:20 pm »
Test range:

Two things control the range of the instrument:

1) adc module's gain: higher gain allows measurement of lower resistance.
2) measurement current: higher current allows measurement of lower resistance.

On the usb1286, we used Vref = 2560mv. The measurement current is about 6ma. So the lowest voltage drop that can be detected by the adc module is 2560/1024 * 1 / 10 = 0.1mv. Corresponding resistance is 0.1mv / 6ma=20mohm. The maximum would be 20ohm - at that point, you will need to compensate the drop in the measurement current - not yet implemented.

To expand the range of the meter, you could switch to 1x or 200x gain setting; Or use higher value current limiting resistors to read high-value resistance.

More possibilities.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #8 on: January 20, 2014, 07:51:43 pm »
Quote
Any particular reason for using square waves instead of simple dc?

Two reasons primarily:

1) The output resistance of those two excitation pins is unknown / unknowable. By alternate them and subtracting the readings, they are nulled.
2) With just the dc source, you would have to null the adc amplifier - not possible on some AVRs - it happens to be possible on this particular avr.

Also, the same approach could be used to measure inductance / capacitance / esr - difficult with a dc source.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #9 on: January 20, 2014, 07:57:21 pm »
Here is measuring the same R47 resistor at 200x gain.

I didn't rewrite the ohm conversion so it is still at 10x -> the reading should be divided by 20 (200x / 10x) for the true reading.

The value fluctuates from 11495 - 11502 mostly (indicating a value of ~575mohm), but mostly +/-3.
================================
https://dannyelectronics.wordpress.com/
 

Offline hlavac

  • Frequent Contributor
  • **
  • Posts: 533
  • Country: cz
Re: A mcu-based milliohm meter
« Reply #10 on: January 20, 2014, 08:00:51 pm »
Oh I thought you may want to use some sort of transformer to isolate the probe, lower the voltage and increase the sensing current...

If I were making a milliohmmeter, I would make a little voltage limited 0.5V 10mA constant current source, put the current thru the DUT and measure voltage developed across it...
It would have to be battery powered to isolate it though.
Good enough is the enemy of the best.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #11 on: January 20, 2014, 08:02:08 pm »
At 200x, you can get down to about 1mohm resolution.

To make the meter really useful, you have to null the wire resistance: either a kelvin clip or implement relative measurements (and save the readings into the eeprom).

================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #12 on: January 20, 2014, 08:04:56 pm »
If you implement this on an attiny (10x differential adc module), you can drive a coil meter with two ranges (10 ohm and 1ohm max).

================================
https://dannyelectronics.wordpress.com/
 

Offline Jon86

  • Frequent Contributor
  • **
  • Posts: 518
  • Country: gb
Re: A mcu-based milliohm meter
« Reply #13 on: January 20, 2014, 08:08:19 pm »
Oh I thought you may want to use some sort of transformer to isolate the probe, lower the voltage and increase the sensing current...

If I were making a milliohmmeter, I would make a little voltage limited 0.5V 10mA constant current source, put the current thru the DUT and measure voltage developed across it...
It would have to be battery powered to isolate it though.

That's what came to mind when I saw this topic, I think better accuracy could've been had with a constant current source.
Death, taxes and diode losses.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #14 on: January 20, 2014, 08:09:53 pm »
The particular chip I used (usb1286) is difficult to find. A good alternative is the mega32u4 chip used in many arduino. You can simply implement the same math in either arduino or C - potentially build a simple ship that contains both the lcd + R1/R2.

However, you need to watch out for the arduino pin-out: you have to have adc0/adc1 routed out or it is no good. The official Micro and Leonardo do that, I think.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #15 on: January 20, 2014, 08:24:48 pm »
Porting this approach to other mcus:

The basic concept is quite portable. However, you have to have either a high resolution adc (12-bit adc would be equivalent to 10-bit adc + 4x amplification; 16-bit adc would be equivalent to 10-bit adc + 64x amplification), or outboard amplification (a differential or instrumentation amplifier, like ina127/128, or fancier ones where the gain can be controlled by the mcu).

================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #16 on: January 20, 2014, 08:32:20 pm »
If you are to use outboard amplification + inboard adc, you have to drive the output from the outboard amplifier (through a resistor) into a divider network so the output is in the 0-Vcc range. You do lose the gain a little bit in the process.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #17 on: January 20, 2014, 11:54:33 pm »
Changed the code a little bit and incresed the oversampling to 4000x. The readings are stable to the last +/- 1-2 lsb.

Measuring a 0.47ohm resistor at 10x gain:

================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #18 on: January 20, 2014, 11:55:07 pm »
Same resistor at 200x gain.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #19 on: January 21, 2014, 12:09:47 am »
How would I know if it is accurate?

I have a .47ohm resistor, a 15ohm resistor.

The .47ohm resistor (+ unknown wire resistance) measured  out to be about 570mohm - the reading varies based on the touch points on the leads.



================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #20 on: January 21, 2014, 12:14:18 am »
If I were to parallel the 15ohm resistor to it, I should expect a total resistance of 0.456ohm, or a decrease of readings of 470-456 = 14mohm.

Here is the meter's reading of 15R + R47 = 556mohm, a decrease of 14mohm, vs. 14mohm as expected - the reduction actually varies from 14mohm to 15mohm.

Not bad.

However, the reading only declined 5mohm under 10x gain - as expected.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #21 on: January 21, 2014, 12:17:44 am »
Quote
Here is the meter's reading of 15R + R47 = 556mohm,

That should have read:

Quote
Here is the meter's reading of 15R // R47 = 556mohm,
================================
https://dannyelectronics.wordpress.com/
 

Offline Rufus

  • Super Contributor
  • ***
  • Posts: 2094
Re: A mcu-based milliohm meter
« Reply #22 on: January 21, 2014, 01:05:27 am »
1) The output resistance of those two excitation pins is unknown / unknowable. By alternate them and subtracting the readings, they are nulled.

It doesn't null them.

You should use VCC for the ADC reference to make the measurements ratiometric and so independent of supply voltage.

You could measure the voltage on the drive pins to compensate. Doing that along with the ratiometric measurement would make accuracy and stability dependant on only the 2 series resistors and ADC.
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #23 on: January 21, 2014, 01:17:11 am »
I have a mega32U4 coming in, in the form of an Arduino Leonardo - I can put an lcd + button on that so it becomes a "millieohm" shield, with lcd read-out, uart read-out and analog read-out.

Another option is to use a regular mcu + instrumentation amplifier to really drive the gain up to be able to measure sub-millieohm resistance. It would be interesting to see how that pans out.
================================
https://dannyelectronics.wordpress.com/
 

Offline dannyf

  • Super Contributor
  • ***
  • Posts: 8229
  • Country: 00
Re: A mcu-based milliohm meter
« Reply #24 on: January 21, 2014, 11:02:31 am »
Quote
constant current source, put the current thru the DUT and measure voltage developed across it...

That is very difficult to implement. The HP 34401a for example utilizes that approach and you can see the complexity around it.

Most milliohm meter implementations utilize instead a precision / known resistor in serial with the dut, in a singled-ended fashion. As such, the instrument takes two readings, one across the entire chain of the measurement resistor (known value) and dut, and another over just the dut. You have to deal with drift and offsets in that case.

The beauty of a differential amp + adc is that both drift and offset are taken care of inherently in the algorithm.

Quote
There's such a project in paper published in the "Review of Scientific Instruments" Journal :

The basic approaches are identical. Some minor implementation differences. He went down to uohm range - that's impressive, vs. about 2mohm for mine. He could have biased the -V pin of the ina to make the output in the right range, vs. the use of a divider network.

I don't fully understand why he thinks this is a lock-in amplifier (digitally implemented).


A killer mcu for this application would be C8051F350, with its 24-bit adc + onboard pga.
================================
https://dannyelectronics.wordpress.com/
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf