Closed bshapero13 closed 2 years ago
The first step was to ensure the load cell and amplifier were connected appropriately and the schematics can be seen below:
The physical connections can be seen below:
For the purposes of this configuration, the following connections were made:
Afterward the following repository was cloned to obtain the library for the HX711 to use its functions. The load cell needed to be calibrated first, so the function calibration.py was created and below is the code for the function:
This function works by retrieving the initial offset of the load cell with the calibrate() function by calling the HX711 library function. This offset is then compared to an item of some known weight and the function hx.read_average() is used again to retrieve the value of the item on the load cell and take the difference between that object's measured weight and the initial offset. The actual weight of the item is then inputted , and by doing so, a ratio between actual and measured value can be made that will be used as a ratio to convert the weights of the items placed onto the load cell.
Once the ratio is found, the weight is displayed in grams and if the calibration does not seem accurate, then the load cell might want to be recalibrated. A 1250g object was used on the scale and this was the output produced:
It can be seen that this adjusted scale is off by 30g, which for the purposes of our project will perhaps be detrimental. The reason for the disparity is that the HX711 Amplifier may take a minute or two to fully process values and so a new calibration was performed and the new output was produced:
This value is much closer to the expected weight of the item, which may not be exactly as displayed on the item so the marginal difference is within reason
When calibrated, the load cell can be tested out fully by continuously measuring data and outputting it. The following function loadcelltest.py was created:
In this file, the setup() function uses the offset and scaling factor found from the output of the calibration.py file and sets these values so the data is displayed accurately. The file then enters a loop that will run until a keyboard interruption and will display the weight in grams of the object by using the HX711 library and its function hx.get_grams() and the following output was produced:
Note that initially the load cell is hovering around the value of 0 with some slight fluctuation, which is understandable. For potential modification, a the loop function of loadcelltest.py could be modified to only output integer values since difference of 10ths of a gram will not be applicable to the uses of our product.
The video test can be found in this folder and shows a finger being placed onto the load cell and weight gently applied while at the same time letting up to see if the load cell will be able to detect rapid changes, and it was able to do so.