Arduino Weighing Machine using Load Cell HX711 Module

Arduino Weighing Machine using Load Cell HX711 (Last Updated On: December 1, 2018)

Introduction:

In this project we will be “interfacing HX711 Load cell amplifier with Arduino” and 16*2 LCD for designing Arduino Weighing Machine using Load Cell HX711 Module. This is a simple “Arduino Weight Measurement project”.

Electronic weighing machine uses load cell to measure the weight produced by the load, here most load cells are follows the method of 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.




Components Required:

For designing Arduino Weighing Machine using Load Cell & HX711 Module we use the following components. Each and every components are described below further.

1. Arduino UNO Board
2. HX711 Module - (Buy Online from Amazon)
3. Load Cell (Any type like 3 kg, 6 kg, 10 kg, 40 kg) - (Buy Online from Amazon)
4. 16*2 LCD (example JHD162)
5. Tact Switch (Reset Switch)
6. Breadboard
7. Connecting Wires
8. Mounting surface for Load Cell (Nuts, Bolts, Frame, Base)
9. Standard Weight blocks (100 gm)

Components Description

What is Load Cell?

Arduino Weighing Machine using Load Cell HX711

A load cell is a transducer that is used to create an electrical signal whose magnitude is directly proportional to the force being measured. It is basically a device that measures strain and then converts force into electric energy which serves as measurement for scientists and workers. The strain measurement by load cells helps in maintaining integrity of the unit under pressure and protects people and equipment nearby.

HX711 Load Cell Amplifier

The Load Cell Amplifier is a small breakout board for the HX711 IC that allows you to easily read load cells to measure weight. By connecting the amplifier 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.

The HX711 uses a two-wire interface (Clock and Data) for communication. Any microcontroller’s GPIO pins should work, and numerous libraries have been written, making it easy to read data from the HX711. Check the hookup guide below for more information. Load cells use a four-wire Wheatstone bridge configuration to connect to the HX711. These are commonly colored RED, BLK, WHT, GRN and YLW. Each color corresponds to the conventional color coding of load cells:

Arduino Weighing Machine using Load Cell HX711

Red (Excitation+ or VCC)
Black (Excitation- or GND)
White (Amplifier+, Signal+ or Output+)
Green (A-, S- or O-)
Yellow (Shield)

Arduino Weighing Machine using Load Cell HX711 Module

Load Cell & 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+

Load Cell Assembly on 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.

Arduino Weighing Machine using Load Cell HX711

Arduino Weighing Machine using Load Cell HX711


Circuit Diagram: Interfacing HX711 Load Cell with Arduino

Assemble the circuit as shown in the figure for designing “Arduino Weighing Machine using Load Cell HX711 Module” or simply “Interfacing HX711 Load Cell with Arduino“.
Arduino Weighing Machine using Load Cell HX711


Working Explanation:

Before making the whole circuit to work it is necessary to “calibrate load cell HX711 with Arduino“. For “calibrating Load Cell HX711 with Arduino” we need to put 100g weight at starting when the LCD displays put 100g weight. Once 100gm weight is kept over the load cell, calibration is done. Now simply you can put any weight for measuring with 99.9% accuracy.

Load cell which is an amplifier senses the weight and supplies a electrical analog voltage to HX711 Load Amplifier Module. Then this amplified value is fed to the Arduino where the output of HX711 is converted into the weight values in grams. The output result is displayed on 16*2 LCD.


Source Code for Interfacing HX711 Load Cell with Arduino:

Simply copy this code and upload to the Arduino board. Make sure to have the same connection as indicated above in the circuit diagram of Arduino Weighing Machine using Load Cell HX711 Module.

#include <LiquidCrystal.h>
LiquidCrystal lcd(7, 6, 5, 4, 3, 2);

#define DT A0
#define SCK A1
#define sw 9

long sample=0;
float val=0;
long count=0;

unsigned long readCount(void)
{
  unsigned long Count;
  unsigned char i;
  pinMode(DT, OUTPUT);
  digitalWrite(DT,HIGH);
  digitalWrite(SCK,LOW);
  Count=0;
  pinMode(DT, INPUT);
  while(digitalRead(DT));
  for (i=0;i<24;i++)
  {
    digitalWrite(SCK,HIGH);
    Count=Count<<1;
    digitalWrite(SCK,LOW);
    if(digitalRead(DT)) 
    Count++;
  }
  digitalWrite(SCK,HIGH);
  Count=Count^0x800000;
  digitalWrite(SCK,LOW);
  return(Count);
}

void setup()
{
  pinMode(SCK, OUTPUT);
  pinMode(sw, INPUT_PULLUP);
  lcd.begin(16, 2);
  lcd.print("    Weight ");
  lcd.setCursor(0,1);
  lcd.print(" Measurement ");
  delay(1000);
  lcd.clear();
  calibrate();
}

void loop()
{
  count= readCount();
  int w=(((count-sample)/val)-2*((count-sample)/val));
  lcd.setCursor(0,0);
  lcd.print("Measured Weight");
  lcd.setCursor(0,1);
  lcd.print(w);
  lcd.print("g             ");

  if(digitalRead(sw)==0)
  {
    val=0;
    sample=0;
    w=0;
    count=0;
    calibrate();
  }
}

void calibrate()
{
    lcd.clear();
  lcd.print("Calibrating...");
  lcd.setCursor(0,1);
  lcd.print("Please Wait...");
  for(int i=0;i<100;i++)
  {
    count=readCount();
    sample+=count;
  }
  sample/=100;
  lcd.clear();
  lcd.print("Put 100g & wait");
  count=0;
  while(count<1000)
  {
    count=readCount();
    count=sample-count;
  }
  lcd.clear();
  lcd.print("Please Wait....");
  delay(2000);
  for(int i=0;i<100;i++)
  {
    count=readCount();
    val+=sample-count;
  }
  val=val/100.0;
  val=val/100.0;        // put here your calibrating weight
  lcd.clear();
}

Video Preview & Explanation:




13 Comments

  1. hello mr.. my name is pramono.. im from indonesia..
    i have a project use load cell..
    im doing project same with you,, but i have a problem,, when calibrating in 100 gr the program work very well, but if i change the mass up to 200 gr the measurement cant accurately

    sorry i cant speak english fluently
    i hope you can answer my question..
    thanks

    1. For calibration the program is set in such a way that only 100 gm will calibrate the circuit. do not use any other weights for calibration, it won’t work

  2. hello sir i am doing same project but i want to measure weight 0 to 1000k. tell me components names please, i mean can we use hx711 amplifier for 1000kg weight too?? i am waiting for reply

    1. with larger weights the calibration for low weights will distort and may changes +/-10%. But for higher weights you can use the same Hx711 but load cell requires of 1000Kg

      1. Sir, I have 3 questions.
        1. want to use a 100 kg load cell. so for this also the hx711 and Arduino Uno 3 remains same or should I make any changes?
        2. Should I have to connect it to the computer all the time?
        3. Is calibration required whenever I turn it on?
        please answer it, sir. THANK YOU.

        1. 1. Yes you can use 100 kg load cell for measuring weight upto 100 kg. And yes the circuits remains same.

          2. You don’t need to connect to PC all the time. Rather 5 voly batter or 5 volt power supply adapter can be used instead of PC. PC is used for the first time for uploading code to Arduino.

          3. And yes calibration is required everytime you turn ON the machine.

  3. hi sir.. i am doing project on cantilever beam deflections using Arduino board and stain gauges..the problem is Arduino code..I was unable to write the code for it… i followed your “Arduino Weighing Machine using Load Cell HX711 Module” ..to understand the code ..it simply through me into great confusion. would you help me…please

    1. Please modify this same code using mathematical expression by multiplying with some factor using the formula for strain gauge, it should work.

  4. Hi sir. I’m newbie for this project, I’m just tested as same as yours,but there is a problem where the lcd cannot display the weight, and I don’t know where is the mistake. :”(

    1. Check the connection once again.The LCD id not didplaying anything bcoz of connection issue only, follow the diagram. Then Upload the code.

Leave a Reply

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