Author Topic: Large cheap digital weight scale options and ideas  (Read 9699 times)

0 Members and 1 Guest are viewing this topic.

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Re: Large cheap digital weight scale options and ideas
« Reply #25 on: January 29, 2021, 05:26:09 am »
This is the wiring diagram:



Other variations:




Another variation (same topology just drawn differently) is here:




Here is the Instructables page:

https://www.instructables.com/Arduino-Bathroom-Scale-With-50-Kg-Load-Cells-and-H/


Essentially what is happening is RED is the common connection between the 2 strain sensors in each load cell. The white-red resistance is for "positive" strain, and black-red resistance is "negative strain". I'm not exactly sure what they mean by that, but in either case one should show higher resistance while the other should indicate lower resistance when the load cell is loaded. The way the wiring diagram is positioned is basically with 4 load cells (each containing 2 strain sensors on opposite sides) so that you are "coupling" up 2 sensors in each side of a Wheatstone bridge, essentially creating the following:



You can see how based on the wiring diagram, and how the "whites" of adjacent load cells are joined and "blacks" of the adjacent load cells are joined, we are just summing up the resistors of adjacent load cells. So if one load cell had a resistance of 1k ohm along each strain sensor, we now should measure 2k ohm across each segment of our bridge. As long as all "white" wires are to strain sensors which are all on the same side of the load cell (e.g. "positive strain"). and all the "black" wires are hooked up to the strain sensors which are on the same and opposite side of each load cell (e.g. "negative strain") then we should see it work properly.

Ultimately we are making a voltage/resistive divider along each side of the bridge. When load is applied, let's say the "black" wired resistors increase in ohm value, and the "white" wired ones decrease value. So we will shift the A+ voltage down and A- voltage up, making a greater difference to measure. Let's say for example E+/E- is 5V difference, and resistors are all 1 k ohm coupled (500 ohm each). Normally A+/A- would be 0V if all resistors matched exactly, because each side (left/right) of the Wheatstone bridge would divide the voltage in half to 2.5V at the A+ and 2.5V at A- points, making the difference 0V. Now if the resistors joined by the "black" wires increased to 1100 ohm, and the "white" resistors decreased to 900 ohm, we end up with A+ becoming Vout=Vin*(R2/R1+R2)=5*900/2000=2.25V, and A- becoming 5*1100/2000=2.75V, so A+/A- difference is 0.5V. In reality the difference is much smaller which is why we need to use the Hx711.

So at that point the Hx711 is wired up to the Arduino 5V and GND for power (GND/VCC pins), and there are a couple of pins that will handle DATA and CLOCK signals from the Hx711 (since it is a precision ADC)... the DT/SCK. You basically set up Arduino code to read serial data in (just have to set appropriate baud rate in the code) and there is a library for the Hx711 that helps.
« Last Edit: January 29, 2021, 06:00:39 am by edy »
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13132
Re: Large cheap digital weight scale options and ideas
« Reply #26 on: January 30, 2021, 02:10:11 pm »
Thank you for the clarified diagram showing how the somewhat convoluted four load sensor wiring actually implements a Wheatstone bridge.

However I am still concerned that without separating the load sensors into diagonal pairs, it will be impossible to determine if they are sharing the load evenly, with a consequent risk of overload, and as three points are sufficient to define a plane, you may even get a breakpoint in the sensor output vs load characteristic as load comes onto the fourth sensor.

Looking at the HX711 datasheet, its apparent that it supports two load cell bridges by multiplexing between them.   I therefore strongly recommend that rather than combining all four load sensors into a single bridge. you connect the load sensors simply as two bridges: end wires to the + & - excitation and center wires to A+, A- B+, & B- respectively, taking care to pair A and B diagonally, and apply opposite excitation to sensors feeding + and - inputs.   You can then include a test mode that in addition to displaying the total weight, displays the two diagonals and the difference between them, for ease of adjustment to equalize them.
 
The following users thanked this post: edy

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Re: Large cheap digital weight scale options and ideas
« Reply #27 on: February 01, 2021, 04:29:41 am »
Thanks for the advice. I found this Github thread that goes into trying to read both A and B inputs at the Arduino:

https://github.com/bogde/HX711/issues/12

This is the wiring diagram I think you were mentioning, making 2 Wheatstone bridges out of the 4 sensors by using E+/E- to excite both, but then breaking up the sense wires to A+/A- and B+/B- for each bridge (rather than combining resistors sort of in "serial" like the previous wiring showed):



Reading that thread, there are some sample codes (see copy below) but it also seems they were having trouble getting channel B to work. Nobody seems to think channel B is defective yet looking at the thread it seems there was trouble using channel B (even if they didn't use A at all and just tried B only). It seems the idea is to set a variable to either 64 or 128 (for channel A) or 32 (for channel B) using this:

scale.set_gain(128); // to select channel A of the HX711 ADC
scale.set_gain(32); // to select channel B of the HX711 ADC

I'm not sure exactly how this is supposed to work. Why would it be called "gain" to get values from A or B read separately? Are they somehow combined in the data stream and this is some kind of bit-shift operation to get the appropriate bits for the channel read? Like most-significant and least-significant digits? Or do these channels operate at different voltage ranges and so need different gains to match up? (The answer is YES to all... see below). Anyways, there are lots of resources online I will have to pour through to figure out how to use channel B properly... some mention clock signals, e.g. 25~27 (see datasheet below and table) which is used to shift Data Out, using 26 to get channel B (25 and 27 for Channel A at different gains). Seems they CANNOT be read simultaneously as they are multiplexed and you would have to switch back and forth to read A/B sequentially. What I gather so far is that the reason everyone is "cheating" and using only channel A is probably because the Hx711 library is programmed to use A which is easiest and meant to be sensitive enough to be hooked up directly to the load sensors (has maximum gain) and combining up the sensors in that strange way I showed previously to make one giant Wheatstone bridge (even if it is not the best practice) seems to be "good enough" for most applications.

Here's the datasheet:

https://cdn.sparkfun.com/datasheets/Sensors/ForceFlex/hx711_english.pdf

It says: 

Analog Inputs

Channel A differential input is designed to interface directly with a bridge sensor’s differential output. It can be programmed with a gain of 128 or 64. The large gains are needed to accommodate the small output signal from the sensor. When 5V supply is used at the AVDD pin, these gains correspond to a full-scale differential input voltage of ±20mV or ±40mV respectively.

Channel B differential input has a fixed gain of 32. The full-scale input voltage range is ±80mV, when 5V supply is used at the AVDD pin.


The datasheet also discussed clock signals and selecting A/B data. Nevertheless, if it was easy and worked people would be just applying the code below with no problem. But apparently many are still having problems getting reliable data so something else must be going on.

Here's some sample code:

Code: [Select]
//Start code
#include "HX711.h"
// HX711.DOUT - pin #A1
// HX711.PD_SCK - pin #A0

HX711 scale(A1, A0); // parameter "gain" is ommited; the default value 128 is used by the library

void setup()
{
Serial.begin(9600);
}

void loop()
{
scale.set_gain(128);
Serial.print("Loadcell A > ");
Serial.print((scale.read())); // print a raw reading from the ADC channel B

scale.set_gain(32);
Serial.print(" Loadcell B > ");
Serial.println((scale.read())); // print a raw reading from the ADC channel A
}

« Last Edit: February 01, 2021, 04:44:55 am by edy »
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13132
Re: Large cheap digital weight scale options and ideas
« Reply #28 on: February 01, 2021, 05:47:24 am »
The two channel wiring diagram looks reasonable.

However the HX711 internal MUX implementation is fugly.  I hadn't delved into it far enough to realize it has separate gains for A  and B and that the B channel is low gain only.  The gain and mux selection is determined by the number of PD_SCLK pulses it receives per sample. It needs 25 to shift out the sample then 0 to 2 more to select the two channel A gains or channel B (datasheet fig. 2), hence your scale.set_gain() confusion.  scale.set_gain() must set an internal count in the library that gets used for the clock count for following calls to scale.read(), so it doesn't effect the result till the *SECOND* scale.read() after the changed scale.set_gain().

Probably the best option short of using a second HX711 breakout board, would be to use an external mux and only use channel A of the HX711, which allows gains of x128 and x64.  A 74HC4053, controlled by an I/O pin, with its third channel grounded should do nicely.  At a pinch you could use a 74HC4016 wired as a DPDT switch, which would need an inverted signal for two of its enable inputs.  Either do this in hardware or use two I/Os driven to opposite states.

 
« Last Edit: February 01, 2021, 06:02:03 am by Ian.M »
 
The following users thanked this post: edy

Offline edyTopic starter

  • Super Contributor
  • ***
  • Posts: 2387
  • Country: ca
    • DevHackMod Channel
Re: Large cheap digital weight scale options and ideas
« Reply #29 on: February 01, 2021, 04:29:51 pm »
Thanks for the suggestion. So basically I would place the demuxer between my load cells and the Hx711 and alternate reading between the 2 Wheatstone bridge A+/A- voltages being produced. I would need the Arduino to select input 1 on the demuxer, then read the output of the Hx711, then select input 2 on the demuxer, read the output of Hx711, and so forth, many times per second. Essentially the Hx711 would be alternating it's A+/A- between the 2 Wheatstone bridges rather than using the B+/B- inputs at all... and my Arduino code would have to do the work of flipping between them (by telling the demuxer which input to select before every read of the Hx711). Then in software I will need to average out all the readings. I'll try to come up with a wiring diagram and post it.

I even found such a beast at my local electronics shop:

https://secure.sayal.com/STORE2/View_SHOP.php?SKU=147532
« Last Edit: February 01, 2021, 04:31:51 pm by edy »
YouTube: www.devhackmod.com LBRY: https://lbry.tv/@winegaming:b Bandcamp Music Link
"Ye cannae change the laws of physics, captain" - Scotty
 

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 13132
Re: Large cheap digital weight scale options and ideas
« Reply #30 on: February 01, 2021, 05:17:09 pm »
Yes.   Deliberately put your levelling out of adjustment so there's considerably more weight on one diagonal pair of sensor than the other, put a test weight on the platform and read ONE diagonal repeatedly to get a good average.   Do the same for the other one. 

Then you can start trying to get it to alternate using the external MUX.
 Compare the results with your averages for each diagonal *WITHOUT* moving the weight or the platform.  You *MAY* find that it doesn't read the correct value immediately after switching so you need to discard one sample after switching the MUX, (i.e. take two samples discarding the first then switch), or it may be fine switching after every sample.

Once you've got reliable results you can readjust the levelling to get the diagonals as equal as possible, then  start thinking about how to combine the diagonals, do some type of a moving average, and convert the raw numbers to weight. 

As you are MUXing it, you'll probably find it beneficial to cut the rate jumper for a higher max readout rate at the expense of higher noise.

Calibration hint:  A straight sided (but not necessarily parallel sided)  round container is easy to calculate the volume of for any fill height if you know its top and bottom interior diameters and the interior depth (formula: volume of a conical frustrum).  The density of chilled pure water is 1g/ml, dropping with temperature, but under 40 deg C the error wil be less than 1%.   Obviously you have to add a bit for dissolved solids, but the EPA limit for drinking water is 500 PPM, equivalent to 0.5% density increase.   
 

Offline deadsy

  • Newbie
  • Posts: 1
  • Country: us
Re: Large cheap digital weight scale options and ideas
« Reply #31 on: June 20, 2021, 11:53:07 pm »
Late to this thread, but whatever...

I've been curious as to how 4 load cells, each with +v/-ve strain gauges in them could produce an overall differential output that is proportional to the sum of the 4 individual loads on them.
Answer - they don't, but it is pretty close.

Here's some analysis:

#!/usr/bin/python3

"""
Analysis for a 4 load cells (2 strain gauges each) wired to give a single differential output.
https://www.eevblog.com/forum/reviews/large-cheap-weight-digital-scale-options/
"""

def deltav(V, R, r0, r1, r2, r3):
  """return the differential output voltage for the 4x load cell"""
  i0 = V / (4.0 * R + r0 - r3)
  i1 = V / (4.0 * R - r0 + r3)
  va = i0 * (2.0 * R - r1 - r3)
  vb = i1 * (2.0 * R + r2 + r3)
  return va - vb

def main():

  Ve = 5.0
  Rn = 1000.0

  x = deltav(Ve, Rn, 1, 1, 1, 1)
  print(x)
  x = deltav(Ve, Rn, 0, 0, 0, 4)
  print(x)
  x = deltav(Ve, Rn, 0, 0, 2, 2)
  print(x)
  x = deltav(Ve, Rn, 0, 2, 2, 0)
  print(x)
  x = deltav(Ve, Rn, 0, 1, 3, 0)
  print(x)
  x = deltav(Ve, Rn, 0, 0, 3, 1)
  print(x)
  x = deltav(Ve, Rn, 1, 0, 0, 3)
  print(x)

main()
jasonh@eccles:~/work/bmon/analysis$ ./loadcell.py
-0.004999999999999893
-0.005000005000005192
-0.0049987512496882935
-0.004999999999999893
-0.004999999999999893
-0.004999062812441224
-0.005000001250000441


So yes - there will be some differences depending on how the load is distributed to the load cells, but it's probably not enough to care about.




 

Offline David Hess

  • Super Contributor
  • ***
  • Posts: 17206
  • Country: us
  • DavidH
Re: Large cheap digital weight scale options and ideas
« Reply #32 on: June 21, 2021, 01:57:45 am »
Scales with multiple load cells use summing networks to combine the outputs in such a way that the load is independent of position; it is not as simple as paralleling the outputs.  Single load cells may also be calibrated to do the same thing.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf