# Difference between revisions of "Load Cell Calibration"

(Created page with "This is how to scale ("calibrate") the load cells into usable units. This same method can be used for all sensors. ==Theory== In general, we assume the output is linear and...") |
|||

Line 9: | Line 9: | ||

Two known points are required and two equations are solved simultaneously Usually one of the known points is 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 known points are required and two equations are solved simultaneously Usually one of the known points is 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== | ||

+ | |||

+ | ===Method 1 using algebra=== | ||

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

Line 15: | Line 18: | ||

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: | 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== | ||

+ | #With nothing on the scale, read the output of the HX711 ADC by running hx711. In this case, the average was -345252. | ||

+ | #Weigh yourself (235.2 lbs). | ||

+ | #Then run sudo hx711 again while standing on the scale. The average was 1160807. | ||

+ | #Now solve the two equations simultaneously: | ||

+ | |||

+ | 0 = m * -345252 + b [1] | ||

+ | 235.2 = m * 1160807 + b [2] | ||

+ | |||

+ | Rearrange equation 1 by subtracting b from both sides: | ||

+ | -b = m * -345252 | ||

+ | |||

+ | Rearrange equation 1 by dividing both sides by -345252: | ||

+ | -b / -345252 = m or | ||

+ | m= b/345252 | ||

+ | |||

+ | Now substitute m in equation 2 and solve for b: | ||

+ | |||

+ | 234.2 = (b/345252) + b | ||

+ | |||

+ | 234.2 = (1/345252 + 1) * b | ||

+ | |||

+ | 234.2 / (1/235252 + 1) = b | ||

+ | |||

+ | 234.2 / (2.89643506772e-06 +1) = b | ||

+ | |||

+ | 234.2 / 1.00000289644 = b | ||

+ | |||

+ | 234.199321657 = b | ||

+ | |||

+ | Now solve for m by plugging b into equation 1 or 2. It doesn't matter, but the math is easier if you use equation 2: | ||

+ | |||

+ | |||

+ | 0 = m * -345252 + 234.199321657 | ||

+ | |||

+ | -234.199321657 = m * -345252 | ||

+ | |||

+ | |||

+ | -234.199321657/-345252 = m | ||

+ | |||

+ | 0.000678343128083 = m | ||

+ | |||

+ | |||

+ | ===Method 2 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 counts: | ||

+ | |||

+ | |||

+ | 1160807 - -345252 = 1,506,059 | ||

+ | |||

+ | |||

## Revision as of 08:37, 11 April 2016

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

## Contents

## Theory

In general, 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 known points are required and two equations are solved simultaneously Usually one of the known points is 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

### Method 1 using algebra

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

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

0 = m * -345252 + b [1] 235.2 = m * 1160807 + b [2]

Rearrange equation 1 by subtracting b from both sides:

-b = m * -345252

Rearrange equation 1 by dividing both sides by -345252:

-b / -345252 = m or m= b/345252

Now substitute m in equation 2 and solve for b:

234.2 = (b/345252) + b

234.2 = (1/345252 + 1) * b

234.2 / (1/235252 + 1) = b

234.2 / (2.89643506772e-06 +1) = b

234.2 / 1.00000289644 = b

234.199321657 = b

Now solve for m by plugging b into equation 1 or 2. It doesn't matter, but the math is easier if you use equation 2:

0 = m * -345252 + 234.199321657

-234.199321657 = m * -345252

-234.199321657/-345252 = m

0.000678343128083 = m

### Method 2 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 counts:

1160807 - -345252 = 1,506,059

Hivetool version 0.7.3 and greater

Hivetool version 0.7.2 and less