ARDUINO HX711 Weighing Sensors ADC Module User Manual
- June 10, 2024
- ARDUINO
Table of Contents
- Application Example with Arduino Uno:
- Programming Arduino UNO to Measure Weight in KG:
- References
- Read User Manual Online (PDF format)
- Download This Manual (PDF format)
- include “HX711.h” //You must have this library in your arduino library folder
- define DOUT 3
- define CLK 2
- include “HX711.h” //You must have this library in your arduino library folder
- define DOUT 3
- define CLK 2
ARDUINO HX711 Weighing Sensors ADC Module User Manual
Application Example with Arduino Uno:
Most Load cell has four wires: red, black, green and white. On HX711 board you will find E+/E-, A+/A- and B+/Bconnections. Connect load cell to HX711 sensor board according to the following table:
HX711 Load Sensor Board | Load Cell Wire |
---|---|
E+ | Red |
E- | Black |
A+ | Green |
A- | White |
B- | Unused |
B+ | Unused |
HX711 Sensor | Arduino Uno |
---|---|
GND | GND |
DT | D3 |
SCK | D2 |
VCC | 5V |
HX711 Module operates at 5V and communication is done using serial SDA and SCK pins.
Where to apply weight on load cell?
You can see a arrow is shown on Load cell. This arrow shows the direction of
force on the load cell. You can make arrangement shown in figure using metal
strips. Attach metal strip on the Load cell using bolts.
Programming Arduino UNO to Measure Weight in KG:
Connect the schematic as shown in Figure 1 above.
In order for this sensor module to work with Arduino boards, we need HX711
Library which can down load from https://github.com/bogde/HX711.
Before HX711 can be used to measure an object weigh accurately, it need to
calibrate first. Below step will show you how to do the calibration.
1 Step: Calibration Sketch
Upload the below sketch to Arduino Uno Board
/* Handson Technology www.handsontec.com
- 29th December 2017
- Load Cell HX711 Module Interface with Arduino to measure weight in Kgs
Arduino
pin
2 -> HX711 CLK
3 -> DOUT
5V -> VCC
GND -> GND
Most any pin on the Arduino Uno will be compatible with DOUT/CLK.
The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.
*/include “HX711.h” //You must have this library in your arduino library folder
define DOUT 3
define CLK 2
HX711 scale(DOUT, CLK);
//Change this calibration factor as per your load cell once it is found you many need to
vary it in thousands
float calibration_factor = -96650; //-106600 worked for my 40Kg max scale setup
//=======================================================================================
// SETUP
//=======================================================================================
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”);
Serial.println(“Press t for tare”);
scale.set_scale();
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);
}
//=======================================================================================
// LOOP
//=======================================================================================
void loop() {
scale.set_scale(calibration_factor); //Adjust to this calibration factor
Serial.print(“Reading: “);
Serial.print(scale.get_units(), 3);
Serial.print(” kg”); //Change this to kg 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
}
}
//======================================================================================
Remove any load from the load sensor. Open up the Serial Monitor. The below window should open showing the module had successfully connected to Arduino Uno.
Place a known weight object on the load cell. In this case the author used a
known weight of 191grams with 10KG Load Cell. The Serial Monitor will display
some weigh figure as shown below:
We need to do calibration here:
- Key in letter ” a, s, d, f ” into the serial monitor command space and hit “Send” button to increase calibration factor by 10, 100, 1000, 10000 respectively
- Key in letter ” z, x, c, v ” into the serial monitor command space and hit “Send” button to decrease calibration factor by 10, 100, 1000, 10000 respectively.
Keep adjusting until the reading shown the actual weight placed on the load cell. Record down the “calibration_factor” value, in this case “-239250” in author’s weigh of 191g reference with 10KG Load Cell. We will need this value to plug into our second sketch for real measurement.
2nd Step: Final Code for Real Weight Measurement
Before upload the sketch, we need to plug in the “calibration factor “obtained
in 1st step:
Upload the below sketch to Arduino Uno Board, after modified the scale factor:
/* Handson Technology www.handsontec.com
- 29th December 2017
- Load Cell HX711 Module Interface with Arduino to measure weight in Kgs
Arduino
pin
2 -> HX711 CLK
3 -> DOUT
5V -> VCC
GND -> GND
Most any pin on the Arduino Uno will be compatible with DOUT/CLK.
The HX711 board can be powered from 2.7V to 5V so the Arduino 5V power should be fine.
*/include “HX711.h” //You must have this library in your arduino library folder
define DOUT 3
define CLK 2
HX711 scale(DOUT, CLK);
//Change this calibration factor as per your load cell once it is found you many need to vary it in thousands
float calibration_factor = -96650; //-106600 worked for my 40Kg max scale setup
//=============================================================================================
// SETUP
//=============================================================================================
void setup() {
Serial.begin(9600);
Serial.println(“Press T to tare”);
scale.set_scale(-239250); //Calibration Factor obtained from first sketch
scale.tare(); //Reset the scale to 0
}
//=============================================================================================
// LOOP
//=============================================================================================
void loop() {
Serial.print(“Weight: “);
Serial.print(scale.get_units(), 3); //Up to 3 decimal points
Serial.println(” kg”); //Change this to kg and re-adjust the calibration factor if you follow lbs
if(Serial.available())
{
char temp = Serial.read();
if(temp == ‘t’ || temp == ‘T’)
scale.tare(); //Reset the scale to zero
}
}
//=============================================================================================
After successfully upload the sketch, open Serial Monitor. The below window
should appear showing the real measurement value:
You can reset the reading to 0.000kg (without load”) by key-in “t”or “T” into
the command space and hit “Send” button. Below display showing the measure
value become 0.000kg.
Place an object onto the load cell, the actual weight should display. Below is
the weight display when place the object of 191grams (used in 1st step for
calibration).
Hooray! you have constructed a weighing scale with accuracy of three decimal point !
References
- Load Cell – 10kg Weighing Sensor, Straight Bar. – HandsOn Tech
- http://handsontec.com/index.php/my-account/lost-password_B/
- GitHub - bogde/HX711: An Arduino library to interface the Avia Semiconductor HX711 24-Bit Analog-to-Digital Converter (ADC) for Weight Scales.
Read User Manual Online (PDF format)
Read User Manual Online (PDF format) >>