How Do You Interface a Load Cell to a Microcontroller with the HX711?
Last updated 6 July 2026 · 9 min read
Direct Answer
A load cell is a Wheatstone bridge strain gauge that outputs only a few millivolts per volt of excitation — far too small and too noisy for a general-purpose MCU ADC to read directly. The HX711 is a purpose-built 24-bit sigma-delta ADC with a built-in programmable-gain instrumentation amplifier (gain of 128 or 64 on channel A, 32 on channel B) and bridge excitation output, designed specifically for load cells and similar bridge sensors. Wiring is straightforward — the load cell's four bridge wires (E+, E-, A+/S+, A-/S-) connect directly to the HX711's excitation and differential input pins — and the host reads data over a simple two-wire clock/data protocol (not I2C or SPI) that any GPIO pair can bit-bang. The remaining work is in firmware: applying a tare (zero-offset) reading at startup and a scale factor derived from a known calibration weight, since the HX711 outputs a raw 24-bit ADC code, not a weight in grams or kilograms.
Detailed Explanation
Load cells are one of the most common sensors an embedded engineer encounters outside the usual I2C/SPI digital-sensor world, because the sensor itself is a purely passive analog element — a Wheatstone bridge of four strain gauges bonded to a metal structure that flexes microscopically under load. Reading it accurately depends on getting the analog front end right before firmware ever sees a number, which is why a dedicated bridge ADC like the HX711 dominates hobbyist and small-scale commercial designs over trying to read the bridge with an MCU's own ADC.
Why a Load Cell Needs a Dedicated ADC
A typical load cell's full-scale output is specified in mV/V — millivolts of differential output per volt of excitation, commonly in the range of 1–3 mV/V depending on the cell (check the specific load cell's datasheet; this varies by manufacturer and construction). At a typical 5 V excitation, that's only a few millivolts to tens of millivolts across the cell's entire rated capacity — a signal level that:
- Sits on a common-mode voltage of roughly half the excitation voltage, which a standard single-ended ADC input can't reject (see what is an instrumentation amplifier? for why a differential bridge signal needs this kind of front end).
- Needs 16 bits of resolution or more to resolve useful weight increments across the cell's full range, since the raw signal is so small relative to any full-scale ADC reference.
- Is easily swamped by noise from a general-purpose MCU's ADC, which typically shares a supply and PCB area with digital switching activity.
The HX711 solves all three problems in a single low-cost IC: it integrates a programmable-gain instrumentation amplifier (gain 128 or 64 selectable on Channel A, fixed gain 32 on Channel B) feeding a 24-bit sigma-delta ADC (see how does a sigma-delta ADC differ from a SAR ADC? for the general architecture), plus a regulated excitation source for the bridge itself — everything needed to read a load cell directly, with no external op-amp stage required.
Wiring the Bridge to the HX711
A standard 4-wire load cell has exactly the connections the HX711 expects:
| Load cell wire | Function | HX711 pin |
|---|---|---|
| Red (typically) | Excitation+ | E+ |
| Black (typically) | Excitation− | E− |
| White or green (typically) | Signal+ | A+ (or B+) |
| Green or white (typically) | Signal− | A− (or B−) |
Wire colour conventions vary between manufacturers — always verify against the specific load cell's datasheet rather than assuming a universal colour code. The HX711 generates the bridge excitation itself from its own supply, so no external excitation source or reference is needed. Keep the four bridge wires as a single twisted or shielded cable run where the load cell is any distance from the HX711 board — the differential signal is small enough that noise picked up asymmetrically between the two signal wires shows up directly as a weight reading error.
The Read Protocol: Not I2C, Not SPI
The HX711 communicates over just two digital lines — PD_SCK (clock, driven by the host) and DOUT (data, driven by the HX711) — using a proprietary bit-banged protocol rather than a standard bus:
- Wait for DOUT to go low, which indicates a new 24-bit conversion result is ready. Because the output rate is fixed at 10 or 80 samples per second (set by a pin strap), the host typically polls DOUT or, better, wires it to an external interrupt pin so firmware isn't burning CPU time in a polling loop between readings.
- Clock out 24 bits, most significant bit first, by pulsing PD_SCK 24 times and sampling DOUT after each rising edge.
- Clock 1, 2, or 3 additional pulses beyond the 24 data bits to select the gain and channel for the next conversion (25 pulses = Channel A, gain 128; 26 pulses = Channel B, gain 32; 27 pulses = Channel A, gain 64) — this is the HX711's only configuration mechanism; there is no register interface.
- Convert the 24-bit two's-complement result to a signed integer in firmware.
Because this protocol is timing-sensitive (the datasheet specifies minimum and maximum PD_SCK pulse widths, and holding PD_SCK high for longer than the specified threshold puts the chip into power-down mode), it's normally implemented as a tight bit-bang routine with interrupts disabled during the 24–27 clock pulses, rather than through a general-purpose bus peripheral. Widely used open-source libraries (for Arduino, ESP-IDF, and other platforms) implement this correctly and are the practical starting point rather than re-deriving the bit-banging from the datasheet timing diagram alone.
Tare and Calibration
The HX711's raw output is a signed 24-bit ADC code with no inherent relationship to a physical unit — converting it to grams or kilograms is a two-step firmware calibration, not a fixed formula:
- Tare (zero offset). With no load applied, read and store the raw ADC value. This offset accounts for the bridge's manufacturing imbalance, mounting stress, and any residual offset in the HX711 itself — it must be re-captured any time the mechanical mounting changes, and often at every power-up for a design where the empty-scale condition can be relied on at startup.
- Scale factor (calibration). Place a known reference weight on the load cell, read the raw ADC value, subtract the tare offset, and divide the known weight by that difference to get a scale factor (raw-code-units per gram or kilogram). Every subsequent reading is then
(raw_reading - tare_offset) / scale_factor.
A single-point calibration (one reference weight) is standard practice and sufficiently accurate for the vast majority of hobbyist and light-industrial designs, since load cells are inherently quite linear across their rated range. Multi-point calibration (several known weights spanning the range, fit with linear regression) is worth the extra effort only where the application's accuracy requirement is tight enough to also need drift and non-linearity correction — most designs don't need it.
Averaging and Noise
A single HX711 conversion is noisier than the application usually wants displayed directly — the standard firmware pattern is to take a moving average or median of the last N readings (commonly 5–20, chosen empirically against how much settling time the application can tolerate) before reporting a weight. This is a straightforward software filter, not a hardware change, and trades responsiveness for stability the same way any measurement averaging does.
Zeus Design designs the sensor interfacing and calibration firmware for weighing, force-measurement, and load-monitoring products as part of full-stack electronics and firmware development.
Design Considerations
- Re-tare on every power cycle if the mechanical zero can drift. Temperature changes, mounting stress relaxation, and anything resting on the scale at power-up all shift the true zero point — a design that only tares once at the factory will drift out of calibration in the field. Prompt the user (or automate it) to tare with a known-empty scale at startup where the use case allows it.
- Account for temperature effects on the load cell itself, not just the electronics. Load cells specify a temperature coefficient on both zero (offset drift) and span (gain drift) — for measurement accuracy across a real operating temperature range, check the specific cell's datasheet figures and decide whether firmware-side temperature compensation (using a co-located temperature sensor) is warranted, rather than assuming room-temperature calibration holds everywhere the product ships.
- Choose gain 128 (Channel A) as the default unless the specific application argues otherwise. It's the HX711's highest-gain, most sensitive setting and the one nearly every reference design and library defaults to; Channel B's fixed gain of 32 exists mainly for a second, lower-sensitivity bridge input in dual-sensor designs, not as the primary weighing channel.
- Isolate the load cell cable from motor, switching-supply, and other noisy wiring runs. The bridge signal is small enough that inductively or capacitively coupled noise from a nearby high-current or fast-switching conductor shows up as reading instability that looks like a sensor fault but is actually a wiring/layout problem.
Common Mistakes
- Expecting a raw reading in grams. The most common first-time confusion — the HX711 has no concept of physical units, and every design needs its own tare-and-scale-factor calibration step in firmware, described above.
- Ignoring the gain/channel selection pulses. Forgetting to clock the correct number of extra pulses after the 24 data bits leaves the HX711 configured for the wrong channel or gain on the next conversion, which shows up as an unexpected sensitivity or a reading from the wrong bridge input on a design using both channels.
- Blocking on DOUT with interrupts disabled for too long. Polling DOUT in a tight loop with interrupts disabled, waiting for the next 10 or 80 SPS conversion, can stall other time-critical firmware tasks; wiring DOUT to a GPIO interrupt (falling edge) and reading only when it fires is the more robust pattern.
- Not accounting for mechanical creep and settling time in the physical structure. A load cell mounted in a mechanical assembly (a platform, a hopper, a hanging scale) can show a reading that continues to settle for a second or more after a weight is placed, due to the structure itself flexing into its final position — a firmware read taken too quickly after loading looks like sensor noise but is actually mechanical settling.
- Using a summing junction box with mismatched load cells. Wiring load cells of different rated capacities or from different manufacturers into a shared summing box (see the FAQ on multi-cell wiring) can produce non-linear combined behaviour — use matched cells from the same production batch for multi-cell platforms where accuracy matters.
Frequently Asked Questions
- Why does the HX711 read a raw number instead of grams?
- The HX711 has no knowledge of the load cell's rated capacity, excitation voltage, or the mechanical structure it's mounted in — it only digitises the bridge's differential voltage as a signed 24-bit ADC code. Converting that code to a physical unit (grams, kilograms, newtons) requires a calibration step performed once, in firmware, using a known reference weight; there is no universal raw-code-to-weight formula, because the same load cell wired to a different HX711 board, excitation voltage, or gain setting produces a different raw code for the same physical weight.
- Can I read multiple load cells with one HX711?
- A single HX711 channel reads one bridge input. Multi-load-cell scales (a platform scale on four corner load cells, for example) most commonly wire all four cells into a passive summing junction box first — four identical load cells in parallel present a combined bridge that behaves electrically like one larger bridge — and feed that single combined signal to one HX711. Reading four load cells independently requires either four separate HX711 (or similar) ADCs, or a purpose-built multi-channel weighing IC; four independent 24-bit ADCs is usually unnecessary cost and complexity when a summing junction box solves the same problem passively.
- How fast can the HX711 output new readings?
- The HX711 has two fixed output data rates set by a pin strap: 10 SPS (samples per second) or 80 SPS. There is no way to configure an intermediate rate. 10 SPS is the standard choice for weighing applications, where averaging several readings for stability matters more than speed; 80 SPS suits applications that need faster response (a load cell used as a rough motion/impact trigger, for example) at the cost of more sample-to-sample noise, which usually needs to be traded off against firmware-side averaging.
References
Related Questions
What Is an Instrumentation Amplifier and How Does It Work?
Covers the three-op-amp topology, gain formula G = 1 + 2R/Rg, CMRR, and in-amp applications for Wheatstone bridges and sensor front ends.
Sensor Signal Conditioning Basics
Covers signal conditioning for sensors: op-amp gain, offset, 4-20mA interface, anti-aliasing filter design, ADC input protection, and two-point calibration.
What Is an ADC (Analog-to-Digital Converter) and How Does It Work?
An ADC converts analog voltages to digital numbers. Covers resolution, LSB, sampling rate, Nyquist, SAR vs sigma-delta architectures, and anti-aliasing filters.
How Do You Use the INA219 and INA226 I2C Current-Sense ICs?
Wire, calibrate, and configure the INA219 and INA226 I2C current monitors — register map, calibration formula, ALERT pin setup, and a comparison of both ICs.
What Is a Voltage Reference IC and When Do You Need One?
Covers voltage reference ICs: series vs shunt types, key specs (accuracy, temperature coefficient, noise, dropout), and when to use one instead of VDDA.
How Does Capacitive Touch Sensing Work, and How Do You Design a Reliable Touch Button?
How capacitive touch sensing works: self- vs mutual-capacitance, electrode design, dedicated controller ICs, and avoiding false triggers and drift.