Electronics > Projects, Designs, and Technical Stuff

HX711-based milliohm meter

<< < (10/13) > >>

Kalvin:

--- Quote from: dannyf on October 28, 2015, 09:26:30 pm ---
--- Quote ---n the final version I will use the exponential filtering, though.
--- End quote ---

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.

--- End quote ---

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).

dannyf:

--- Quote ---I am doing the exponential averaging as follows...
--- End quote ---

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.

Kalvin:

--- Quote from: dannyf on November 03, 2015, 12:07:28 pm ---
--- Quote ---I am doing the exponential averaging as follows...
--- End quote ---

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.

--- End quote ---

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

dannyf:
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.

Kalvin:

--- Quote from: dannyf 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.

--- End quote ---

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.

Navigation

[0] Message Index

[#] Next page

[*] Previous page

There was an error while thanking
Thanking...
Go to full version
Powered by SMFPacks Advanced Attachments Uploader Mod