HX711 Load Cell with ESP32, ESPHome and Home Assistant

Build an ESP32 load-cell scale with HX711, ESPHome and Home Assistant. Covers wiring, calibration, tare, filtering, drift and reliable mechanical mounting.

The HX711 is one of the easiest ways to connect a strain-gauge load cell to an ESP32. It combines a low-noise programmable-gain amplifier with a 24-bit delta-sigma ADC designed specifically for weigh scales and bridge sensors.

With ESPHome, the ESP32 can read the HX711 directly, convert the raw counts into kilograms, grams or another engineering unit, filter the measurement and expose the result to Home Assistant.

The electronics are simple. The difficult part is usually everything around them: identifying the load-cell wires, building a complete Wheatstone bridge, mounting the cell correctly, calibrating it with known weights and preventing temperature drift or mechanical side loads from ruining the result.

What You Need

ItemPurpose
ESP32 development boardRuns ESPHome and connects the scale to Home Assistant
HX711 breakout moduleAmplifies the bridge signal and converts it to a digital value
Load cellConverts force/weight into a tiny differential voltage
Stable mounting hardwareAllows the load cell to flex in the intended direction
Known calibration weightMaps raw HX711 counts to kilograms or grams
Optional junction/combinator boardUseful with four half-bridge load cells

How the Load Cell and HX711 Work Together

A strain-gauge load cell is normally wired as a Wheatstone bridge. The HX711 excites the bridge and measures the tiny differential voltage produced when the load cell bends.

HX711 excitation
E+ ───────────────┐
                  │
             Wheatstone bridge
                  │
E- ───────────────┘

Bridge signal:
A+ ───────────────┐
                  ├── tiny differential voltage
A- ───────────────┘
                  │
                  ▼
              HX711 ADC
                  │
                  ▼
                ESP32

The bridge output is usually only a few millivolts at full load. That is why an ordinary ESP32 ADC input is not the right interface. The HX711 provides the high gain and differential measurement required for this small signal.

HX711 at a Glance

FeatureHX711
ADC type24-bit delta-sigma
InputsTwo differential channels
Channel A gain128 or 64
Channel B gain32
Output data rate10 or 80 samples/s depending on RATE pin
Supply range2.6–5.5 V
Digital interfaceDOUT + PD_SCK, not I²C or SPI
Typical useWeigh scales and bridge sensors
Native ESPHome supportYes

ESPHome supports gain values 128, 64 and 32. Gain 128 is the normal starting point for most load-cell applications because the bridge signal is extremely small.

HX711 Wiring to ESP32

The ESPHome documentation recommends powering a typical HX711 module from 3.3 V when using an ESP32. This keeps the digital interface safely inside ESP32 logic levels.

ESP32                HX711

3.3V  -------------- VCC
GND   -------------- GND
GPIO18 ------------- DT / DOUT
GPIO19 ------------- SCK / CLK

HX711 load-cell side:

E+  ---------------- Load cell excitation +
E-  ---------------- Load cell excitation -
A+  ---------------- Load cell signal +
A-  ---------------- Load cell signal -

GPIO18 and GPIO19 are only examples. The HX711 does not require the ESP32 hardware SPI peripheral; DOUT and CLK can be placed on ordinary suitable GPIOs.

Do Not Trust Load-Cell Wire Colours Blindly

Four-wire load cells are often sold with red, black, white and green wires, but the colour assignment is not universal. Different manufacturers use different conventions.

A typical four-wire cell has two excitation wires and two signal wires:

  • E+ or EXC+ — bridge excitation positive.
  • E- or EXC− — bridge excitation negative.
  • A+ or SIG+ — differential signal positive.
  • A- or SIG− — differential signal negative.

Use the load-cell datasheet when available. If the documentation is missing, identify the bridge pairs with a multimeter rather than copying a random colour diagram from another module.

How to Identify a Four-Wire Load Cell with a Multimeter

A full-bridge load cell contains four strain-gauge resistive elements. Resistance measurements can help identify which wires belong to the excitation pair and which belong to the signal pair.

The exact resistance depends on the load cell—350 Ω and 1 kΩ bridge families are common—so there is no universal resistance number to search for.

  • Measure all wire-pair combinations with the cell disconnected.
  • Look for the pair relationships expected from a Wheatstone bridge.
  • Compare the results with any manufacturer drawing or markings.
  • Once connected, apply a small known load and verify that the raw HX711 value changes smoothly.
  • If the weight moves in the negative direction, swap A+ and A− or simply calibrate with a negative slope.

Four-Wire Full-Bridge vs Three-Wire Half-Bridge Cells

Not every device sold as a load cell is a complete bridge.

Load-cell typeWiresCan connect directly to HX711?
Full-bridge load cellUsually 4 or 6Yes
Half-bridge load sensorOften 3Not alone; another half bridge is required
Four bathroom-scale sensorsUsually 3 wires eachYes after combining into one full bridge

A common bathroom scale uses four three-wire sensors, one at each corner. Each sensor is only part of the bridge. The four sensors must be connected through the correct bridge arrangement or a load-cell combinator board before feeding A+/A− and E+/E− into the HX711.

Why One Three-Wire Bathroom-Scale Sensor Does Not Work by Itself

A three-wire bathroom-scale sensor is usually a half bridge. It needs another half bridge to produce a complete differential Wheatstone bridge.

Half bridge #1 + half bridge #2
              │
              ▼
       complete Wheatstone bridge
              │
              ▼
             HX711

Trying to wire one three-wire sensor directly as though it were a four-wire load cell often produces unstable, saturated or almost motionless readings.

Mechanical Mounting Is More Important Than It Looks

A perfectly wired load cell can still produce poor results if it is mounted incorrectly. The sensor is designed to bend in a specific way.

  • Bolt the fixed end to a rigid structure.
  • Apply the force to the intended loading end or platform.
  • Follow the arrow or loading-direction marking where provided.
  • Avoid twisting the cell.
  • Avoid side loads and off-axis forces.
  • Do not let the moving end touch the fixed frame.
  • Do not use the load cell as a structural stop beyond its rated capacity.

Single-point aluminium load cells often have one end marked for mounting and the other end for the weighing platform. If both ends are clamped rigidly, the cell cannot deform properly and calibration becomes meaningless.

Protect the Cell from Overload

A 20 kg load cell is not a 20 kg mechanical safety component. Shock loads can greatly exceed the static weight of the object.

A 10 kg object dropped onto a scale can momentarily apply much more than 10 kg equivalent force. Good mechanical designs include overload stops that prevent the cell from bending far enough to be permanently damaged.

Basic ESPHome HX711 Configuration

sensor:
  - platform: hx711
    name: "HX711 Raw"
    id: hx711_raw
    dout_pin: GPIO18
    clk_pin: GPIO19
    gain: 128
    update_interval: 1s

At this stage, do not worry about kilograms. Watch the ESPHome logs and confirm that the raw value is reasonably stable at zero load and changes consistently when weight is applied.

The Raw Number Is Supposed to Look Meaningless

A raw HX711 result might look like this:

No load:
-845320

5 kg:
-1267180

10 kg:
-1688240

Those values are not grams or millivolts. They are ADC counts. Calibration converts them into a useful unit.

Two-Point Calibration with ESPHome

ESPHome’s current HX711 documentation recommends the calibrate_linear filter.

First record the raw reading with the platform empty. Then place an accurately known calibration mass on the scale and record the new raw value.

Example readings:

empty scale:
-845320

known 5.000 kg mass:
-1267180

Then map the raw values to the corresponding real weights:

sensor:
  - platform: hx711
    name: "Scale Weight"
    dout_pin: GPIO18
    clk_pin: GPIO19
    gain: 128
    update_interval: 1s

    filters:
      - calibrate_linear:
          - -845320 -> 0.0
          - -1267180 -> 5.0

    unit_of_measurement: kg
    accuracy_decimals: 2

The slope can be positive or negative. If the raw count becomes more negative as weight is added, ESPHome can still calibrate it correctly.

Use More Than Two Calibration Points When Accuracy Matters

Two points define a straight line, which is adequate for many DIY scales. For a more serious build, test several known loads across the useful range.

0 kg   → -845320
2 kg   → -1013900
5 kg   → -1267180
8 kg   → -1519300
10 kg  → -1688240

If the errors grow significantly at the middle or top of the range, the problem is often mechanical rather than mathematical: platform flex, off-axis load, poor mounting, overload damage or a badly combined multi-cell bridge.

Tare Is Not the Same as Calibration

Calibration defines how many raw counts correspond to a real weight. Tare removes the current zero offset caused by an empty container, platform or tray.

Calibration:
raw counts → kg

Tare:
current platform/container weight → new zero

For a fixed Home Assistant installation such as a gas-cylinder monitor, pet-food bin or beehive scale, it is often better to calibrate the full mechanical assembly and include the empty-platform offset in the calibration rather than adding frequent automatic tare logic.

Do Not Automatically Tare at Every Boot

Automatic boot-time tare sounds convenient but can create serious errors.

If the ESP32 restarts while a 5 kg object is sitting on the scale and the firmware declares that reading to be zero, every subsequent measurement will be wrong by 5 kg.

For unattended systems, retain a fixed calibrated zero or require an intentional manual tare operation when you know the scale is empty.

Filtering a Noisy Scale

Load-cell signals are small enough that mechanical vibration, power-supply noise and temperature drift all appear in the reading.

For a slowly changing Home Assistant scale, median and moving-average filters are useful.

sensor:
  - platform: hx711
    name: "Scale Weight"
    dout_pin: GPIO18
    clk_pin: GPIO19
    gain: 128
    update_interval: 500ms

    filters:
      - median:
          window_size: 5
          send_every: 3
          send_first_at: 3

      - calibrate_linear:
          - -845320 -> 0.0
          - -1267180 -> 5.0

      - sliding_window_moving_average:
          window_size: 5
          send_every: 1

    unit_of_measurement: kg
    accuracy_decimals: 2

The median filter rejects one-off spikes. The moving average then smooths the remaining measurement. Do not use huge windows if the application needs a fast response.

Filter Before or After Calibration?

For linear calibration, filtering raw counts or calibrated kilograms produces the same basic trend, but filtering the raw HX711 signal first is useful when obvious electrical spikes are present.

A practical chain is: reject outliers, convert raw counts into engineering units, then apply gentle smoothing if the displayed weight still moves too much.

HX711 10 SPS vs 80 SPS

The HX711 supports two internal output rates: 10 samples per second and 80 samples per second. The RATE pin on the HX711 selects the mode.

Many inexpensive breakout boards hard-wire RATE for 10 SPS because that mode gives better 50/60 Hz mains rejection and is ideal for weighing.

ModeBest use
10 SPSNormal scales, stable Home Assistant measurement, better mains rejection
80 SPSFaster force changes or control applications where latency matters more

ESPHome’s update_interval controls how often it publishes/reads the sensor at the application level. It does not magically change a breakout board from 10 SPS to 80 SPS.

Why a 24-Bit ADC Does Not Give 24 Bits of Real Scale Resolution

The HX711 data word is 24 bits wide, but noise, bridge sensitivity, gain, power supply, mechanical vibration and thermal drift reduce the number of useful stable bits.

A 20 kg load cell will not become a laboratory microgram balance just because the converter says ’24-bit’.

The effective resolution of the finished scale must be measured from the noise and repeatability of the complete mechanical system.

Temperature Drift

Load cells and their strain gauges change slightly with temperature. The mechanical frame also expands and contracts, which can change the zero reading.

  • Allow the scale to warm up before precision calibration.
  • Keep the HX711 and load cell away from direct sun or hot electronics.
  • Do not mount one side of the load cell against a heat source.
  • Record zero drift over several hours before deciding how many decimal places are meaningful.
  • For outdoor scales, expect temperature compensation or periodic correction to be necessary if high absolute accuracy is required.

Power Supply Noise

The HX711 is designed for low-level bridge signals, so a noisy supply can become visible in the weight reading.

  • Power the HX711 from a clean 3.3 V rail.
  • Keep the HX711 physically close to the load cell where practical.
  • Avoid routing load-cell signal wires beside relays, motors and switching power cables.
  • Use twisted pairs for long bridge wiring.
  • Keep DOUT and CLK wiring reasonably short.
  • Do not share flimsy breadboard contacts with high-current loads.

Long Load-Cell Cables

Six-wire industrial load cells often add two sense wires in addition to excitation and signal pairs. The sense leads allow suitable instrumentation to compensate for voltage drop in long excitation cables.

Typical hobby HX711 breakouts expose only the simple four-wire bridge interface. For a long cable in a high-accuracy installation, use a load cell and interface designed for remote sensing rather than assuming a basic four-wire hobby module will maintain calibration.

Home Assistant Use Cases

  • Gas-cylinder remaining weight.
  • Water or chemical container weight.
  • Pet-food or grain-bin level by mass.
  • Beehive weight monitoring.
  • Coffee-bean hopper.
  • Laundry detergent container.
  • Propane/LPG bottle monitoring.
  • Force or occupancy detection under a platform.

For container monitoring, weight can often be more reliable than ultrasonic level because foam, irregular vessel shape or internal obstructions do not affect the measurement.

Calculate Remaining Percentage

Once Home Assistant receives kilograms, a template sensor can convert the weight into remaining contents.

template:
  - sensor:
      - name: "Gas Bottle Remaining"
        unit_of_measurement: "%"
        state: >
          {% set gross = states('sensor.scale_weight') | float(0) %}
          {% set tare = 12.0 %}
          {% set full_gas = 13.0 %}
          {% set contents = gross - tare %}
          {{ [[contents / full_gas * 100, 0] | max, 100] | min | round(0) }}

In this example, 12 kg is the empty cylinder tare weight and 13 kg is the rated gas content. Use the real values stamped on your cylinder or measured during calibration.

Create a Low-Weight Alert

automation:
  - alias: Gas bottle low
    triggers:
      - trigger: numeric_state
        entity_id: sensor.gas_bottle_remaining
        below: 15

    actions:
      - action: notify.send_message
        target:
          entity_id: notify.my_device
        data:
          message: "Gas bottle is below 15% remaining."

A slow-changing weight system is ideal for Home Assistant because one measurement every few seconds is normally more than enough.

Single-Point Load Cell vs Four Corner Sensors

DesignAdvantagesDisadvantages
Single-point cellSimple wiring, easy calibration, good for one platformNeeds correct mechanical mounting
Four corner cellsSupports large platform and bathroom-scale constructionBridge wiring and corner matching are more complex
S-beam / tension cellGood for hanging loads and force measurementMechanical fittings are more specialised

For a first ESP32 scale, a single four-wire full-bridge load cell is much easier to debug than four salvaged bathroom-scale sensors.

Common Problem: Raw Value Does Not Change

  • Load cell is wired incorrectly.
  • A three-wire half bridge is being used alone.
  • A+ and A− are connected to the wrong pair.
  • The load cell is mechanically clamped so it cannot flex.
  • The wrong HX711 channel/gain has been selected.
  • The load is not applied in the load cell’s intended direction.

Common Problem: Reading Is Stable but Completely Wrong

  • Calibration values were copied from somebody else’s scale.
  • The known calibration weight is inaccurate.
  • The platform weight changed after calibration.
  • The load cell is being overloaded or side-loaded.
  • The bridge supply or wiring changed after calibration.

Every mechanical assembly needs its own calibration. There is no universal HX711 calibration factor for a 5 kg, 20 kg or 50 kg load cell.

Common Problem: Weight Changes Depending on Where the Object Is Placed

That is usually a mechanical problem.

A proper single-point load cell is designed to tolerate some off-centre loading within its specified platform size. A poor mounting arrangement or a four-sensor platform with badly matched corner cells can show large corner errors.

Test the same known weight at the centre and at each corner. If the result changes substantially, fix the mechanics before adding more software calibration.

Common Problem: Zero Drifts Slowly

  • Load cell is warming up.
  • Mechanical frame is settling.
  • Temperature is changing.
  • Cables are pulling on the load cell.
  • Platform is touching a wall or enclosure.
  • Power supply is drifting.
  • The load cell was previously overloaded.

A few counts of movement are normal. Kilograms of apparent drift are not.

Common Problem: Reading Jumps When Wi-Fi Transmits

If ESP32 radio activity visibly changes the HX711 reading, improve power distribution and physical layout.

  • Use local decoupling at the HX711.
  • Keep load-cell signal wires away from the ESP32 antenna.
  • Avoid powering motors/relays from the same weak 3.3 V regulator.
  • Twist A+/A− and E+/E− pairs where practical.
  • Use filtering only after fixing obvious electrical noise.

Do Not Use HX711 for Safety-Critical Weighing Without Proper Engineering

A hobby ESP32/HX711 scale is excellent for monitoring, automation and experimentation. It is not automatically a legally approved trade scale, overload safety device or process-protection instrument.

If a wrong weight reading could cause injury, overfilling, structural overload or hazardous dosing, use appropriately rated industrial weighing hardware and independent safety limits.

Recommended Build Sequence

  • Start with one full-bridge four-wire load cell.
  • Verify E+/E− and A+/A− wiring.
  • Read raw HX711 values in ESPHome.
  • Confirm the raw count changes smoothly with load.
  • Fix the mechanical mounting before calibration.
  • Record empty and known-weight raw values.
  • Add calibrate_linear.
  • Test several weights across the useful range.
  • Add median/moving-average filtering only if needed.
  • Finally expose alarms, percentage or inventory calculations in Home Assistant.

Final Recommendation

For ESP32 and Home Assistant projects, the HX711 remains the simplest practical interface for ordinary strain-gauge load cells. ESPHome’s native component removes almost all software complexity: two GPIOs, a gain setting and a calibration filter are enough to publish a real weight.

The part that deserves the most attention is the load cell and mechanics. Use a complete Wheatstone bridge, mount the cell so it can flex correctly, avoid side loads, calibrate the actual finished platform and do not mistake 24-bit output width for 24-bit real-world accuracy.

For a first project, use a single four-wire full-bridge load cell. Once that is stable and repeatable, moving to four bathroom-scale sensors, outdoor beehive scales or container inventory monitoring becomes much easier.

Related ESP32 Guides

Datasheets and External Resources

Share your love