Difference between revisions of "Load Cell Calibration"

From HiveTool
Jump to: navigation, search
Line 1: Line 1:
 
This is how to scale ("calibrate") the load cells into usable units.  This same method can be used for other sensors.  
 
This is how to scale ("calibrate") the load cells into usable units.  This same method can be used for other sensors.  
  
'''Note: this is the method used in version HiveTool version 0.7.3 and greater.  A different method was used in HiveTool version 0.7.2 and earlier.'''
+
'''Note: this is the method used in HiveTool version 0.7.3 and greater.  A different method was used in HiveTool version 0.7.2 and earlier.'''
  
 
==Theory==
 
==Theory==
Line 16: Line 16:
 
Two points determine a line, so two known points are required.  One of the known points may be zero, and the other is a known weight.  Zero is used as it is convenient and it simplifies the math.  The other point is arbitrary but ideally is near the other end, near full scale (200 KG or 440 lbs if four 50KG load cells are used. (I usually just use my weight, 150 lbs).
 
Two points determine a line, so two known points are required.  One of the known points may be zero, and the other is a known weight.  Zero is used as it is convenient and it simplifies the math.  The other point is arbitrary but ideally is near the other end, near full scale (200 KG or 440 lbs if four 50KG load cells are used. (I usually just use my weight, 150 lbs).
  
==Proceedure==
+
==Procedure==
  
  

Revision as of 23:24, 11 April 2016

This is how to scale ("calibrate") the load cells into usable units. This same method can be used for other sensors.

Note: this is the method used in HiveTool version 0.7.3 and greater. A different method was used in HiveTool version 0.7.2 and earlier.

Theory

We assume the output is linear and use linear scaling based on the formula for a straight line,

Y=mX+b

Where:

Y is the desired output in engineering units (pounds, kilograms, stones, etc.)
m is the slope
X is the output from the Analog to Digital Converter (ADC) in counts
b is the intercept.

Two points determine a line, so two known points are required. One of the known points may be zero, and the other is a known weight. Zero is used as it is convenient and it simplifies the math. The other point is arbitrary but ideally is near the other end, near full scale (200 KG or 440 lbs if four 50KG load cells are used. (I usually just use my weight, 150 lbs).

Procedure

With nothing on the scale, read the output of the HX711 ADC by running hx711:

sudo hx711

It will read the HX711 chip 64 times, and display the output of the ADC in binary and decimal with one reading per line and the average of the 64 readings at the end:

0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 1 0 0 1 1 0 0 1 0 1 1 n:    1546646     -  
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 1 0 1 0 0 0 1 0 1 0 1 n:    1546794     -  
  . . .        . . .       . . .      . . .        . . .

0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 1 0 1 1 0 1 0 1 0 0 0 n:    1547088     -  
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 1 1 0 1 1 1 0 0 n:    1546168     -  
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 1 1 0 0 0 0 1 1 n:    1546118     -  
0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 1 1 1 0 0 1 0 1 1 1 0 0 0 1 1 1 1 n:    1546014     -  
1546640

The numbers may be negative, it doesn't matter. Now put a know weight on the scale and run hx711 again. The numbers should be significantly different (much bigger).

Now you have two know points and can solve Y= mX + b for m and b.

Example

  1. With nothing on the scale, read the output of the HX711 ADC by running hx711. In this case, the average was -345252.
  2. Weigh yourself (235.2 lbs).
  3. Then run sudo hx711 again while standing on the scale. The average was 1160807.


Method 1 using graphical methods

The slope (m) is defined as rise over run (rise/run or rise divided by run). Using the numbers from the above example, the rise is the difference in the engineering units (the vertical or Y axis).

235.2 - 0 = 235.2 

The run is the difference in the counts (horizontal or X axis:

    1160807 - -345252 = 1506059


Calculate the slope by dividing rise by run:

  m = 235.2/1506059
  m = 0.000156169180623

Calculate the intercept by solving for b

 Y = m * X + b
 0 = 0.000156169180623 * -345252 +b
 0 = -53.9177219485 + b
  
 53.9177219485 = b

Method 2 using algebra

  1. Solve the two equations simultaneously:
    0 = m * -345252 + b  [1]
235.2 = m * 1160807 + b  [2]

Rearrange equation 1 by adding m*345252 to both sides:

b = m*345252 

Substitute b into equation 2:

235.2 = m *1160807 + m*345252
235.2 = m * (1160807 + 345252)
235.2 = m * 1,506,059
235.2/1506059 = m
0.000156169180623 = m

Plug m into equation 1 and solve for b:

0 = mX + b
0 =  0.000156169180623 * -345252 + b
0 = -53.9177219485 + b
b = 53.9177219485


Method 3 Linear Regression

Hivetool version 0.7.2 and earlier