While we planned on how to code for the load cell, since our Arduino Giga R1 WiFi board arrived before our load cell was set to arrive, we decided to work on the use of the Arduino IoT cloud first instead.
(Credits: Arduino)
Navigating the IoT cloud was difficult as it was specific about the Internet connection used by the laptop and the board, the device it was connected to as well as the installation of an agent everytime we wanted to use the IoT. However, we managed to code a program in which a button pressed on the IoT will be able to switch on the LED light on the Arduino Giga. This was our first step in successfully coding with the IoT and since it was now possible for us to use the IoT cloud with little difficulties, we went ahead with our plan to use virtual buttons for the user interface instead of physical buttons on the matrix keypad.
We then managed to code a program such that the LCD display was able to mirror what was coded in the Arduino IoT cloud when it was connected to the Arduino Giga board. The versatility of the IoT cloud was such that as long as it was downloaded on any device and the same user was logged in, the buttons would be able to control the actions of the connected board. This meant that we could not only use our laptops, but also our phones to control the Arduino Giga and the LCD display. Yay!
When our load cell arrived, we were ready to work on it, pumped up after our success with the IoT cloud. Buying the load cell and 3D-printing the base and top cell for it seemed simple enough. However, coding for the load cell was certainly a huge challenge. To know the weight detected by the load cell, we had to code for a program such that placing an object on the top cell will print out the weight on a display.
We used the laptop’s serial monitor initially as our display as we had to input characters to get the weight of the object which was not possible to do on the LCD display. However, we realised that the load cell needed to be calibrated before it could give an accurate weight value on the serial monitor. Since every load cell has its own calibration value, we needed to find the calibration value of our specific load cell. This was difficult as the program we coded for kept giving different calibration values each time we ran the code for the load cell.
Eventually, we managed to code a program such that the calibration value remained the same throughout multiple trials of calibration. This could only mean one thing; we were successful in finding the calibration value for our load cell!
Once we managed to calibrate the load cell successfully, we tested it out. First we put an empty jar of water in a weighing machine, then we filled up the jar with water and weighed it again. We compared the values from the weighing machine to the values given by the load cell and realised that the load cell was quite accurate (with a margin of error of only 0.5g) in providing the weight of the liquid.
Now that we had a load cell that was successfully calibrated and accurate in its measurement, we needed to proceed to the next step, the reason we bought the load cell in the first place; to code for the pumps such that it will stop dispensing liquid when the target weight is reached.