HX711 & Load Cell – How to Use (with examples)

Learn how to use a load cell with the HX711 Load Cell Amplifier. In this post we’ll go over how to use a load cell with the HX711 Load Cell amplifier. We’ll cover the basic, module pin out, how to connect the load cell and the HX711, how to connect to Arduino, how to program in Arduino, and also a HX711 project.

What is a Load Cell?

A load cell is a sensor that measures the force applied to it along a specific direction and converts it to an electrical signal that can be converted to an equivalent force value. There are many types of load cells, in this post we will focus on a Bar-Type Strain Gauge Load Cells. For the load cell shown on the image, you fix one end (via screws) to a fixed object. The other end will be where the force is applied (normally attached to something). Think of this for the example of a small scale (full example further below). One end attached to the base of the scale, and the other end attached to the plate where you place things whose weight you want to measure.

Load Cell

What is the HX711 Load Cell Amplifier?

The HX711 Load Cell Amplifier is a module that is used to take the signal coming from your load cell and convert it into a signal that your Arduino (or similar microcontroller) can take and process. In post we’ll focus on using the HX711 for a single load cell. The HX711 runs on a supply voltage that can range from 2.6V – 5.5V and it must operate in a temperature range of -40deg C (-40deg F) to +85 deg C (185 deg F). Make sure to pay close attention to the recommended excitation voltage for the load cell being used. The load cell I will use for the example project will need a 5V excitation voltage, so that will drive me to select a 5V input voltage for the HX711 (even though the board it self has a range of 2.6V – 5.5V).

HX711

Connecting HX711 and Load Cell to Arduino Nano

From Load Cell to HX711:
Red cable: connected to E+ on HX711
White cable: connected to A- on HX711
Black cable: connected to E- on HX711
Green cable: connected to A+ on HX711

From HX711 to Arduino Nano:
GND: connected to GND on the Arduino Nano
DT: Connected to D4 on the Arduino Nano
SCK: Connected to D5 on the Arduino Nano
VCC: Connected to 5V on the Arduino Nano

HX711 & Load Cell wiring

Load Cell Setup – Leave room!

It is critical when setting up the Bar-Type Strain Gauge Load Cell that you leave enough room for the load cell to bend when subjected to the force that you are trying to measure. The bending induced by such force is what will induce an associated bending strain, which will translate into an electrical signal that goes into the HX711 and the Arduino to be converted into a weight or force. Net, make sure to leave room for the load cell to bend.

Load Cell Setup
Cross section of the simple scale shown as an example for this post.

Example using the HX711 and a 1 Kg Load Cell

I went ahead and designed and 3D printed some parts to put together a simple small scale, so you can easily see a simple application of a load cell with the HX711.

For this example, I am using an 1602 LCD to display the weight measured by the scale. That’s the LCD screen you see in the images above. I am also showing a cross sectional view of the scale so you understand how the load cell is setup (this matches the view shown previously telling you to leave room for the load cell to bend). So now let me show you how the connections will work once we add the 1602 LCD. Also, if you need more info on the 1602 LCD, please read my other post on it –> 1602 LCD – Learn how to use with Arduino.

Connecting HX711, Load Cell, and 1602 LCD to Arduino Nano

We will simply expand from the previously shown diagram by adding the 1602 LCD, setting up for I2C mode, and connecting it to A4 and A5. It is very important to note that pins A4 and A5 can be used as SDA and SCL (respectively) in the Arduino Nano for I2C communication.

HX711 & Load Cell wiring with LCD

Download the Arduino Library

To run the load cell with the HX711 module, you will need to install a specific library. To do so, please go to the Arduino IDE top menu, click on “Sketch”, then go to “Include Library”, the click on “Manage Libraries…”. A pop-up window will show up. On the search bar, type “HX711_ADC” by Olav Kallhovd (see screenshot below to ensure you pick the correct one). Select and then install.

HX711 library

Calibrating the Load Cell

Use the code below to calibrate your load cell. Remember to open the Serial Monitor and set it to 57600 (consistent with what we have on the Arduino code). The whole objective of this code is to tare de load cell, then add a known load / known weight, tell Arduino what that weight is (via Serial Monitor) and then capture those settings as part of the calibration. This can be done by taking note of the calibration constant or saving to EEPROM.

Testing the Load Cell

We will now test the load cell with the LCD. For this we use a different code. Note that for this you will need the LiquidCrystal_I2C library. See my previous post for more info: 1602 LCD with Arduino. The code below will allow you to display the weight measured by your load cell both by displaying on your Serial Monitor (set to 57600) and by displaying the load on the LCD. Note that I did my calibration in grams, so I print the weight in grams in the LCD (meaning I print it as Weight(g): X, where “X” is the load being measured).

Results

Once the calibration is complete and the 2nd Arduino is running, you should be able to see the load cell reading on both the Serial Monitor within Arduino IDE as well as on the 1602 LCD. In the images below I show the load cell with no load applied and with a box weighing ~700 grams on top of it.

Components used in this example

*As an Amazon & Ebay Associate I earn from qualifying purchases.

ComponentLink
Arduino Nanohttps://ebay.us/tqQZBm
Load Cell (1 Kg) + HX711 Load Cell Amplifierhttps://ebay.us/FpZHWR
1602 LCD (with I2C module)https://ebay.us/sofDTP

4 Replies to “HX711 & Load Cell – How to Use (with examples)”

  1. Hello, thanks for the explanation.
    Can you please guide me how to write a code for esp32 to get command signals from a load cell. Eg. (if the weight is less than 300g, send a signal to power a servo motor to turn 180° clockwise . Then once the weight reaches 500g send a signal to power a servo motor to turn 180° clockwise. (the purpose of servo is to open and close a food dispenser opening.)
    Thank you.

  2. Hello, I would like to know what measuring speed is possible to achieve. I would need to measure the load 360x in 20ms. Is it feasible? Thank you for answer.

Leave a Reply

Your email address will not be published. Required fields are marked *