Author Topic: HX711-based milliohm meter  (Read 41585 times)

0 Members and 1 Guest are viewing this topic.

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #25 on: January 03, 2015, 02:02:03 pm »
I have to say that I cannot see a difference here, vs. the prior chart.

Do I understand this correctly that the temperature drift stays the same whether you heat only the ADC or only the bridge components?
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #26 on: January 03, 2015, 02:09:32 pm »
I don't think so.

When the chip was heated, Ch B went from 2.1735MM to 2.1715MM.

When the resistors were heated, Ch B went from 2.175MM to 2.157MM, a much wider variation.

Now, I cannot be sure that the temperature changes are the same but the iron was at the same setting and the heating time is roughly the same. So I think the temperature changes are reasonably comparable.

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

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #27 on: January 03, 2015, 02:59:10 pm »
You are correct. I was just looking at the A channel drift, but I didn't look at the B channel drift carefully enough which is 10x more when heating the "bridge" components compared to heating only the ADC.
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #28 on: January 03, 2015, 03:18:53 pm »
I found this excellent article by late Jim Williams "Minimizing thermocouples
maintains 20-bit DAC precision": http://m.eet.com/media/1142215/82758.pdf

The article is applicable for the 24-bit ADC as well.
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #29 on: January 14, 2015, 12:33:26 pm »
Just wanted to circle back on this.

Here is a test on a 1ohm (nominal) resistor, detected as 0.954645ohm by the meter

The readings fluctuates within about 65ppm of the mean, over a short period of time -> 50 readings x 0.5second / reading = 25 seconds.

Filtering can drastically reduce that ppm number, by the way, at the expense of slower responses.

I would conclude by saying that 1) the concept works; and 2) it doesn't work on this particular adc module -> too sensitive to temperature and the wrong way correlation between the A/B channels makes it impossible to hold calibration.
================================
https://dannyelectronics.wordpress.com/
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #30 on: February 28, 2015, 11:38:38 am »
I didn't want to hijack the original el cheapo micro-ammeter thread so I will post my comments here instead as they are related to the HX711.

dannyf, what do you think whether the HX711, the inexpensive 24-bit ADC you were evaluating few months ago would be usable with this micro-ammeter project?

I abandoned that project. The drifting, particularly the opposite tempco for the A/B channels, is a killer for my intended application (milliohm meter). I think it would have worked if the two channels had similar or at least the same sign of their tempcos. Without temperature compensation, you are better to just treat it as a 12bit adc.

The only solution I could think of was an oven and that wasn't doable in a hand-held device.

I was told its sister, hx712, has solved the tempco problem but I am not about to try it. I think a good 20 - 24bit adc (external ref + 1 channel, or two differential channels) would have worked better for the milliohm meter application.

Thanks, dannyf. I have two of those boards here and I thought to give a try. Plan is to use analog switches to route the A and B inputs to the known voltage reference and known zero voltage. The measured values would be then used for calibration and removing the offset. Here's been quite good discussion about different voltage references, so maybe I can find something usable. And need to find suitable analog switches. Of course, all this in the spirit of cheapo :)

Sounds fun. Would love to see how you make it work. Keep us posted, please.

The initial plan it to device an analog multiplexer controlled by the microcontroller so that the HX711's A and B inputs could be interchanged, optionally driven by a known reference voltage and known zero voltage. I could not find any information about the input impedance of the A and B inputs, so I must assume it to be less than 100kohms, so the resistance of the analog switches must be taken into account. Of course adding a low-offset quad op amp with high input impedance as a buffer for A and B inputs would be an option, which would make the resistance of the analog switches insignificant.

Here I will now assume that selecting an analog switch device having resistance close to 1 ohms would eliminate the need for any buffering op amps. However, I am not quite sure how cheaply one can find these low resistance analog switches.

The analog switches comes in variety configurations: from single switches to multiplexers. The multiplexers come typically in single and dual channel configurations. A dual-channel multiplexer has typically a good match between the switch resistance within a device.

Selecting two dual 4-to-1 analog MUXes would allow quite flexible calibration operations:

Code: [Select]
MUX# A+ A- B+ B-
0      A     B       Normal measurement
1      B     A       Channels swapped
2      0     0       Channels connected to zero reference
3     Ref   Ref      Channels connected to known reference voltage

Do we really need the reference voltage for the calibration, or would it suffice only to swap A and B channels for the measurement signal from time to time for calibration. If the channels should have different tempcos, one should be able to calculate the error between the channels as we switch the MUXes back and forth. Of course, using a good reference voltage for the calibration, we would get more accurate absolute measurement values.

In the ratiometric measurement application like this milliohm meter, the absolute accuracy is not a concern, but the relative accuracy between the channels A and B is important.

What do you think? Any suggestions?
 

Offline JohnnyBerg

  • Frequent Contributor
  • **
  • Posts: 474
  • Country: de
Re: HX711-based milliohm meter
« Reply #31 on: February 28, 2015, 11:53:41 am »
Is this the correct datasheet?

Unless I'm missing something, there is no spec for accuracy and linearity?

Thanks @dannyf for the measurements. As I see it, this is a pretty useless device for doing some serious ADC?

 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #32 on: February 28, 2015, 12:05:28 pm »
Is this the correct datasheet?

Unless I'm missing something, there is no spec for accuracy and linearity?

Here is a chinese datasheet with a bit more information: http://www.hobos.com.cn/upload/datasheet/HX711.pdf

My chinese is not that good that I could decipher what the datasheet really says, but luckily there are some numeric information available which is comprehensible.
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #33 on: February 28, 2015, 12:09:50 pm »
Kalvin: what's the application and what's your approach? Sounds like it is to use a multiplexer to calibrate the adc and then ...?

JohnnyBerg: yeah. The one Kalvin linked to is better however. I basically couldn't figure out a way to deal with the opposite tempcos.
================================
https://dannyelectronics.wordpress.com/
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #34 on: February 28, 2015, 01:10:26 pm »
Kalvin: what's the application and what's your approach? Sounds like it is to use a multiplexer to calibrate the adc and then ...?

I have no particular application in my mind. I bought two modules for fun, inspired by your experimenting. Only reason to pursuit this a bit further is the mental and practical challenge whether one can push the part into its limits (say, 17-bits of accuracy) as stated in the datasheet, compensate the tempco effects using cheap compensation method, and whether one can get 17-bit accuracy using dollar range parts (in room temperature ie. in limited temperature range). Of course the easiest and most sensible way would be to buy a good 24-bit ADC and high precision voltage reference. For example, the LTC2440 costs around $5 in 1K volumes, which is not much. It needs also a good few dollar reference to be accurate.
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #35 on: February 28, 2015, 01:26:41 pm »
That makes sense.

I haven't seen any spec for the ADC input resistance myself but I haven't found loading to be an issue here.

So an analog switch that multiplexs the input pins would work- 17 bits have a range of 128k so if you can get the switch resistance to 8 ohm or lower, 1meg ohm ADC resistance would work. Alternatively you can buffer.
================================
https://dannyelectronics.wordpress.com/
 

Offline JohnnyBerg

  • Frequent Contributor
  • **
  • Posts: 474
  • Country: de
Re: HX711-based milliohm meter
« Reply #36 on: February 28, 2015, 01:40:35 pm »
I bought two modules for fun, inspired by your experimenting.

Me too  ;D

Quote

For example, the LTC2440 costs around $5 in 1K volumes, which is not much. It needs also a good few dollar reference to be accurate.

The refernce will be much more .. for a real 24 bit ADC  :o

Remember 24 bit = 16,777,216 count
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #37 on: February 28, 2015, 02:24:03 pm »
I bought two modules for fun, inspired by your experimenting.

Me too  ;D

Quote

For example, the LTC2440 costs around $5 in 1K volumes, which is not much. It needs also a good few dollar reference to be accurate.

The refernce will be much more .. for a real 24 bit ADC  :o

Remember 24 bit = 16,777,216 count

The LTC2440 datasheet doesn't directly state its accuracy, but the nonlinearities and full scale errors shown on pages 5 and 6 are in range of 1 - 2.5 ppm and the figure "INL vs Output Rate" on page 7 shows linearity to be 17 to 18 bits*. The offset error looks negligible and the RMS noise figures are close to 2uV. Although the device is 24-bit ADC, the actual accuracy may be in range of 18 - 20 bits. Averaging will reduce the noise**, but it would not reduce nonlinearity error.

Creating a circuit which will exhibit 120dB dynamic range and 1:1000000 accuracy requires very careful design, high quality components, and knowledge (that I do not have). Creating a design with the dynamic range of 90 - 100dB may be within my capabilities.

* Edit: The figure is for the conversion rates of 2000 conversions/seconds and faster giving reduced 17 - 18 bits linearity. The figure "integral Nonlinearity vs Conversion Rate"  on page 6 shows that using the slower conversion rates the nonlinearity stays quite close to 2 ppm giving the "0.0005% INL, No Missing Codes" stated in the datasheet.

** Edit: On page 14 and 25 there are tables showing the effect of conversion rate vs. the effective number of bits (ENOB) available, from 17 bits up to 24 bits.
« Last Edit: February 28, 2015, 03:48:13 pm by Kalvin »
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #38 on: October 21, 2015, 09:49:15 am »
I decided to take a look at this dannyf's project. When I started working with the board I found following:

- The AGND was not connected to the GND. Just added a jumper between AGND and GND make proper connection.
- I changed the 8k2 ohm resistor in the VFB node to 10khm so that the AVDD is less than 4V in order to have some headroom to my Arduino board's 4.5V VDD.
- I found out that the solderless breadboards are uselelss with this project, so the measurement signal wirings and connections are better to be soldered properly.
- I changed the output rate from "0" to "1" giving approx 8 measurements per second.

After that, I was able to achieve following using a reference resistor of 1.000 ohm and simple null-calibration:

- Using 4-wire Kelvin-type measurement
- Measurement time 8 hours at room temperature epprox. 21C
- Initial drift was 3 milliohms
- After initial drift, the variance was +/- 0.5 milliohms
- Measurement current is in range 5mA - 10mA.

The accuracy and resolution is quite close to a 12-bit ADC. I used the HX711's own internal reference and the power supply was derived directly from Arduino's voltage regulator without any specific filtering. I didn't test temperature sensitivity, but warming the chip with a finger did produce few milliohms drift (not too bad).

Br,
/Kalvin

Edit: Here is the plot data collected today for a period of 9 hours. The resistance is quite nicely within +/- 0.25 milliohms after initial transition. Taken the initial transition into account, the results are within +/- 0.5 milliohms.

« Last Edit: October 21, 2015, 07:42:11 pm by Kalvin »
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #39 on: October 28, 2015, 12:34:10 am »
I have done more work recently on this that you may find interesting: https://dannyelectronics.wordpress.com/2015/10/25/a-hx711-based-milliohm-meter/

Running the circuit at 2ma and utilizing a 10R reference resistor, the resistance readings are stable to the 4th digit (after the chip has reached thermal stability).

I am starting to appreciate this little bugger now.
================================
https://dannyelectronics.wordpress.com/
 

Offline Vgkid

  • Super Contributor
  • ***
  • Posts: 2710
  • Country: us
Re: HX711-based milliohm meter
« Reply #40 on: October 28, 2015, 02:58:30 am »
Thanks for the update.
If you own any North Hills Electronics gear, message me. L&N Fan
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #41 on: October 28, 2015, 08:29:36 am »
I have done more work recently on this that you may find interesting: https://dannyelectronics.wordpress.com/2015/10/25/a-hx711-based-milliohm-meter/

Running the circuit at 2ma and utilizing a 10R reference resistor, the resistance readings are stable to the 4th digit (after the chip has reached thermal stability).

I am starting to appreciate this little bugger now.

Thanks for your update. I read through you blog posting, and the results I have are in line with your measurements.

Here are my measurements from the last night at room temperature of 23C. I have removed the 1K series resistor and filter capacitors from the A and B inputs. The HX711 is used in "fast" mode, so there are approx. 8 readings/s. The "fast" results are filtered using a simple running average of length 128 samples.

The filtered data plot is shown below. The Y-axis range is 0.9995 ... 1.0005 ohms as the measured resistor is nominal 1.000 ohms. After the initial transition, the filtered results have variance of approx. +/- 0.05 milliohms (ie. +/- 0.00005 ohms), so the measurement resolution is within +/- 0.1 milliohms (ie. +/- 0.0001 ohms). Without averaging, the resolution is within +/- 1 milliohms (ie. +/- 0.001 ohms).

The resistors used in the current measurement arrangement are quite sensitive to temperature changes, as placing the finger on the 1/4W metal film reference resistor or the 1/4W metal film resistor to be measured will change the measurement result by approx. +5 milliohms.

Placing the finger on the HX711 has very little effect: the measurement reading changed less than 0.2 milliohms, so it seems that HX711 is not too sensitive to temperature changes in order to be used as a milliohm meter with the usable measurement resolution of +/- 1 milliohms and the update rate of 8 readings / s (see my previous post above).
« Last Edit: October 28, 2015, 08:31:28 am by Kalvin »
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #42 on: October 28, 2015, 11:08:26 am »
Kalvin: great work.

Quote
The "fast" results are filtered using a simple running average of length 128 samples.

That's a good way to filter out the noise. But on a small mcu, the space / time requirement can be excessive.

Another way to implement that is to utilize exponential smoothing:

Code: [Select]
  uOHM_s+=(uOHM - uOHM_s) * alpha;

where uOHM_s is the smoothed output (equivalent to your moving average), uOHM is the "instantaneous" measurement of the resistance, and "alpha" is the weight you give to the current measurement. The lower alpha is, the longer the "memory" of the algorithm is. using alpha of 1/128.0 for example would produce similar performance as your moving average (not quite the same but similar).

For example, the chart below shows the instantaneous measurements (uOHM, red trace), 16-sample smoothed measurements (uOHM_s), and 16-sample moving averaged (uOHM_avg).

Hope it helps.

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

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #43 on: October 28, 2015, 11:33:41 am »
Quote
The "fast" results are filtered using a simple running average of length 128 samples.
That's a good way to filter out the noise. But on a small mcu, the space / time requirement can be excessive.

Typically I would use the exponential weighing for the filtering, but for this particular measurement setup I decided to use true running average as it has well defined window of N samples (N=128 this time). In the final version I will use the exponential filtering, though.

I am running the test code on Arduino Nano (atmega328p) with the 2.2" QVGA TFT SPI for displaying the measurement data and using the serial port for actual data logging. The TFT update using hardware SPI is still so damn slow that it affects the measurement rate a bit, but the update rate is still sufficient so that the Arduino is usable as an evaluation platform. I had those displays in my drawer, so I picked one for this project. My final hardware will be running on a STM32F103, but I wanted to get up and running fast and chose Arduino for prototyping.

BTW, I tested two high power diodes 1N-something placed across the input terminals as overvoltage protection and they didn't affect the readings at all as the measurement voltage is iwell below diodes' threshold voltage. In the actual design I will use an isolated +5V/+5V DC/DC-converter and optoisolators to isolate the HX711 from the rest of the system so that the device can be powered safely from a USB-port and the measurement signals are truly floating.

Edit: Using the TFT gives some possibilities here. For example, there can be two reading on the display: One is the latest measurement value, updated 8 times in a second with the resolution of 1 milliohm. The other value shown is filtered/averaged value giving resolution of 0.1 milliohms. Of course, the display could also show some other measurement statistics like low/high resistance in milliohms etc. I have also a beeper onboard which is will change its pitch according to the measured resistance.
« Last Edit: October 28, 2015, 07:33:28 pm by Kalvin »
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #44 on: October 28, 2015, 09:26:30 pm »
Quote
n the final version I will use the exponential filtering, though.

If you want, I can share with you an approach that I have used to quickly calculate moving average (sum actually): it takes one subtraction, one addition, and one assignment to yield a moving sum. Plus one division or one shift if you wish to get an average. The algorithm is particularly useful if you desire a long window of data.
================================
https://dannyelectronics.wordpress.com/
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #45 on: October 29, 2015, 06:54:51 am »
Quote
n the final version I will use the exponential filtering, though.

If you want, I can share with you an approach that I have used to quickly calculate moving average (sum actually): it takes one subtraction, one addition, and one assignment to yield a moving sum. Plus one division or one shift if you wish to get an average. The algorithm is particularly useful if you desire a long window of data.

Dannyf, I am doing the exponential averaging as follows using one addition, one subtraction and two shifts (when N is power of 2):

int32_t sum = 0;
int32_t avg = 0;
...
sum += new_value - (sum / N);
avg = sum / N;

The worst-case value stored in the variable sum will be maximum absolute value of the "new_value" times N (ie. max(abs(new_value))*N).
« Last Edit: October 29, 2015, 08:52:47 am by Kalvin »
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #46 on: November 03, 2015, 12:07:28 pm »
Quote
I am doing the exponential averaging as follows...

Kalvin, that would be absolutely the right way of doing it in the digital domain: it avoids the typical pitfall that beginners usually make when porting floating point math algorithms to fixed point math. Well done.

For your interest, I implemented a milliohm meter with just the attiny85 + a few resistors but no hx711: https://dannyelectronics.wordpress.com/2015/08/02/mcu-based-milliohm-meter/

Obviously the resolution and precision is not in the same ball park as the one with hx711.

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

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #47 on: November 03, 2015, 02:15:02 pm »
Quote
I am doing the exponential averaging as follows...

Kalvin, that would be absolutely the right way of doing it in the digital domain: it avoids the typical pitfall that beginners usually make when porting floating point math algorithms to fixed point math. Well done.

For your interest, I implemented a milliohm meter with just the attiny85 + a few resistors but no hx711: https://dannyelectronics.wordpress.com/2015/08/02/mcu-based-milliohm-meter/

Obviously the resolution and precision is not in the same ball park as the one with hx711.

ciao.

Nice work as usual, dannyf.

One ipossible improvement came to my mind: You can make your design less sensitive to the power supply variation (pseudo-ratiometric) if you consider the resistor connected between the DUT- and the ground as a reference resistor. Choose the value for the reference resistor so that it is 20 times as large as the maximum DUT. Then, you first measure the voltage across the DUT using the differential mode with the gain of 20 and then configure the ADC to measure the voltage across the reference resistor (between the DUT- and the ground) in single-eded mode. Now you should be able to maximize the resolution and make the this pseudo-ratiometric measurement insensitive to the voltage.

Br,
Kalvin
 

Offline dannyfTopic starter

  • Super Contributor
  • ***
  • Posts: 8221
  • Country: 00
Re: HX711-based milliohm meter
« Reply #48 on: November 05, 2015, 02:32:06 pm »
Kalvin, thats a good approach to try. Maybe not on the attiny but definitely a larger chip, with more pins.

A dream chip to implement this on would be atmega32u (used on Leonardo and the mini). The PGA has a gain up to 200x. But not all minis have the adc0 adc1 pina routed out.

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

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: HX711-based milliohm meter
« Reply #49 on: November 05, 2015, 02:45:48 pm »
Kalvin, thats a good approach to try. Maybe not on the attiny but definitely a larger chip, with more pins.

You do no need more pins when you use the R2 as the reference resistor. So basically you can do something like this:

1. Configure the ADC to measure differential voltage across the DUT (just like you are doing now if I have understood it correctly).
2. Configure the ADC so that you can measure single-ended voltage across R2.

Now you should have everything needed for calculating the DUT and the measurement is not sensitive to voltage changes.
You just need to select R2 so that the voltage across R2 is optimized across the measurement range. As the ADC is quite
fast, you can do averaging to get good stable readings.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf