Overview:
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 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.
If you want to measure the higher weights of more than 10KG, you can check our 40Kg Weighing Scale. You can also make your own IoT Weighing Scale using ESP8266 WiFi Module.
Bill of Materials
For designing Arduino Weighing Machine using Load Cell & HX711 Module we use the following components. Each and every component are described below further.
S.N. | Components | Quantity | |
---|---|---|---|
1 | Arduino UNO Board | 1 | Amazon | AliExpress |
2 | 16x2 LCD Display | 1 | Amazon | AliExpress |
3 | Potentiometer 10K | 1 | Amazon | AliExpress |
4 | Load Cell 10Kg | 1 | Amazon | AliExpress |
5 | HX711 Module | 1 | Amazon | AliExpress |
6 | Push Buttons | 1 | Amazon | AliExpress |
7 | Connecting Wires | 20 | Amazon | AliExpress |
8 | Breadboard | 1 | Amazon | AliExpress |
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.
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:
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:
1 2 3 4 |
- 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.
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:
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 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 the 16*2 LCD.
Source Code for Interfacing HX711 Load Cell with Arduino:
Simply copy this code and upload it to the Arduino board. Make sure to have the same connection as indicated above in the circuit diagram.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
#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(); } |
103 Comments
hi, i want to do same project with you but using 4 hx711 and 20kg load sensor. can you help me for coding?
The same code will work. Just assemble the hardware in parrallel connection.
Hello can I have a code for 200kg weight sensor???
Boa noite! Eu sou técnico de balanças…
Acredito que não precisará mudar o código, pois você irá utilizar as 4 células de carga em paralelo e para uni-las, deverá utilizar uma caixa de junção com 4 trimpots, para ajustar os cantos da balança.
hi alex, im doing same project with you but using 4 hx711 and 4 20kg load sensor. can u help me with the coding?
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
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
What if you want to use other weight, such as 200grams?. What do i need to change in the code?
Ty!
Use 100 gm for calibration. If you wish to use other weights apart from 100gm, the whole code needs editing.
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
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
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. 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.
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
Please modify this same code using mathematical expression by multiplying with some factor using the formula for strain gauge, it should work.
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. :”(
Check the connection once again.The LCD id not didplaying anything bcoz of connection issue only, follow the diagram. Then Upload the code.
tnx for the project also i used your code it works for me but i want to use your code and to print the out put on my computer so i want your help to edit the code to a serial print code please help me
replace lcd.print with Serial.print or add a line serial.print below each lcd line with same instuctions.
it is not working sir….i wanted to print the output on my computer…it’s just showing a blank screen
Don’t forget also the Serial.begin(9600);
tnx for comment it works but i want to use 200kg load cell and the 100g calibrating is not working so please help me on the code or where to change the code?
thank you
hello Alex Newton i need your help i am doing same project but i want to measure water or liquid or measure scale can you please tell me whats the coding can i use your coding or procedure
or may b change any thing in coding please help me
hello Alex Newton sir i am doing same project but i want to measure water, liquid or fuel or petrol like this scale weight, but in litters not kg please tell me procedure or components i am waiting for reply
Simply change g to ml for measuring liquid mass.
and to convert to kg divide the final result in program by 1000.
sir sorry please explain briefly i m new for understand this can you help me more where i can change g to ml section in your coding
can i add density code for measuring fuel or liquid ?????
hi can i know what readcount() will return actually?
I am doing same project same as with you. I am using 3kg load cell from LWBMT, hx711, arduino mega, adapter for supply and LCD to display. I have tried some code like your code, HX711 bodge library, and try to edit both oh them. But, my best resolution is unstable +- 2g. I wanna get stable at least 1g without fluctuation. Can you give me advise what should i do?
You can’t coz it has +-2G resolution
Hi Alex,I built up your project by using a 20kg Load cell and an I2-LCDisplay and it works fine until it gets to calibration.
Display asks for that 100g weight,but nothing happens after putting the weight on it.
Do you have an idea whats going wrong?
Thanks so far!
Check HX711 connection with load cell or arduino. One of the guy was facing the same issue. Later he found he hasn’t soldered one wire. Red colored HX711 and green color hx711 both has different pins.
Hi,I have the green one.After exchanging the green and red cable everythings fine.
Thanks!!
sorry , I meant changing the red and white cable.
can i have a code for 200 kg weight sensor please?
Hi! In getting the actual weight in grams, can you please explain this formula?
w=(((count-sample)/val)-2*((count-sample)/val));
Hello sir, I’m trying to make this project using 1kg load cell and I’ve done all the connections as per your circuit diagram. But still the LCD isn’t showing anything after “Put 100g & wait”. It’s not showing anything new after that even after I put 100g weight for a long time. The “Put 100g & wait” line is not going away either. I’m using the green HX711. Can you help me out?
One more thing, in some previous comments you said that the system needs calibration every time it’s turned on. Is there any way to calibrate it for a long time, or until I want to calibrate it again?
There are two versions of HX711, i.e Red & Green coloured. For green coloured circuit is same. But for red color 1 more extra connection is needed. You might be using red one and missing the connection. Connect vcc and vdd pins together.
Actually I’m using the green one. Do I need to install the HX711 library? And can you help me with the permanent calibration? I mean I don’t want the system to be calibrated every time it’s turned on.
sir it is taking long time for calibrating
Sir, The display shows waiting for calibration and load 100g for only a fraction of a second and it automatically shows weight as 0g irrespective of whether I place any weight or not.
This means either your load cell is damaged.
Or your load cell is shaking and not fixed properly.(maximum chance)
Or you have shorted some of the terminals
Sir, the project is working fine but it needs to calibrate every time it’s turned on. Is there any way of permanent calibration? Is it possible to store some value using EEPROM.write(address,value) in any address in the arduino which can be used (using EEPROM.read(address)) to measure the weights instead of calibration when the next time the system is turned on?
This can be done by modifying code and using eprom function to store value initially for calibration. You may try.
Sir when i put 100gm weight, the weight in display keep changing between 95-107. It doesn’t not show a fixed value.
Sir after putting 100gm weight, the LCD is showing various weight 95-107gm continuosly. What might be the issue?
This happens if card board is not properly fixed on load cell or if it is not moving or if it has movable parts.
Next thing don’t use the load cell in a room with fan or any other force bcoz fan air effects the mass.
I have a problem in my program is giving continuous error message LCD problem
please publish Hex code on this page
Problem got an error code on line 6 #define sw 9 ? how do I fix this?/
Can anyone help??
hello sir..i have a problem..When it says to put 100g & wait I put 100g on but nothing happens, it doesnt go forward to calibration..can you please help me?
hello sir..i have a problem..when it say to put on 100g % wait i put 100g on but nothing happens, it doesnt go forward to calibrating …can you please help me
hello sir..i have a problem..When it says to put 100g & wait I put 100g on but nothing happens, it doesnot go forward to calibration..can you please help me?
Check connection
Can i have the proteus library files for HX711 and the load cell sensor
can i have the proteus library files for HX7111 and the load cell sensor
Hi Alex, do you have c language program for hx711 with load cell?
This program is itself a C language program
Can i use this program in PIC16F887?
No u can’t this program is compitible to Avr microcontroller, i.e ATmega328
Sir i am using arduino mega
Processor is ATMega2560
Would it work?
hello, how can i download the Load Cell & HX711 library for proteus,I can not find anywhere
When put 100g on The load cell that showed me( -1g) what happen.
I want to knowed when I put 100g weight on load cell on. it showed -1g on lcd. What happen
i want to store calibration values in eeprom. so that i wont have to calibrate on every power on.
which variable will be stored in EEPROM for this ?
pinMode(DT, OUTPUT);
digitalWrite(DT,HIGH);
digitalWrite(SCK,LOW);
Count=0;
pinMode(DT, INPUT);
while(digitalRead(DT)); Can you please say why did you first set DT pin as outpin pin and made it high, and then you made it as input pin? and reading the status of pin
Hi alex, Can you explain the algorithm for coding….
I have carried out the tests with several load cells and the code does not work
I have carried out the tests with several load cells and the code does not work
val=val/100.0; // put here your calibrating weight
who we can put our weight in your equation exactly ?
i think i miss things in calibration part , i don’t know what can be
hello sir
i m new n i have practice same your project but i don’t use LCD i just print output on computer than please tell me
i add this code or not … or where i change serial.printl() ????
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();
}
}
Hello Sir, My LCD Stuck At “Calibrating… Please Wait…” know why?
Sir, I want to get 4 outputs with defined weight range e.g. 100-120g output led-1; 120-200g output led-2 and so on. Please guide me to add the code.
secondly, is it possible to avoid calibration to 100 g and reset the machine to ZERO by pushing a button as it is available in all general machines.
holaa en el codigo me marca un error en el apartado vacio calibrar () a que se debe este error
Hey man I have a question, is it possible to change the value of the calibrating weight? can I add 50g instead of 100g to calibrate the scale? and if I change the calibrating mass, what segments of the code should I change?
Thank you in advance
hey i need to make talking weighing machine with ardunio and hx711 please provide me come for ardunio to speaker please please please
Hello I’m new in this hx711, I know you use a 20kg load cell and i want to know that does it work on a 3kg? Should there a need to change of a 20kg to 3kg from the code?
The same code will for for 20kg load cell too. You don’t need to change anything.
Jó napot ! Kell e a kódon változtatni ha én 200Kg szenzort használok ?
while verifying this code is gives error ” A1 was declared in this scope”
Que peso hay que tomar en cuenta de la base de la bazcula.? Antes de añadir los 100 g
It is stuck at “Put 100g and wait”. Can you tell me any solution?
Is it necessary to make a stand on weight sensor
Will it work without it atleast for testing purposes
It will work but the result are not accurate.
Hey Alex we want the code for 200 kg weight sensor why are you not responding for this ? If u do then pls tell me where u replaied
sir i want to control a dc motor via load cell can you help me with that
Hello, I use an Arduino r3 and a 10 kg load cell. Do I need to change anything in the code?
Hello, I use an Arduino r3 ATMEGA 16U2 and a 10 kg load cell. Do I need to change anything in the code?
Hello, Instead of using LCD i need to send the same data to cloud. I have seen several videos but in coding part i am stuck. Can you please suggest me how to move forward? Thanks
There is already another post related to Sending the data to the Cloud. Check here: IOT Weighing Scale with HX711 Load Cell & ESP8266.
have u solved it? because i got the same problem 😦
Hi ! can I used your project for 500gms ( max. ) graduation 0.50 gms weighing machine ? Thank you very much
Hi, I assembled the load cell but the values are fluctuating after I removed my 100g load. Can you help me?
Dear, I have one doubt. I studied many posts regarding the use of HX711. In some video people used A0 , A1 (i.e. analog pins) for Dout and CLK( SCK), and somewhere they used D4 and D5 digital pins.. Can you explain this part.
The Dout & Clk are the digital input pins. You can use any Arduino pins like D4, D5, A0,A1. The analog pin of arduino like A0,A1, A2,…… can be used as digital pins as it has internal ADC.
can i use 5kh load cell same for this code?
and one more issue , i used i2c crystal led display and it shows only boxes not numbers or value , can uh help me to solve this problem?
Hello Sir, i have three questions,
What do you mean in the code by the statement ‘ val=val/100.0;
val=val/100.0; // put here your calibrating weight
How do i perform the calibration.
i want to interface this project with GSM such that am notify by SMS alert when the weight reaches a certain value.
PLEASE URGENT ATTENTION NEEDED. Thanks in advance
Hello dear. I want to use 199 g load cell. Will the same circuit and code do well? Thanks
sorry, 100 g load cell
i am using a 100g load cell, and it is not working, can you help me
Hai, my name is Habeeb.
I am working on the weighing scale project. here in my project I have used 4 load cells of 50kg each. I have made all the connections interfacing HX711 with Arduino Uno along with LCD (16×2). I have tried many codes for getting output but couldn’t get it. The issue I am facing here is every time I need to calibrate the scale, after that when I place the loads it’s fluctuating and after removing the load its not getting back to zero. can you please tell what code should I use to solve this.
Hi. i want to activate the ledpin or other led when it reaches certain threshold, can i do it?
Hello sir, I want make project like this but use mathlab simulink, can yo help me?
i am also working on four load cells will you guide me plz bro