Professional Documents
Culture Documents
In this project we will be “interfacing HX711 Load cell amplifier with Arduino” and
16*2 LCD for designing Weighing Machine using Arduino Load Cell & HX711 Module.
This is a simple “Arduino Weight Measurement project”.
The electronic weighing machine uses 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.
Components Required:
For designing Arduino Weighing Machine using Load Cell & HX711 Module we use
the following components. Each and every component are described below further.
2. HX711 Module
6. Breadboard
7. Connecting Wires
\
What is Load Cell?
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 a measurement for
scientists and workers. The strain measurement by load cells helps in maintaining the
integrity of the unit under pressure and protects people and equipment nearby.
Working Explanation:
Before making the whole circuit to work it is necessary to “calibrate load cell with
HX711 with Arduino“. For “calibrating Load Cell with 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 an electrical analogue
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 the 16*2 LCD.
#define DT A0
#define SCK A1
#define sw 9
long sample=0;
float val=0;
long count=0;
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();
}
Eight years back I purchased a small bathroom scale from @Home ,Mumbai
and it cost me a good amount of money then. It’s a simple analog weight
machine. You stand up on the scale, the needle deflects, read the weight –
simple and straight forward. It’s big brother – the digital weight machine was
far more costlier then.
But to be frank the digital weight machine is far more easier and simple as
far as the design is concerned. While the analog machines drifts from zero
quite frequently which you have to set by turning a thumb wheel and seeing
the needle, the digital weight machine drift can be set easily, besides it’s
readings are more accurate and precise.
The following article will describe how to build up a simple cheap yet very
effective (5 Kg max) kitchen weight machine for a penny! Change the strain
gauge for a bigger capacity and your bathroom scale is just ready – all are
just the same.
The MCU we would use is an Arduino with boot loader, a strain gauge ,a 16*2
LCD panel , HX711 analog amplifier few contraption, hardware fitting , nuts
,bolts and washers and your weigh machine is up and ready.
Bill of Materials
Arduino (any make) / ATMEGA328 with boot loader – $2 to $3
5KG weight machine (strain gauge) – $3 to $4
16*2 LCD panel – $2 to $3
Instrument amplifier HX711 – $1 to $2
While all the above prices are aliexpress.com price some prices are quite
comparable from ebay.in & dx.com also.
Preparation
I prefer HX711 over any other instrument amplifier like INA105P because
HX711 has a digital output, cheap and it has an adafruit header file for
Arduino which makes it further easier to use. The weight scale has a metallic
structure surrounded by strain relieving frames which picks up the strain
when subjected to weight. The strain gauges are arranged in wheat stone
bridge format. One side a voltage is applied while the other side measures
the changes in voltage depending on strain it suffers.
Figu
re 1: wheat stone bridge and load cell connections (Courtesey:instrumentationengineering.org)
That is a typical load cell arranged in a wheat stone bridge format. The
output is clubbed into 4 wires. The load is applied at the free end. The strain
gauges are applied on all 3 sides to pick up compression and expansions
which is nothing but load signal which is processed and measured for weight
measurements. The color code of the 4 wires that comes of it has uniform
meaning – Red, white, black & green.
The HX711 has another channel left unused or if you have one more load cell
to take average , you can connect it to the other channel : B- & B+
Operation
While taking reading if you find that the reading reduces when you increase
load then just reverse the white and green wires and it will be solved.
Figure:
Author’s Prototype
Calibration
Multiplying factor
Since this load cell comes from China, I don’t know which conversion factor
they use. Therefore, change this factor suitably by putting a known weight on
the load tray first time. Once this is done, next time your machine is through.
See this factor commented in the code section very clearly.
If you look at the load cell, it has strain gauge attached on all three side with
suitable strain relieving frames in-built with the design. Put some thick
washer and then tight it with the base plate and the load plate so that the
strain gauges are free from rubbing with the base plate as well as the load
plate – our weigh machine is ready now.
Figur
e: Fitting details
Look at the screw driver – the body of the load cell is cleared of the base
plate by using two thick washers. So is the top plate (which is a CD here) is
fitted with two thick washers so that the strain gauges fitted on the body of
the load cell does not come in contact of the body. Hard flat plates are best
suitable for this. This load cell is capable of weighing upto 5KG. I’ve checked
with measuring tooth picks (1.7 grams – 4 nos) , plastic tea cup (2.8 grams) to
4.3 KG thick books and each time the same reading appeared. I must say the
machine has got excellent repeatability. The error in the measurement is +-
1gm. For precise measurement put the machine in some place where there
is no air movement like overhead fan etc.
Figure:
Schematic Diagram
The software consists of HX711 header files and the arduino sketch. First add
the library files to the Arduino IDE and then run the sketch. To calibrate the
probe, press the push button once.
To reduce the number of reading to take for averaging change the following
script.