Arduino HX711 and Load cell weight measurement and calibration
Table of Contents
Arduino HX711 Description:
Arduino HX711 and Load cell weight measurement and calibration- In this Tutorial, you will learn how to use a 5kg load cell with HX711 and Arduino Uno or mega. In this tutorial, you will also learn how to calibrate your load cell or strain gauge, Circuit diagram, Soldering, Programming, and practical implementation. A few days back I posted a tutorial covering the basics of hx711 and load cell or Strain Gauge. If you want to learn the very basics then you should read my latest article.
I posted an IoT version “DIY IoT Weighing Scale using HX711 Load Cell, Nodemcu ESP8266, & Arduino
Recently, I posted another article on HX711 and Load Cell based on the ESP32 module. This time I didn’t use Arduino, it did it only using the ESP32 Module. The ESP32 version is the most accurate version and I highly recommend you should read this article. ESP32 and HX711 based Weighing Scale.
Amazon Links:
Arduino Nano USB-C Type (Recommended)
HX711 Load cell / Strain Gauge:
*Disclosure: These are affiliate links. As an Amazon Associate I earn from qualifying purchases
HX711 Breakout board:
Hx711 has different gain values which are selectable 32, 64, and 128. Any of the mentioned gains can be selected and used in the programming.
Hx711, the hx711 is a 24 bit analog to digital converter “ADC”. Which has an amplifier, which gives a maximum gain of 128 as per the datasheet. As you can see on the right side we have ground, DT, Sck, and Vcc. While on the left side we have E+, E-, A-, A+, B-, and B+. The load cell will be connected with E+, E-, A-, and A+. Gnd will be connected with the Arduino’s ground, Dt will be connected with pin3, sck with pin2, and VCC with 5v…. these are the male headers that will be soldered with the breakout board, then using male to female type jumpers we can easily connect this with Arduino.
About Load Cell:
HX711, Load cell / Strain Gauge and Arduino Uno to measure Weight | Arduino HX711 and Load cell
Load Cell Definition:
A load cell or a Strain Gauge is basically a Transducer which generates an electrical signal whose magnitude is proportional to the force applied. The various load cell types include Pneumatic, Hydraulic, and strain gauge.
Hx711 and Load cell Interfacing with Arduino, Circuit Diagram:
Arduino HX711 and Load cell
HX711 Arduino Programming:
Arduino HX711 and Load cell
Before you Start the Programming, first of all, make sure you download the necessary library. The HX711 library can be downloaded from the GitHub, the download link is given below.
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 |
#include "HX711.h" #define DOUT 3 #define CLK 2 HX711 scale(DOUT, CLK); float weight; float calibration_factor = 419640; // for me this value works just perfect 419640 void setup() { Serial.begin(9600); Serial.println("HX711 calibration sketch"); Serial.println("Remove all weight from scale"); Serial.println("After readings begin, place known weight on scale"); Serial.println("Press + or a to increase calibration factor"); Serial.println("Press - or z to decrease calibration factor"); 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); } void loop() { scale.set_scale(calibration_factor); //Adjust to this calibration factor Serial.print("Reading: "); weight = scale.get_units(5); //Serial.print(scale.get_units(), 2); // Serial.print(" lbs"); //Change this to kg and re-adjust the calibration factor if you follow SI units like a sane person Serial.print("Kilogram:"); Serial.print( weight); Serial.print(" Kg"); 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; } } |
Arduino: 1.8.10 (Windows 10), Board: “Arduino/Genuino Uno”
sketch_jan19c:4:22: error: no matching function for call to ‘HX711::HX711(int, int)’
HX711 scale(DOUT, CLK);
In file included from C:\Users\kb\Documents\Arduino\sketch_jan19c\sketch_jan19c.ino:1:0:
C:\Users\kb\Documents\Arduino\libraries\HX711-master\src/HX711.h:30:3: note: candidate: HX711::HX711()
HX711();
^~~~~
C:\Users\kb\Documents\Arduino\libraries\HX711-master\src/HX711.h:30:3: note: candidate expects 0 arguments, 2 provided
C:\Users\kb\Documents\Arduino\libraries\HX711-master\src/HX711.h:19:7: note: candidate: constexpr HX711::HX711(const HX711&)
class HX711
C:\Users\kb\Documents\Arduino\libraries\HX711-master\src/HX711.h:19:7: note: candidate expects 1 argument, 2 provided
Multiple libraries were found for “HX711.h”
Used: C:\Users\kb\Documents\Arduino\libraries\HX711-master
Using library HX711-master at version 0.7.3 in folder: C:\Users\kb\Documents\Arduino\libraries\HX711-master
exit status 1
no matching function for call to ‘HX711::HX711(int, int)’
i have very same problem. do you already know how to solved it??
iam have copy ur program and change pin but…tstill getting error my load cell not weigh any thing…….. i just try to different weight comparation but it still write 0 gram , please …… i have tried to 3 diffrent load cell and hx711 modul. but still get this error ,,, iam using node mcu and arduino too