Weighing Scale With 40KG Load Cell HX711 & Arduino

In this project we will make a Weighing Scale using 40KG Load Cell, HX711 24 bit Amplifier Module & Arduino. The load cell will be capable of measuring any weight up to 40KG.

Overview

In this Arduino Tutorial we are interfacing 40Kg load cell to the Arduino using the HX711 Load cell amplifier module. HX711 is a precision 24-bit analog to digital converter (ADC) designed for weighing scales and industrial control applications to interface directly with a bridge sensor. The HX711 load cell amplifier is used to get measurable data out from a load cell and strain gauge.

The electronic weighing machine uses a load cell to measure the weight produced by the load, here most load cells are following the method of a strain gauge, Which converts the pressure (force) into an electrical signal, these load cells have four strain gauges that are hooked up in a Wheatstone bridge formation.

We will make a Weighing Scale Machine which can measure weights up to higher-value like 40KG. We need to calibrate the load cell and find the calibration factor. Once the calibration is done, we can include that factor in our code. Thus this will make the scale precise and accurate. The greater is the mass the greater the error. So we will try to remove the error from the weighing scale. We will finally display the measured weight in the 16×2 I2C LCD Display. We will use a push button to reset the weight value to zero.

You can follow our previous post in case you want to Weight Measuring Scale for lower weights: 10KG Weighing Machine using Arduino Load Cell & HX711 Module

If you want the Weighing Scale to be IOT Based You can check here: IOT Weighing Scale with HX711 Load Cell & ESP8266 on Blynk

Bill of Materials

Following are the components required for this Weighing Scale Project. All the components can be easily purchased from Amazon. The component purchase link is given below.

S.N.Components NameQuantityPurchase Links
1Arduino Nano1Amazon | AliExpress
216x2 LCD Display1Amazon | AliExpress
3Load Cell1Amazon | AliExpress
4HX7111Amazon | AliExpress
5Push Button1Amazon | AliExpress
6Connecting Wires10Amazon | AliExpress
7Breadboard1Amazon | AliExpress

Load Cell

A load cell is a type of transducer, specifically a force transducer. It converts a force such as tension, compression, pressure, or torque into an electrical signal that can be measured and standardized. As the force applied to the load cell increases, the electrical signal changes proportionally. Load cells are used to measure weight.

40KG Load Cell

Load cells generally consist of a spring element on which strain gauges have been placed. The spring element is usually made of steel or aluminum. That means it is very sturdy, but also minimally elastic. As the name “spring element” suggests, the steel is slightly deformed under load, but then returns to its starting position, responding elastically to every load. These extremely small changes can be acquired with strain gauges. Then finally the deformation of the strain gauge is interpreted by analysis electronics to determine the weight.

HX711 Module

The HX711 Dual-Channel 24 Bit Precision A/D weight Pressure Sensor Load Cell Amplifier and ADC Module is a small breakout board for the HX711 IC that allows you to easily read load cells to measure weight. By connecting the module to your microcontroller you will be able to read the changes in the resistance of the load cell and with some calibration. You’ll be able to get very accurate weight measurements.

HX711 Module

This can be handy for creating your own industrial scale, process control, or simple presence detection. The HX711 Weighing Sensor uses a two-wire interface (Clock and Data) for communication. Any microcontroller’s GPIO pins should work making it easy to read data from the HX711.

Each color corresponds to the conventional color coding of load cells : 1. Red (Excitation+ or VCC). 2. Black (Excitation- or GND). 3. White (Amplifier+, Signal+, or Output+). 4. Green (A-, S-, or O-). 5. Yellow (Shield).

The YLW pin acts as an optional input that not hook up to the strain gauge but is utilized to ground and shield against outside EMI (electromagnetic interference).

Base Design & Connections

Load Cell and HX711 Connection:

Arduino Weighing Machine using Load Cell HX711

- RED Wire is connected to E+ - BLACK Wire is connected to E- - WHITE Wire is connected to A- - GREEN Wire is connected to A+
1234 -RED Wire isconnected toE+-BLACK Wire isconnected toE--WHITE Wire isconnected toA--GREEN Wire isconnected toA+

Load Cell Assembly on Base:

Load Cell Base

A base is also required to fix the load cell over it by using nuts and bolts. Here we have used a hard plyboard for the frame for placing things over it and a light wooden board as Base. This is required as load cell bends slightly when some weight is placed over it.

Circuit: Weighing Scale with 40KG Load Cell HX711 & Arduino

Here is a circuit diagram for interfacing 40KG Load Cell and HX711 Module with Arduino. You can follow the same circuit here and make your own Weighing Scale.

Circuit Load Cell HX711 Arduino

The connection between Load Cell & HX711 has been explained above. Connect the DT & SCK Pins of Load Cell to Arduino D2 & D3 Pins. I have used a push-button tact switch to reset the weight to zero. Push-button Switch is a connected digital pin D4 of ESP8266. I used a 16X2 I2C LCD Display to minimize the connection. So, connect the SDA & SCL pin of I2C LCD Display to D2 & D1 of Nodemcu respectively.

Source Code/Program to Calibrate the Load Cell

After connecting the load cell as above, you need to calibrate it first before going for the final design. So first calibrate the whole assembly unit. You will need one library to make the code compile. Download HX711 Library from below.

Download HX711 Library

#include "HX711.h" //You must have this library in your arduino library folder #define DOUT 2 #define CLK 3 HX711 scale(DOUT, CLK); //Change this calibration factor as per your load cell once it is found you may need to vary it in thousands float calibration_factor = -109525; //-109525 worked for my 40Kg max scale setup //============================================================================================= // SETUP //============================================================================================= void setup() { Serial.begin(9600); Serial.println("HX711 Calibration"); Serial.println("Remove all weight from scale"); Serial.println("After readings begin, place known weight on scale"); Serial.println("Press a,s,d,f to increase calibration factor by 10,100,1000,10000 respectively"); Serial.println("Press z,x,c,v to decrease calibration factor by 10,100,1000,10000 respectively"); Serial.println("Press t for tare"); scale.set_scale(); scale.tare(); //Reset the scale to 0 long zero_factor = scale.read_average(); //Get a baseline reading Serial.print("Zero factor: "); //This can be used to remove the need to tare the scale. Useful in permanent scale projects. Serial.println(zero_factor); } //============================================================================================= // LOOP //============================================================================================= void loop() { scale.set_scale(calibration_factor); //Adjust to this calibration factor Serial.print("Reading: "); Serial.print(scale.get_units(), 3); Serial.print(" kg"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person Serial.print(" calibration_factor: "); Serial.print(calibration_factor); Serial.println(); if(Serial.available()) { char temp = Serial.read(); if(temp == '+' || temp == 'a') calibration_factor += 10; else if(temp == '-' || temp == 'z') calibration_factor -= 10; else if(temp == 's') calibration_factor += 100; else if(temp == 'x') calibration_factor -= 100; else if(temp == 'd') calibration_factor += 1000; else if(temp == 'c') calibration_factor -= 1000; else if(temp == 'f') calibration_factor += 10000; else if(temp == 'v') calibration_factor -= 10000; else if(temp == 't') scale.tare(); //Reset the scale to zero } }
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 #include "HX711.h" //You must have this library in your arduino library folder#define DOUT 2#define CLK 3HX711 scale(DOUT,CLK);//Change this calibration factor as per your load cell once it is found you may need to vary it in thousandsfloatcalibration_factor=-109525;//-109525 worked for my 40Kg max scale setup //=============================================================================================// SETUP//=============================================================================================voidsetup(){Serial.begin(9600);Serial.println("HX711 Calibration");Serial.println("Remove all weight from scale");Serial.println("After readings begin, place known weight on scale");Serial.println("Press a,s,d,f to increase calibration factor by 10,100,1000,10000 respectively");Serial.println("Press z,x,c,v to decrease calibration factor by 10,100,1000,10000 respectively");Serial.println("Press t for tare");scale.set_scale();scale.tare();//Reset the scale to 0longzero_factor=scale.read_average();//Get a baseline readingSerial.print("Zero factor: ");//This can be used to remove the need to tare the scale. Useful in permanent scale projects.Serial.println(zero_factor);}//=============================================================================================// LOOP//=============================================================================================voidloop(){scale.set_scale(calibration_factor);//Adjust to this calibration factorSerial.print("Reading: ");Serial.print(scale.get_units(),3);Serial.print(" kg");//Change this to kg and re-adjust the calibration factor if you follow SI units like a sane personSerial.print(" calibration_factor: ");Serial.print(calibration_factor);Serial.println();if(Serial.available()){chartemp=Serial.read();if(temp=='+'||temp=='a')calibration_factor+=10;elseif(temp=='-'||temp=='z')calibration_factor-=10;elseif(temp=='s')calibration_factor+=100;elseif(temp=='x')calibration_factor-=100;elseif(temp=='d')calibration_factor+=1000;elseif(temp=='c')calibration_factor-=1000;elseif(temp=='f')calibration_factor+=10000;elseif(temp=='v')calibration_factor-=10000;elseif(temp=='t')scale.tare();//Reset the scale to zero}}

Once you upload the calibration code, open the serial monitor and adjust your scale factor with known weight until you see the correct readings. Press a,s,d,f to increase calibration factor by 10,100,1000,10000 respectively. Press z,x,c,v to decrease calibration factor by 10,100,1000,10000 respectively.

Calibration

Once you see the placed weight is the same as shown weight note down the calibration factor and use it in the final code for Weighing Scale.

Source Code/Program: Weighing Scale with 40KG Load Cell HX711 & Arduino

Once you find the calibration factor update it in below code. Then you can simply upload the code and hence your weighing scale is ready.

#include "HX711.h" #include <Wire.h> #include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); HX711 scale(2, 3); int rbutton = 7; // this button will be used to reset the scale to 0. float weight; float calibration_factor = -101525; // for me this vlaue works just perfect 419640 void setup() { Serial.begin(9600); pinMode(rbutton, INPUT_PULLUP); scale.set_scale(); scale.tare(); //Reset the scale to 0 long zero_factor = scale.read_average(); //Get a baseline reading lcd.begin(); lcd.setCursor(6,0); lcd.print("DIY"); lcd.setCursor(1,1); lcd.print("Weighing Scale"); delay(3000); lcd.clear(); } void loop() { scale.set_scale(calibration_factor); //Adjust to this calibration factor weight = scale.get_units(5); lcd.setCursor(0, 0); lcd.print("Measured Weight"); lcd.setCursor(0, 1); lcd.print(weight); lcd.print(" KG "); delay(2000); lcd.clear(); Serial.print("Weight: "); Serial.print(weight); Serial.println(" KG"); Serial.println(); if ( digitalRead(rbutton) == LOW) { scale.set_scale(); scale.tare(); //Reset the scale to 0 } }
12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 #include "HX711.h"#include <Wire.h>#include <LiquidCrystal_I2C.h>LiquidCrystal_I2C lcd(0x27,16,2); HX711 scale(2,3); intrbutton=7;// this button will be used to reset the scale to 0.floatweight;floatcalibration_factor=-101525;// for me this vlaue works just perfect 419640 voidsetup(){Serial.begin(9600);pinMode(rbutton,INPUT_PULLUP);scale.set_scale();scale.tare();//Reset the scale to 0longzero_factor=scale.read_average();//Get a baseline readinglcd.begin();lcd.setCursor(6,0);lcd.print("DIY");lcd.setCursor(1,1);lcd.print("Weighing Scale");delay(3000);lcd.clear();} voidloop() {scale.set_scale(calibration_factor);//Adjust to this calibration factor weight=scale.get_units(5); lcd.setCursor(0,0);lcd.print("Measured Weight");lcd.setCursor(0,1);lcd.print(weight);lcd.print(" KG ");delay(2000);lcd.clear();Serial.print("Weight: ");Serial.print(weight);Serial.println(" KG");Serial.println(); if(digitalRead(rbutton)==LOW){scale.set_scale();scale.tare();//Reset the scale to 0} }

If you want the Weighing Scale to be IOT Based You can check here: IOT Weighing Scale with HX711 Load Cell & ESP8266 on Blynk

Tag » Arduino Hx711 Set_scale