IOT

Weighing Machine using Arduino Load Cell & HX711 Module

In order to design a weighing machine using an Arduino load cell and an HX711 module, we will be “interfacing HX711 Load cell amplifier with Arduino” and a 16*2 LCD. This “Arduino Weight Measurement project” is simple.

To measure the weight produced by the load, the electronic weighing machine employs a load cell. Most load cells use the strain gauge method, which converts pressure (force) into an electrical signal. These load cells feature four strain gauges that are connected in a Wheatstone bridge configuration.

Components Required:

  • Arduino UNO R3 Development Board
  • 4X3 Keypad
  • JHD162A 16×2 LCD Display
  • Potentiometer
  • 1Kg-40KG Load Cell
  • HX711 Module
  • Push Buttons
  • Connecting Wires
  • Breadboard

What is a Load Cell?

Load Cell

An electrical signal produced by a load cell, a transducer, is directly proportional to the force being measured. Basically, it is a tool for measuring strain and converting force into electric energy for use by scientists and laborers. In order to preserve the integrity of the unit under pressure and to safeguard nearby people and equipment, load cells measure strain.

HX711 Load Cell Amplifier

The HX711 IC’s Load Cell Amplifier is a compact breakout board that makes it simple to read load cells for weight measurement. You can read changes in the load cell’s resistance by connecting the amplifier to your microcontroller, and with a little calibration, you can get pretty accurate weight readings.

The two-wire interface (Clock and Data) is used by the HX711 for communication. The GPIO pins of any microcontroller should function, and many libraries have been created to make it simple to read data from the HX711. For more details, see the hookup guide below. The HX711 is connected to load cells via a four-wire Wheatstone bridge arrangement. They frequently come in the hues RED, BLK, WHT, GRN, and YLW. Each color corresponds to the standard load cell color coding:

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

Design & Consideration

  • Load Cell and HX711 Connection:
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:

Moreover, a base is needed in order to secure the load cell over it using nuts and bolts. Here, a light wooden board was utilized as the base and a hard plyboard served as the frame for arranging items over it. This is necessary because when weight is applied to a load cell, it slightly bends.

Circuit Diagram: Interfacing HX711 Load Cell with Arduino

Assemble the circuit as shown in the figure for “Interfacing HX711 & Load Cell with Arduino“.

Working Explanation:

It is important to “calibrate load cell with HX711 and Arduino” before the entire circuit can be made to function. In order to “calibrate Load Cell with HX711 with Arduino,” we must start by adding 100g of weight at the same time the LCD displays 100g of weight. Calibration is completed once a 100g weight is maintained over the load cell. You may now easily add any weight to measure with a 99.9% accuracy.

The HX711 Load Amplifier Module receives an electrical analog voltage from the load cell, an amplifier that senses weight. The output of the HX711 is then translated into weight values in grams by the Arduino using this amplified value. On the 16*2 LCD, the output result is shown.

Source Code for Interfacing HX711 Load Cell with Arduino:

To upload this code to the Arduino board, just copy it. Ensure that your connection is the same as what is shown in the circuit diagram above.

#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();
}

Conclusion

I hope all of you understand how to design Weighing Machine using Arduino Load Cell & HX711 Module. We MATHA ELECTRONICS will be back soon with more informative blogs.

Leave a Reply

Your email address will not be published.