You must have seen a digital weighing machine in numerous shops, but have you ever wondered how it works and how it can be made into a low cost, portable device? If not, then let’s make one.
How digital weighing machine works?
- This digital weighing machine has two 50 kg load cells that have the ability to change its resistance value according to the weight applied on it
- The load cells are then connected to the HX711 module, which is a 24-bit analog to digital converter.
- After that, the HX711 module sends the data to a microcontroller, which then processes it and displays the measured value in grams on the OLED screen.
Bill of Material
First, install the required libraries into the Arduino IDE. To do so, go to Sketch → Add library → Library Manager. Now search for the following libraries. (Refer Fig 1.)
- Ug82 library
- AdaFruit SSD1306 OLED
- HX7111 library
After setting up the prerequisite libraries, now we can start our coding. In the first part of the code, we will include the libraries and the variables for storing our sensor values. Next we create a setup function, which will setup the serial communication and OLED display. (Refer Fig 2,3)
Next, create a loop function through which we will be able to get the sensor’s output and then display it on OLED screen. (Refer Fig 4.)
Note: To get an accurate reading, you will have to calibrate in such a way that measured value is not affected by any extra weight of the device itself.
Arduino to OLED display connection
|Arduino Pin||OLED Pin|
|VCC||VCC of OLED|
Arduino to HX711 Pin connection
|Arduino Pin||HX711 Pin|
Load Cell to HX711 connection
|Load Cell 1 White Wire||E+|
|Load Cell 1 Black Wire||E-|
|Load Cell 2 White Wire||E-|
|Load Cell 2 Black Wire||E+|
|Load Cell 1 Red Wire||A+|
|Load Cell 2 Red Wire||A-|
Now after connecting all the components, cross check that everything is connected properly, after which you can put all of them in any pocket-sized box of your choice. Finally, connect a battery to your digital weighing machine.
Download Source Code: click here