Weighing scale using load cell and HX711 amplifier with Arduino

Overview:

In this Arduino project, learn how to build a digital weighing scale by interfacing a load cell and its HX711 amplifier sensor with Arduino to measure the weight of an object and display the weight value on 16X2 LCD display module.

Article Flow:

  1. Learn what is load cell, types of load cells and how a load cell works?
  2. Required components for this project
  3. Interfacing components using circuit diagram
  4. Calibrating the scale
  5. Upload the main code to measure weight.

What is a load cell? how load cells works?

A load cell is a physical element (also called a transducer) capable of translating pressure or force into an electrical signal.

load cell image

Load cells are used to measure weight and are part of our daily lives. There are load cells everywhere, in our cars, lifts or in the weight measuring machines in supermarkets. They do not attract our attention because they are hidden inside other devices.

There are three ways a load cell is capable of translating a force or pressure into an electronic signal.

Hydraulic load cell

As its name suggests, it is a load cell with a hydraulic system consisting of a piston and a cylinder.

When a force is exerted on the piston, a fluid is compressed inside the cylinder and this corresponds to a pressure.

Pneumatic load cell

A pneumatic load cell is a type of load cell that uses pressurized air or gas to measure force or weight. It consists of a flexible, air-tight chamber that is subjected to a force. When an object is placed on it, it causes the chamber to deform. This deformation is measured using a pressure gauge like manometer, and the pressure reading is used to calculate the applied force.

Strain gauge based load cell

Finally, the load cell based on strain gauges, which are the ones we are going to use in this tutorial.

A strain gauge is a sensor that changes its resistance depending on the pressure exerted on it due to the piezo resistive effect.

In the case of the strain gauge, the resistance changes due to the pressure, load or deformation of the material.

Basically if you take a strip of conductive metal and stretch it, it will get thinner and longer and the resistance will increase. On the contrary, if the metal strip contracts under a force, the resistance decreases. This strain guages allows us to relate the force to an electrical signal (a voltage) and therefore we can measure the electrical voltages to calculate the weight.

There are different load cells based on strain gauges but they all work more or less the same. They vary in material, size and mechanical configuration which makes each load cell have different sensitivities, and maximum and minimum measuring capacities.

Also read: What is Rotary Encoder? Types, Principle, working in detail

A strain gauge is made up of a very thin wire or sheet configured in such a way that there is a linear change in electrical resistance when strain is applied in a specific direction. So measuring the resistance of the strain gauge can give weight, But sometimes the resistance changes are really small. For example, if the resistance is 120Ω, the changes that can be produced with a considerable weight is 0.12Ω.

This is a real problem as we would need a device capable of measuring these small changes in resistance or take that small change and amplify it.

This is where the Wheatstone bridge comes into play, a very simple circuit that will allow you to detect those small variations in resistance .

wheatstone bridge for strain guage load cell

From the above circuit knowing the source voltage and measuring the voltage VG , the value of the resistor Rx can be obtained.

Build a Digital weighing scale using Arduino

Required components:

Product NameQuantityamazon logoamazon logo india
Arduino Uno Microcontroller1https://amzn.to/3H4cKxZhttps://amzn.to/3638aTS
Load cell (capacity according to your requirement)1https://amzn.to/3pxdJ3Ohttps://amzn.to/3I9xPId
HX711 load amplifier module1https://amzn.to/3IK7lOnhttps://amzn.to/37i6TZV
16X2 LCD display module with I2C adapter1https://amzn.to/3BNSRuphttps://amzn.to/363ki7F
Few Connecting Wireshttps://amzn.to/3H2BV4ehttps://amzn.to/3J0WVu2
Wooden or acrylic sheets to attach the load cellhttps://amzn.to/3CbCE2jhttps://amzn.to/3sTufNR
You can buy the required components from the given best buy links. We choose the components according to value for money.

HX711 load cell amplifier module

The HX711 load cell amplifier module allows you to get the data from a load cell and send the data to Arduino to calculate the weight value.

This modules is integrated with 24 bit high precision Analog to digital converter chip HX711. It uses two wire  interface ( clock and data) for communication with microcontrollers. It is one of the best amplifier to build a weighing scale at lower cost at the same time improving the reliability and performance.

We can easily interface load cell with HX711 amplifier with only 4 wires with out any external power supply and measure the weight.

It operates in the voltage range between 2.7v to 5v DC. which makes it compatible with many microcontrollers available.

For more details refer the official datasheet: link

HX711 Load cell amplifier module pinout:

Check the below image for HX711 pinout diagram, there are two model board with same working one is from the sparkfun and another is generic one.

hx711 load cell amplifier pinout diagram

  • Red = Excitation + or VCC
  • Black = Excitation – or GND
  • White = Signal + or output+
  • Green = Signal – or output-

Attaching the load cell to build the weighting area

Now cut the wooden or acylic sheets in squares or rectangles and attach it to the load cell according to the below image.

load cell attachment with base to create weighting platform

Fix the load cell to the base with the help of screws and nuts as the load cell is provided with holes.

Interfacing loadcell, HX711 load cell amplifier module with Arduino

Now connect all the required components according to the below circuit diagram.

interfacing hx711 with arduino weight scale circuit diagram

As you can see from the above schematic diagram the load cell and hx711 amplifier are connected as

Loadcell ⇔ HX711 amplifier

  • Red wire = E+ or RED
  • Black wire = E- or BLK
  • White wire= A- or WHT
  • Green wire= A+ or GRN

HX711 amplifier is connected to Arduino as

HX711 ⇔ Arduino

  • VCC  = 5V
  • SCK  =  2 (DIGITAL PIN)
  • DT    =  3(DIGITAL PIN)
  • GND =  GND

LCD module ⇔ Arduino

  • GND = GND
  • VCC  = 5V
  • SDA  =A4
  • SCL   =A5

Calibrating Load cell with HX711 amplifier

After connecting all the required components its time to upload the code, but here in this project calibrating the device is the most important factor and we need to know the calibration value for main code to measure the weight with high accuracy.

Connect Arduino board to PC where Arduino IDE is installed, install the HX711 library through library manager or download it through the below link and extract it into Arduino libraries folder. Next copy and upload the calibration code for weight scale which is given below.

  • HX711 library download – link   by Bogden Necula
//HX711 load cell calibration program code https://www.circuitschools.com
#include "HX711.h" 

//data pin and clock pin
byte pinData = 3;
byte pinClk = 2;

HX711 scale;
//Parameter to calibrate weight and sensor, different for different sensors
float calibration_factor = 137326; //put some value and adjust it through serial monitor 

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");

  scale.begin(pinData, pinClk);
  //apply the calibration
  scale.set_scale();
  //initializing the tare. 
  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);
}

void loop() {

  scale.set_scale(calibration_factor); //Adjust to this calibration factor

  Serial.print("Reading: ");
  Serial.print(scale.get_units(), 2);
  Serial.print(" kgs"); //Change this to grams 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
  }
}

After uploading the code open serial monitor at 9600 baud rate to see:

HX711 calibration
Remove all weight from scale
After readings begin, place known weight on scale
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
Reading: 0.01 kgs calibration_factor:137326

Now add a known weight (for ex: 1kg) on the board attached to loadcell. if the reading shows the exactly near 1.00kgs copy the calibration factor, if it shows more than 1 kg decrease the calibration factor by pressing z in the serial monitor, in the same way if the readings shows less than 1kg increase the calibration factor by pressing a. Copy the calibration factor when your reading shows exactly near value to the placed known weight.

Program code for digital weighing machine using Arduino to display weight on LCD display

Copy and paste the below program code in Arduino IDE and change the calibration factor to the value which you got while calibrating and upload the code.

//Program code for digital weighing scale using Arduino and HX711 with load cell
#include <LiquidCrystal_I2C.h>
#include "HX711.h"
 
#define DEBUG_HX711
 
// calibration parameter from calibrating code with known values
#define CALIBRATION_FACTOR 20780.0

// Create the lcd object address 0x3F and 16 columns x 2 rows 
LiquidCrystal_I2C lcd (0x3F, 16,2);
 
// data pin and clock pin
byte pinData = 3;
byte pinClk = 2;
 
// define HX711
HX711 scale;
 
void setup() {

  lcd.init();
  lcd.backlight();
  lcd.print( "WEIGHT SCALE" );
 
#ifdef DEBUG_HX711
  // Initialize serial communication
  Serial.begin(9600);
  Serial.println("[HX7] Sensor start HX711");
#endif
 
  //Initializing sensor
  scale.begin(pinData, pinClk);
  // apply the calibration value
  scale.set_scale(CALIBRATION_FACTOR);
  // Initialize the tare
  //Assuming there is no weight on the scale at start up, reset the scale to 0
  scale.tare();
}
 
void loop() {
#ifdef DEBUG_HX711
  Serial.print("[HX7] Reading: ");
  Serial.print(scale.get_units(), 2);
  Serial.print(" Kgs");
  Serial.println();
#endif
lcd.setCursor (0, 1);
lcd.print( "Reading:" );
lcd.print(scale.get_units(), 2);
lcd.print(" Kgs");
}

After uploading the code you can see the measured weight values on the serial monitor and LCD display module as shown in the below output image.

Output:

arduino weight scale using HX711 and loadcell output on lcd

Applications of Load cells:

  1. Weighing scales: Load cells can be used to build digital weighing scales for a variety of applications, such as kitchen scales, luggage scales, or shipping scales.
  2. Industrial automation: Load cells can be used to measure forces in industrial automation systems, such as conveyor belts, hoists, or other machinery.
  3. Load testing: Load cells can be used to test the strength and capacity of materials, structures, or equipment, such as bridges, cranes, or aircraft components.
  4. Force feedback devices: Load cells can be used in devices that provide haptic feedback, such as joystick handles or game controllers.
  5. Sensor fusion: Load cells can be used in combination with other sensors, such as accelerometers or gyroscopes, to measure a wide range of physical quantities, such as orientation, acceleration, or vibration.
  6. Medical devices: Load cells can be used in medical devices, such as rehabilitation equipment or prosthetics, to measure forces applied by the user.
  7. Quality control: Load cells can be used to measure forces in quality control applications, such as testing the strength of welds or adhesives.
  8. Force measurement: Load cells can be used to measure forces in a variety of settings, such as testing the grip strength of athletes or measuring the forces applied by a machine tool.
  9. Agricultural applications: Load cells can be used in agricultural settings, such as measuring the weight of crops or livestock.
  10. Robotics: Load cells can be used in robotic systems to measure forces applied by the robot, such as when grasping or manipulating objects.

Project Ideas:

  • You can interface this load cell and its HX711 amplifier with microcontrollers which has inbuilt WiFi such as NodeMCU and ESP32 to build IoT based Weighing scale and monitor data through blynk, Arduino IoT cloud, Thingspeak, etc,.
  • You can interface the same with OLED display module to get the measured weight value on OLED display.
  • You can create a weighing machine by using 4 load cells and connecting them to HX711 to build our daily weighing scale which we explain in our future projects, till then here is the circuit of it.

connecting 4 load cells to build weight scale

If you like this project please share with your friends. If you have any doubts or issues please feel free to post your query in the below comments section. Please follow our Facebook page “Circuit Schools” for more interesting project updates.

6 comments
  1. Error while compiling Arduino load cell program Not working. Error: ‘class LiquidCrystal_I2C’ has no member named ‘init’.

  2. Can you please make a project on how to make bathroom weighting scale with arduino and load cells with code. I want it for my college project.

  3. Can i connect an OLED display to this Arduino load cell to display the weight on it. Please send me the code for it.

  4. hello, I would like to know what measuring speed is possible to achieve. I would need to measure the load 360x in 20ms. Is it feasible? thank you for answer.

Leave a Reply

Your email address will not be published. Required fields are marked *