The HX711 is the undisputed workhorse for embedded weighing and force measurement. If you are building a smart scale, a hopper level monitor, or a robotic gripper with force feedback, this 24-bit analog-to-digital converter (ADC) paired with a strain gauge load cell is the standard sensor application for the job. Unlike basic resistive sensors, a load cell setup requires precise differential amplification and strict attention to signal integrity to extract microvolt-level changes into usable physical units.

Sensing Principle and Output Signal

A load cell operates on the piezoresistive effect. Inside the aluminum or steel spring element (like the common TAL220 parallel beam), four strain gauges are bonded in a Wheatstone bridge configuration. When force is applied, the element deforms microscopically. This deformation changes the electrical resistance of the gauges, unbalancing the bridge and producing a differential voltage proportional to the applied force. The raw output of the load cell itself is strictly analog—typically rated in mV/V (e.g., a 2mV/V cell excited at 5V yields a maximum 10mV differential signal at full scale).

Because a 10mV signal is far too small and noisy for a microcontroller's internal ADC to read reliably, the HX711 module bridges the gap. It contains an integrated Programmable Gain Amplifier (PGA) with a selectable gain of 128x or 64x, followed by a 24-bit sigma-delta ADC. The output to your microcontroller is strictly digital. It does not output I2C or SPI; instead, it uses a custom two-wire serial protocol (DOUT and PD_SCK) to clock out 24-bit two's complement data words. Conflating the analog nature of the bare load cell with the digital output of the HX711 module is a common mistake that leads to incorrect wiring and fried components.

HX711 Electrical & Operating Specifications

Parameter Min Typical Max Unit / Notes
Supply Voltage (DVDD) 2.6 3.3 / 5.0 5.5 V (Must exceed ESP32 3.3V logic high threshold if not level-shifted)
Excitation Voltage (AVDD) 4.8 5.0 5.25 V (Supplied to Load Cell E+ / E-)
Channel A Input Differential -20 0 +20 mV (At Gain = 128)
Channel B Input Differential -40 0 +40 mV (At Gain = 32)
Output Data Rate 10 80 80 SPS (RATE pin LOW = 10 SPS, HIGH = 80 SPS)
Input Impedance > 100 MΩ (Minimizes loading on Wheatstone bridge)

Hardware Wiring and Pinout Matrix

Wiring a load cell sensor application requires two distinct stages: connecting the 4-wire or 5-wire load cell to the HX711 analog inputs, and connecting the HX711 digital outputs to your microcontroller. The table below maps a standard 50kg TAL220 load cell to an HX711 breakout, and then to an ESP32 DevKit V1.

Power Supply Note: While the ESP32 operates at 3.3V, the HX711 requires a minimum of 2.6V to operate and up to 5.5V for full analog rail headroom. Powering the HX711 VCC from the ESP32's 5V (VIN) pin is recommended to ensure the internal AVDD regulator can output a clean 4.8V+ to the load cell. The HX711 DOUT pin will output 5V logic highs in this configuration; the ESP32 GPIO pins are technically 5V tolerant on input, but using a simple voltage divider or running the HX711 at 3.3V (with reduced analog headroom) is safer for long-term reliability.
Source Component Source Pin Wire Color (Typical) Destination Component Destination Pin
TAL220 Load Cell E+ (Excitation +) Red HX711 Module E+
TAL220 Load Cell E- (Excitation -) Black HX711 Module E-
TAL220 Load Cell A+ (Signal +) White HX711 Module A+
TAL220 Load Cell A- (Signal -) Green HX711 Module A-
HX711 Module VCC Red ESP32 DevKit VIN (5V)
HX711 Module GND Black ESP32 DevKit GND
HX711 Module DOUT (Data) Yellow ESP32 DevKit GPIO 4 (Input)
HX711 Module PD_SCK (Clock) Orange ESP32 DevKit GPIO 5 (Output)

Raw-to-Unit Math and Calibration Procedure

The HX711 outputs a 24-bit two's complement integer. This means the raw data spans from -8,388,608 to +8,388,607. If you read the three bytes directly into a standard 32-bit signed integer in C++, you must manually extend the sign bit, or your readings will wrap around to massive positive numbers when the load cell is in compression or unloaded.

The Bitwise Math:
int32_t raw = (data[0] << 16) | (data[1] << 8) | data[2];
if (raw & 0x800000) raw |= 0xFF000000; // Sign extension for 24-bit to 32-bit

Once you have the signed 32-bit raw ADC count, converting it to physical units (grams or kilograms) requires a linear scaling equation. The sensor application relies on this formula:

Mass (g) = (Raw_ADC_Count - Tare_Offset) / Calibration_Factor

The Tare_Offset is the raw ADC reading when the scale is completely empty. The Calibration_Factor represents how many ADC counts equal one gram. Because every load cell has slight manufacturing variances in resistance and spring stiffness, you cannot use a hardcoded datasheet value; you must calibrate it empirically.

Step-by-Step Calibration Sequence

  1. Initialize and Tare: Power the system on with zero load. Read 20 consecutive samples, discard the top and bottom 5 outliers to filter noise, and average the remaining 10. Save this value as Tare_Offset.
  2. Apply Known Mass: Place a precisely known weight on the load cell. A 10kg (10,000g) calibration dumbbell or a sealed jug of distilled water (1 gallon = 3,785.41g) works well. Ensure the weight is placed exactly at the center of the load cell beam to avoid off-axis loading errors.
  3. Read Loaded Value: Take another 10-sample average of the raw ADC counts with the known mass applied. Let's call this Loaded_Raw.
  4. Calculate Factor: Use the formula: Calibration_Factor = (Loaded_Raw - Tare_Offset) / Known_Mass_in_Grams.
  5. Verify Linearity: Test with a 50% load (e.g., 5kg). If the calculated mass is off by more than 0.5%, your load cell may be suffering from mechanical binding, or your mounting hardware is absorbing some of the deflection.

Common Interference Sources and Mitigation

A 24-bit ADC is incredibly sensitive. At a gain of 128, the HX711 can resolve voltage changes down to roughly 1.2 nanovolts. In a real-world bench or jobsite environment, several interference sources will corrupt your sensor application if left unaddressed.

Interference Source Symptom in Data Mitigation Strategy
50/60Hz Mains Hum Cyclic oscillation in raw readings matching AC line frequency. Keep load cell wires away from AC mains cables. Set the HX711 RATE pin to LOW (10 SPS), which activates the internal 50/60Hz digital notch filter.
ESP32 WiFi RF Noise Random high-amplitude spikes when the ESP32 transmits MQTT or HTTP data. Decouple the HX711 AVDD with a 10µF tantalum and 0.1µF ceramic capacitor. Route digital DOUT/SCK traces away from the analog A+/A- traces.
Thermal EMF (Seebeck Effect) Slow, unidirectional drift over 10-30 minutes as the board warms up. Use identical wire lengths and materials for A+ and A-. Avoid placing the HX711 module directly under a hot voltage regulator or motor driver.
Mechanical Creep Reading slowly drops over time under a constant static load. This is a property of the aluminum spring element. Implement a software "tracking tare" that slowly adjusts the zero-point if the load remains perfectly static for >60 seconds.

For further reading on managing high-resolution ADC noise in embedded systems, refer to the SparkFun HX711 Hookup Guide for baseline circuit topologies, and consult the Espressif ESP32 GPIO API Reference to ensure your microcontroller pins are configured with the correct drive strength and pull-up/pull-down states to prevent floating clock lines during boot.