What is the HX711 + Load Cell?
The HX711 is the chip that turns a load cell into a digital scale. A load cell's signal is tiny, a few thousandths of a volt even at full load, far too small for the analog pin on an Arduino or ESP32 to see. The HX711 amplifies that signal up to 128 times and measures it with a 24-bit converter, then hands the result to your board over two ordinary pins.
Pair it with a bar-type load cell and you can build a kitchen scale, a beehive or plant-pot weigher, a filament-spool gauge, a coffee scale with a timer, or a force sensor for a test rig. This page explains how a load cell works, what happens inside the HX711, how to wire and mount it, and how to calibrate it so the numbers mean something. For complete code, follow the Arduino Uno guide or the ESP32 guide.
Specifications
- Chip
- HX711, 24-bit sigma-delta ADC for weigh scales
- Supply voltage
- 2.6 V to 5.5 V
- Supply current
- Under 1.5 mA running, under 1 µA powered down
- Input channels
- Channel A (differential), Channel B (differential)
- Gain
- Channel A: 128 or 64 · Channel B: fixed 32
- Full-scale input (5 V analog supply)
- ±20 mV at gain 128 · ±40 mV at 64 · ±80 mV at 32
- Output data rate
- 10 or 80 samples per second, set by the RATE pin
- Settling time
- 400 ms at 10 SPS, 50 ms at 80 SPS
- Input noise
- 50 nV rms (gain 128, 10 SPS)
- Mains rejection
- Simultaneous 50 Hz and 60 Hz rejection (at 10 SPS)
- Output format
- 24-bit two's complement, 0x800000 to 0x7FFFFF
- Interface
- 2-wire serial: DOUT (DT) and PD_SCK (SCK), any GPIO pins
- Power-down
- PD_SCK held HIGH for more than 60 µs
- Bridge supply
- On-chip regulator (with an external transistor on modules) powers the load cell
- Package
- SOP-16 on a small breakout board
Chip figures from the Avia Semiconductor HX711 datasheet. Breakout boards differ in how the RATE pin and the bridge regulator are wired, so check your board.
Pinout
| Pin | Side | What it does |
|---|---|---|
| VCC | Board | Power, 2.6–5.5 V. Use the same voltage as your board's logic: 5 V for an Uno, 3.3 V for an ESP32 |
| GND | Board | Ground, shared with your board |
| DT (DOUT) | Board | Data out. Goes LOW when a new reading is ready, then shifts out the 24 bits |
| SCK (PD_SCK) | Board | Clock in. Each pulse shifts out one bit; extra pulses choose the next channel and gain; held HIGH it powers the chip down |
| E+ | Load cell | Excitation positive, usually the load cell's red wire |
| E− | Load cell | Excitation negative, usually black |
| A− | Load cell | Signal negative, usually white |
| A+ | Load cell | Signal positive, usually green |
| B+ / B− | Load cell | Channel B input; present on some boards, often left unused |
Load-cell wire colours are a common convention, not a standard. Check the cell's label or datasheet.
Wiring & code
Setting up HX711 + Load Cell with Arduino Uno
Library
HX711 Arduino Library by Bogdan Necula
Library Manager: HX711 Arduino Library
In this guide you'll turn an HX711 and a bar load cell into a working digital scale with an Arduino Uno. You'll go in three steps, each with its own sketch: first check the wiring with raw numbers, then find your scale's calibration factor with a known weight, then build a scale with a tare button.
Every step tells you what the Serial Monitor should show, so you know it's working before moving on. Allow about 45 minutes, most of it for mounting the load cell properly. For how the HX711 and load cells work, see the HX711 overview.
What you need
Arduino Uno R3
- Qty
- 1
- Notes
- Powered from USB
HX711 load cell amplifier board
- Qty
- 1
- Notes
- The common green breakout
Bar load cell (1 kg or 5 kg)
- Qty
- 1
- Notes
- Four wires: red, black, white, green. Pick a range just above your heaviest load
Two small plates or pieces of wood
- Qty
- 2
- Notes
- A base and a weighing platform
M4/M5 screws and spacers
- Qty
- 4 + 2
- Notes
- The cell must bend freely between the plates
A known weight
- Qty
- 1
- Notes
- A 500 g or 1 kg calibration weight, or anything weighed on a kitchen scale
Push button (optional)
- Qty
- 1
- Notes
- Tare button for Step 3
Jumper wires
- Qty
- 4
- Notes
- Female–male for the HX711 header
How it fits together
The load cell's four wires go to the E+, E−, A−, A+ screw terminals or pads on the HX711. The HX711's other side has four header pins for the Arduino Uno: VCC, GND, DT and SCK. DT and SCK are not I²C or SPI; they're a simple two-wire protocol the library handles, so any two digital pins work.
The Uno powers the HX711 from its 5V pin.
Wiring: HX711 and load cell to Arduino Uno
| From | To | Note |
|---|---|---|
| Load cell red | HX711 E+ | Excitation + |
| Load cell black | HX711 E− | Excitation − |
| Load cell white | HX711 A− | Signal − |
| Load cell green | HX711 A+ | Signal + |
| HX711 VCC | Arduino Uno 5V | Power |
| HX711 GND | Arduino Uno GND | Ground |
| HX711 DT | Arduino Uno D3 | Data out |
| HX711 SCK | Arduino Uno D2 | Clock |
| Push button | D4 and GND | Tare (Step 3, optional) |
Load cell colours are a convention, not a standard. If the reading goes down when you add weight, swap white and green.
Wire it up, step by step
- 1Mount the load cell first. Screw one end to the base with a spacer underneath, and the platform to the other end with a spacer on top. The arrow on the cell points in the direction of the load (down).
- 2Connect the load cell's four wires to the HX711: red E+, black E−, white A−, green A+. If your board has solder pads, solder them; loose twisted wires make the reading drift.
- 3Connect the HX711 header: VCC → 5V, GND → GND, DT → D3, SCK → D2.
- 4Optional for Step 3: a push button between D4 and GND for tare.
- 5Connect the Arduino Uno by USB with the scale empty.
Warning
Mounting decides your accuracy. The middle of the bar, where the strain gauges are, must be free to bend. If the cell is screwed flat to a board with no spacers, or the platform touches the base, readings barely change or drift. This causes more "my HX711 doesn't work" problems than wiring does.
Install the library
In Arduino IDE 2, open the Library Manager, search for HX711, and install "HX711 Arduino Library" by Bogdan Necula. Then choose Tools → Board → Arduino Uno and select your port.
Step 1: check the wiring with raw numbers
This sketch prints the HX711's raw 24-bit reading. It doesn't know about grams yet; it just proves the chain works.
// HX711 + Arduino Uno - Step 1: check the wiring with raw readings
// DT -> D3, SCK -> D2, VCC -> 5V, GND -> GND
#include "HX711.h"
const int DT_PIN = 3;
const int SCK_PIN = 2;
HX711 scale;
void setup() {
Serial.begin(9600);
scale.begin(DT_PIN, SCK_PIN); // channel A, gain 128
}
void loop() {
if (scale.wait_ready_timeout(1000)) {
long raw = scale.read_average(5); // average 5 conversions
Serial.print(F("Raw: "));
Serial.println(raw);
} else {
Serial.println(F("HX711 not found - check DT, SCK, VCC and GND"));
}
delay(300);
}Open the Serial Monitor at 9600 baud. You should see a large number that stays roughly steady, then rises when you press on the platform:
Raw: 84213
Raw: 84190
Raw: 84256
Raw: 132877
Raw: 181402
Raw: 84230Reading Step 1
| What you see | What it means |
|---|---|
| Steady number that rises with pressure | Everything works: go to Step 2 |
| Number falls with pressure | Signal wires reversed: swap white and green (or carry on and accept a negative factor) |
| 'HX711 not found' | DT/SCK swapped or not connected, or no power on VCC |
| Number doesn't change at all | Load cell wires not connected, or the cell can't bend |
| Stuck at 8388607 or -8388608 | Input overloaded or a load cell wire is open: check all four |
The empty-scale number can be anything (positive or negative, tens of thousands or more); every cell has its own offset. What matters is that it's steady to within a few hundred counts and that it moves when you press.
Step 2: find your calibration factor
The HX711 gives counts, not grams. The calibration factor is how many counts one gram produces on your cell. This sketch zeroes the scale, then asks you to place a known weight and type its mass.
// HX711 + Arduino Uno - Step 2: find your calibration factor
// Empty the scale, upload, then follow the Serial Monitor (9600 baud).
#include "HX711.h"
HX711 scale;
void setup() {
Serial.begin(9600);
scale.begin(3, 2); // DT = D3, SCK = D2
Serial.println(F("Remove everything from the scale. Taring in 3 s..."));
delay(3000);
scale.tare(20); // zero = average of 20 readings
Serial.println(F("Done. Put a known weight on and type its mass in grams, e.g. 500"));
}
void loop() {
if (Serial.available()) {
float grams = Serial.parseFloat();
if (grams > 0) {
long counts = scale.get_value(20); // reading minus the tare offset
float factor = counts / grams;
Serial.print(F("Counts: "));
Serial.print(counts);
Serial.print(F(" Calibration factor: "));
Serial.println(factor, 2);
Serial.println(F("Copy this number into CAL_FACTOR in the scale sketch."));
}
}
}Remove everything from the scale. Taring in 3 s...
Done. Put a known weight on and type its mass in grams, e.g. 500
Counts: 210340 Calibration factor: 420.68Use a heavy, accurate weight. A 500 g or 1 kg weight gives a better factor than a 50 g one, because errors in the reading become a smaller fraction of the total. A bag of sugar weighed on a kitchen scale works if you don't have a calibration weight. Put it in the middle of the platform.
A factor of a few hundred is typical for a 1 kg cell; a 5 kg cell gives a smaller number. Run the sketch two or three times and use the average.
Step 3: a working scale with a tare button
Put your calibration factor into CAL_FACTOR and upload. The scale zeroes itself at start-up, prints the weight in grams, and re-zeroes whenever you press the button on D4, for example after putting an empty bowl on it.
// HX711 + Arduino Uno - Step 3: a working scale with a tare button
// Tare button between D4 and GND (uses the internal pull-up).
#include "HX711.h"
const int DT_PIN = 3, SCK_PIN = 2, TARE_PIN = 4;
const float CAL_FACTOR = 420.0; // <-- your number from Step 2
const float ZERO_BAND = 0.5; // grams: readings this close to 0 show as 0.0
HX711 scale;
float shown = 0; // smoothed value on screen
void setup() {
Serial.begin(9600);
pinMode(TARE_PIN, INPUT_PULLUP);
scale.begin(DT_PIN, SCK_PIN);
scale.set_scale(CAL_FACTOR);
Serial.println(F("Taring - keep the scale empty..."));
scale.tare(20);
Serial.println(F("Ready."));
}
void loop() {
if (digitalRead(TARE_PIN) == LOW) { // button pressed
Serial.println(F("Tare..."));
scale.tare(20);
shown = 0;
while (digitalRead(TARE_PIN) == LOW) {} // wait for release
}
float grams = scale.get_units(5); // average of 5 readings, in grams
shown = shown * 0.7 + grams * 0.3; // gentle smoothing
if (abs(shown) < ZERO_BAND) shown = 0; // hide tiny drift around zero
Serial.print(F("Weight: "));
Serial.print(shown, 1);
Serial.println(F(" g"));
}How Step 3 works
| Line | What it does |
|---|---|
scale.set_scale(CAL_FACTOR) | Tells the library how many counts make one gram |
scale.tare(20) | Averages 20 readings and stores them as zero |
scale.get_units(5) | Averages 5 readings, subtracts the zero and divides by the factor: grams |
shown * 0.7 + grams * 0.3 | Smooths the display so it settles instead of flickering |
ZERO_BAND | Shows exactly 0.0 when the reading is within ±0.5 g of zero |
Taring - keep the scale empty...
Ready.
Weight: 0.0 g
Weight: 312.4 g
Weight: 499.8 g
Weight: 500.1 gThe HX711 board ships set to 10 readings per second, so each get_units(5) takes about half a second: the display updates twice a second. For a faster response, use fewer readings (get_units(2)) at the cost of more jitter.
Add a display. To make it a real kitchen scale, print shown to an LCD1602 with I²C or an OLED instead of the Serial Monitor.
Getting steady, accurate readings
- Let it warm up. Readings drift for the first minute or two after power-up. Tare after that.
- Load the middle of the platform. A bar cell reads slightly differently depending on where the weight sits.
- Short, twisted load cell wires. The signal is a few millivolts; long loose wires pick up noise.
- Stay below the rating. A 1 kg cell loaded to 2 kg can bend permanently and never read zero again.
- Expect about 0.1 % of full scale. With a 1 kg cell, roughly ±1 g after calibration is realistic for a hobby build.
Troubleshooting
Common problems and fixes
'HX711 not found'
- Likely cause
- DT and SCK swapped, loose header, no power
- Fix
- DT on D3, SCK on D2, VCC on 5V; check the header solder
Weight is negative
- Likely cause
- Signal wires reversed
- Fix
- Swap white and green, or use a negative factor
Reading drifts slowly
- Likely cause
- Warm-up, or the cell rubbing on something
- Fix
- Wait two minutes, re-tare; check the platform only touches the cell
Jumps by several grams
- Likely cause
- Loose wires, vibration, or a long cable
- Fix
- Solder the cell wires, twist them, put the scale on a solid surface
Right with one weight, wrong with another
- Likely cause
- Calibrated with a light or inaccurate weight
- Fix
- Re-calibrate with a heavier, known weight
Never returns to zero
- Likely cause
- Cell overloaded and bent
- Fix
- Replace the cell; choose a higher rating
Frequently asked questions
Can I use different pins?
Yes. DT and SCK can be any digital pins. Change the numbers in scale.begin(DT, SCK).
Do I need to calibrate every time? No. The factor belongs to that load cell and HX711 pair. Write it into the sketch once. You only need to tare (re-zero) at start-up or when you change the container.
How do I use four load cells for a bathroom scale? Four half-bridge cells (three wires each) combine into one full bridge with a small combinator board, then go to one HX711. Calibrate the same way with a heavier known weight.
Why does the library say 24 bits if I only get grams? The HX711's noise is far above its last few bits. The 24-bit range is what lets it read a tiny millivolt signal at all; real resolution is set by noise and the load cell.
What to build next
- Kitchen scale with a display: add an LCD1602 I²C and the tare button.
- Thrust stand: mount a motor on the cell to measure propeller thrust, as in the BLDC ESC guide.
- Plant or water-tank monitor: weigh a pot or a tank to know when to water or refill.
- Wi-Fi version: the ESP32 guide adds a phone page and saves the calibration in flash.








