All articles

    A Digital Scale with an Arduino: the Load Cell and HX711

    How to build a scale with a load cell and an HX711 module: the strain gauge idea and the Wheatstone bridge, load cell types and choosing the capacity, wiring the four wires, HX711 channels, gain and speed, taring and the calibration factor with full code, saving the calibration and a tare button, mechanical mounting, and the faults that make the reading drift.

    Updated 6 min read

    Want to build a kitchen scale, monitor the weight of a water tank, or count parts by their weight? The answer is a load cell with an HX711 module. And the accuracy can reach grams.

    The load cell bends a tiny amount under the weight, and the HX711 measures that change
    The load cell bends a tiny amount under the weight, and the HX711 measures that change

    How does it work?

    A load cell is a piece of aluminium with strain gauges glued to it: resistors whose value changes by a tiny amount when the metal bends. The four resistors are connected as a Wheatstone bridge, so the output is a very small voltage difference (millivolts).

    The four resistors in a diamond: the supply on two corners, and the signal from the other two
    The four resistors in a diamond: the supply on two corners, and the signal from the other two

    Why a bridge? Because the change in resistance is a fraction of a thousandth. If you measured the voltage across a single resistor, the change would be lost next to the large voltage. The bridge subtracts the two halves, so what remains is only the change, and the effect of temperature on the resistors cancels out too.

    That's far too small for the Arduino's ADC to measure. This is where the HX711 comes in:

    • An amplifier + a 24-bit ADC.
    • A speed of 10 or 80 readings per second.
    • It communicates over two pins (DT and SCK).

    In numbers: a 1 kg load cell rated at 1 mV per volt. On a 5 V supply, the maximum output = 5 mV for the whole kilogram. So 1 gram = only 5 µV! The Uno's ordinary ADC has a step of about 5 mV, so it wouldn't see anything.

    Load cell types

    TypeCommon capacityUsed in
    Bar1–20 kgKitchen scales and projects
    Half bridge (3 wires)About 50 kg eachBathroom scales: 4 together
    S-typeTens to hundreds of kgTension and hanging loads

    Choose a capacity a little above the maximum weight. A 5 kg load cell for a kitchen scale is better than a 20 kg one: the smaller one bends more, so the accuracy is higher. But don't approach the limit.

    Wiring

    From the load cellTo the HX711
    Supply +E+
    Supply −E−
    Signal +A+
    Signal −A−

    Colours vary between manufacturers (usually red E+, black E−, and white and green for the signal). If you're not sure, check the datasheet or measure the resistances with a multimeter. If the weight comes out negative, swap A+ and A−.

    Identifying them with a multimeter: measure the resistance between each pair of wires. The supply pair (E+ and E−) and the signal pair (A+ and A−) give about the same value (for example 1000 Ω), and mixed pairs give a lower value (about 750). To tell supply from signal, try it: if the weight doesn't change at all, swap the two pairs.

    And the HX711: VCC and GND, and DT and SCK on any two pins.

    HX711 channels

    • Channel A: gain of 128 (the default) or 64. This is the one you'll usually use.
    • Channel B: gain of 32 only, for a second load cell.
    • Speed: 10 readings per second by default (the RATE pin to ground). 10 is quieter with less noise, and 80 is for things that change quickly.

    The code (the HX711 library)

    #include "HX711.h"
    HX711 scale;
    
    void setup() {
      Serial.begin(9600);
      scale.begin(3, 2);          // DT, SCK
      scale.set_scale(420.0);     // the calibration factor
      scale.tare();               // zero
    }
    
    void loop() {
      Serial.println(scale.get_units(10), 1);  // average of 10 readings
      delay(500);
    }

    Calibration

    1. Start with set_scale() without a number, and run tare() with the scale empty.
    2. Place a known weight (for example 500 g).
    3. Divide the raw reading by 500. That's the calibration factor.
    4. Put it in set_scale() and try other weights.
    void setup() {
      Serial.begin(9600);
      scale.begin(3, 2);
      scale.set_scale();          // no factor
      scale.tare();
      Serial.println("Place 500 g within 10 seconds");
      delay(10000);
      float raw = scale.get_units(20);
      Serial.print("Factor = ");
      Serial.println(raw / 500.0);
    }

    The known weight: anything whose weight is marked and accurate, such as a sealed bag of sugar, or weigh it on a trusted scale. And the closer the weight is to the maximum capacity, the more accurate the factor.

    Save the calibration

    Don't put the number in the code and upload every time. Save it in the EEPROM and read it in setup. And if you want a tare button: when pressed, call scale.tare(), but don't tare on every power-up if the scale always has something on it (such as a tank): save the zero reading too, or if the power goes off with the tank full, it'll treat full as zero.

    Mechanical mounting

    • One end bolted to the base, and the other end carrying the platform.
    • Spacers (washers or small blocks) between the load cell and the base and between it and the platform, so the middle section (with the hole) can bend freely.
    • The platform and base mustn't touch the load cell except at the bolts.

    The reading drifts?

    • The mechanical mounting matters most: one end firmly fixed, the weight on the other end, and not touching anything.
    • The arrow on the load cell must point in the direction of the load.
    • Temperature and air currents affect small weights.
    • Take an average of many readings, and keep the signal wires short and away from motors. See reducing noise.
    • Don't load it beyond its capacity, or it will bend permanently and be ruined.

    Creep: if you leave a constant weight for hours, the reading creeps a little. That's normal in cheap types, and less so in good ones.

    SymptomUsual cause
    The reading is stuck and doesn't changeThe supply and signal pairs are swapped, or DT and SCK are wrong
    The weight is negativeA+ and A− are swapped
    It jumps by a few gramsMechanical mounting, an air current, or a long wire
    It creeps slowlyTemperature or creep
    It returns to a wrong number after power-uptare() at power-up with something on the scale

    FAQ

    Can I build a bathroom scale? Yes, with 4 half-bridge load cells in the corners, and a small combinator module joining them into a full bridge on a single HX711.

    Does it work on 3.3 V with an ESP32? Yes, power the HX711 from 3.3. The output will be a little lower, but calibration compensates.

    Circuits Nerd
    © 2026 Circuits Nerd. All rights reserved.