The first step is testing the basic connections of the HX711 to power supply, the load cell and the microcontroller.
The HX711 serial communications protocol results in the data line (DT pin on the HX711 breakout board), which is normally in the "high" state, being pulled low by the HX711. This provides a simple test if the HX711 is connected and responding correctly (this is also the signal from the HX711 that data is ready for retrieval). The HX711_read() routine in the CCS C code library tests for this condition.
Once the HX711 indicates data ready for retrieval, pulsing the clock line shifts out the data (24 data bits, MSB first). The data is provided as a 24 bit number in 2's complement format. Using a signed 32-bit integer in the CCS C code to store this retrieved data means no transformation is required, except for extending the 24bits to 32bits taking into account the 2's complement MSB.
The example CCS C code enables control of the HX711 to retrieve counts corresponding to the voltage generated by the load cell when a weight is applied (see Downloads Section). When no load is being applied to the load cell, the counts retrieved from the HX711 correspond to the "offset" that must be taken into account when calculating weight. This offset is the weight of the physical "pan" upon which loads are placed onto the load cell and any inherent in-balance within the Wheatstone Bridge arrangement of the strain gauges within the load cell.
The example code is hard wired to take ten (10) sequential readings of which the highest and lowest are rejected, and the remaining are averaged and reported as the "reading". This is a simple "noise" reduction method. Similarily, the calibration weight is hard wired to 100gm and the reported weight in grams. These values are easily changed in the code by altering #define's.
In addition to reporting calculated weight in grams, the example code enables reporting of ambient temperature to enable testing of the response of the load cells not only to applied weight but temperature.
Load cells have a wide variety of engineering specifications that define performance and applicability (3). A number of common tests (i.e., those for which I have the equipment and or can approximate the relevant conditions adequately) are detailed below for a low-cost 5kg load cell purchased from ebay, and a 300gm load cell salvaged from a commerical jewellry scale.
Zero balance is the difference from the load cell (the signal between the A- and A+ pins of the HX711 breakout board) when no load is applied. This is typically stated in terms of percentage of full scale. Therefore, zero balance is the "offset" that needs to be applied when measuring and calibrating weights, and represents inherent differences between the strain gauges (and strain gauge connections) that form the load cell. Full scale is simply the output from the HX711 when the load cell is full loaded.
In order to produce data for the zero balance load cell test, the load cell was simply connected to the HX711 without applied load and data from the HX711 collected at 15 second intervals via the RS232 connection to PC. Each data point at each successive 15 second interval was in turn the average of 10 readings taken as quickly as possible with the HX711 (10 Hz frequency). The frequency/amount of data was designed to give sufficient information to access if environmental variables (i.e., temperature) were being held reasonably constant. The load cell was isolated in a plastic container to minimise influence of air currents and change in ambient room temperature etc. The results are shown in the following Graph 1.
Before discussing the determined zero balance, one observation from Graph 1 is that upon initial power-up the HX711/load cell requires ~2 minutes before a stable reading is obtained (note, the firmware already included a 500ms "settling time" before reading from the HX711 as recommended in the data sheet). This observation was reproducible between load cells and between successive readings for a single load cell. In order to ascertain if the HX711 or the load cell was responsible for this observation, "zero balance" readings were obtained from the HX711 at differing times between successive power-up events. The shorter the time between power-up events, the lower was the "initial dip" in the zero balance reading. This leads to the conclusion that the load cells are expriencing some "self heating" when powered-up, and this leads to slightly higher readings until the load cell equilibrates with the surroundings.
In order to calculate the "zero balance" data from the repeated measurements with no applied load (see Graph 1) were taken for the period 2 minutes to 5 minutes. This was to eliminate the initial "power-up" settling time for the load cell and provide sufficient data to produce a represenative average, however, not overly extend the measuring time which then may lead to inclusion of confounding variation due to temperature, creep and similar effects.
The actual "zero balance" was measured to be 10498 counts for the 5kg load cell which is 0.67% FS - compared to the load cell data sheet specification of ±2% FS.
Temperature Effect on Zero Balance
The ambient temperature is a major variable in the measurement of weigh using the load cell/strain gauges, as the electrical resistance of the strain gauges obviously varies with temperature (even though the Wheatstone Bridge arrangement compensates for temperature, for the full bridge arrangement, to a degree). The "Temperature Effect on Zero Balance" is the pertinent performance measure and is the change in zero balance (usually representated as %FS) due to a 1 degree Celsius change in ambient temperature.
In order to produce data for Temperature Effect on Zero Balance load cell test, the load cell was simply connected to the HX711 without applied load and data from the HX711 collected at 15 second intervals via the RS232 connection to PC, while temperature was monitored simultaneously via a LM35 sensor. The ambient temperature was varied using room air-conditioning. The actual load cell was covered with a plastic container to minimise influence of air currents and dampen out temperature change. Graph 2 presents the collected data set. After an initial equilibration period, the room air-conditioning was started (~ min 20) and then air-conditioning ceased (~ min 60) after which the room was allowed to equilibrate with ambient temperature again.
In order to calculate the temperature effect on zero balance, portions of the data set (highlighted in Graph 2 via the grey shaded areas) were used to calculate the linear regression between measured temperature and HX711 counts (with no applied load). These linear regressions are displayed in Graph 3.
Due to the 10-bit ADC (and 2.5V voltage reference) being used on the PIC18F248 to measure the temperature via the LM35 sensor, the measured temperature data is not really "continous" as the restricted ADC resolution (and only using a portion of the ADC span) results in "binning" of the temperature data. However, the linear regressions are still statistically strong. The data has been treated seperately depending if the temperature was increasing or decreasing during the weight measurement. While the slopes of the linear regression of these two treatments are different, does not particularly indicate hystersis effect, and thus the all the data was pooled. The pooled data linear regression resulted in R2 0.83 with a slope of 1085 counts/degree Celsius, which is 0.069 %FS (compared to the 5kg load cell datasheet value of <0.005 %FS).
Creep is the performance measure of the change in load cell signal the occurs over time while under load and all other variables remain constant. This generally measured at near load capacity and for a time of 30 minutes.
In order to produce data for the assessment of creep load cell test, the load cell was connected to the HX711 initially without applied load and data from the HX711 collected at 15 second intervals via the RS232 connection to PC, while temperature was monitored simultaneously via a LM35 sensor. This was to ensure that a stable equilibrium state was achieved (and that the ambient temperature was constant). Then a known 5kg weight was applied to the load cell, and measurement of response from the HX711 and load cell recorded for 30 minutes. Graph 4 presents the collected data set.
Graph 4 shows that after initial power-up there was an increase of ~1000 counts over the 10 minute period. The corresponding LM35 temperature data indicates that ambient temperature increase by approximately one degree Celsius. With reference to the previous section detailing the examination of temperature effect on zero balance, this increase of 1000 counts for 1 degree Celsius is consistent with previous results.
During the measurement period for assessment of creep (with 5kg applied weight), Graph 4 shows a relatively constant output from the HX711 + load cell, with the LM35 showing ambient temperature remained approximately constant during the period. Using the initial and final HX711 counts reading for the period that the 5kg weight was applied, results in a calculated value for creep of 0.008 %FS. This compares to the 5kg load cell datasheet value of <0.005 %FS.
Linearity is the algebraic difference between load cell output at a specific load and the corresponding point on the straight line drawn between minimum and maximum loads. Linearity is normally expressed in units of %FS. It is common for characterization to be measured at 40-60 %FS. It is desirable that linearity is high (or non-linearity is low!) so that a simply one-point linear calibration curve can be used.
In order the determine the linearity of the 5kg load cell, I had available a 100gm calibration weight and a commerical 3-decimal point electronic scale (see Photographs Section). This enabled production of secondary calibration weights of known mass by using known amounts of water (1ml = 1gm @ 25oC) in suitable containers. A series of weights across the calibration range (approximately 25gm, 50gm, 100gm, 200gm, 500gm, 1000gm, 2000gm and 5000gm) was used.
Graph 5 below shows the results of recording the counts due to each calibration weight against the pre-determined weight and then using a linear regression. The R2 value of 1 indicates a perfect linear relationship. The slope of 294 counts/gram is a measure of potential sensitivity