Load Cells and the HX711: Wiring, Calibration, and Precision Weight Sensing for Makers
Most maker sensor guides cover temperature, distance, and current, but weight is its own category with its own headaches: microvolt-level signals, mechanical creep, and a calibration step that has to happen in software because you can't trim a strain gauge with a screwdriver. Load cells paired with the HX711 amplifier are the cheapest, most reliable way to add precision weighing to a project — filament spool monitoring, kitchen and shop scales, force-feedback buttons, overflow detection in a resin vat, or a simple bathroom-scale-style platform for a robot. This guide covers how load cells actually work, how to wire an HX711 to an ESP32 or Arduino, and how to calibrate the result so the number on your screen means something.
How a Load Cell Actually Works
A load cell is a metal beam (usually aluminum or alloy steel) with four strain gauges bonded to it in a Wheatstone bridge configuration. When the beam flexes under load, two gauges stretch and two compress, unbalancing the bridge and producing a differential voltage proportional to the applied force. That voltage is tiny — typically 1-3 mV per volt of excitation at full rated load, meaning a 5V-excited cell might output only a few millivolts across its entire measurement range. You cannot read this directly on a microcontroller's ADC with any useful resolution; it needs a dedicated instrumentation amplifier, which is exactly what the HX711 provides.
Load Cell Types and Choosing One
TypeTypical CapacityBest ForNotes Micro load cell (button/beam)1-20 kgForce feedback, small platform scales, button pressesCheap, low profile, common in DIY kitchen scale kits Bar/beam load cell (single-point)3-50 kgPlatform scales, spool monitors, small binsMount at one end, load the other — most common maker type S-type (S-beam)10-500 kgHanging/tension measurement, crane scalesThreaded ends, measures pull force directly Compression/pancake load cell50 kg-5000 kgPress force, heavy platform scalesOverkill for most maker projects but useful for machine-force monitoringBuy a load cell rated for roughly 2-3x your expected maximum weight. Running a cell near its rated capacity repeatedly degrades accuracy over time and risks permanent deformation of the beam, which will throw off your zero point permanently. For a filament spool monitor, a 5 kg or 10 kg single-point bar cell is plenty; for a shop platform scale meant to weigh boxes of hardware, look at 20-50 kg.
Wiring the HX711 to an ESP32 or Arduino
The HX711 breakout board has four wires going to the load cell (E+, E-, A+, A- — excitation and signal) and typically comes pre-wired if you buy a load cell + HX711 kit. On the microcontroller side, the module needs just two GPIO pins plus power and ground:
HX711 PinConnects ToNotes VCC3.3V or 5VMost breakout boards accept either; check your specific module's regulator GNDGNDCommon ground with the MCU DT (DOUT)Any digital GPIOData output, bit-banged serial — not I2C or SPI SCKAny digital GPIOClock line, also selects gain (10, 32, or 64x) via pulse count Load cell red/blackE+/E-Excitation pair Load cell white/greenA+/A-Signal pair (colors vary by manufacturer — check the datasheet)The HX711's protocol is a simple bit-banged clock/data scheme, not I2C or SPI, so it works fine on any two free GPIO pins on an ESP32, ESP8266, or Arduino. On the ESP32 avoid strapping pins (GPIO 0, 2, 12, 15) for SCK/DT if you want clean boot behavior. The HX711 library (Bogdan Necula's, widely used in the Arduino Library Manager) handles the low-level timing for you.
Calibrating the Reading
Calibration is where most first attempts go wrong — people expect the raw HX711 output to be in grams, and it isn't. The output is an arbitrary signed integer proportional to force, and you need a known reference weight to convert it. The process:
- Power the load cell and let it settle for a minute or two — thermal drift in the first few minutes after power-on is real and will bias your zero point if you skip this.
- With no load applied, read and store the raw HX711 value as your zero_offset (tare).
- Place a known reference weight on the cell — a calibrated weight set is ideal, but a sealed bag of sugar or a bottle of water weighed on a kitchen scale works for hobby-grade accuracy.
- Read the new raw value and compute scale_factor = (raw_reading - zero_offset) / known_weight_grams.
- Store scale_factor in code (or EEPROM/NVS for persistence across reboots) and compute future readings as weight = (raw_reading - zero_offset) / scale_factor.
For better accuracy, calibrate with a weight close to what you'll actually be measuring rather than a token 100g reference — load cells aren't perfectly linear across their full range, and calibrating near your actual working weight minimizes that error. Re-tare before every use if the application allows it, since thermal drift and mounting stress shift the zero point over hours.
Noise, Averaging, and Mechanical Mounting
Raw HX711 readings are noisy — expect jitter of a few dozen counts even on a stable load. Take the median or average of 10-20 consecutive readings rather than trusting a single sample; the HX711 library's get_units() helper does this averaging for you if you pass a sample count. Mechanically, a load cell needs to be mounted so force is applied purely along its measurement axis — bolted rigidly at one end with the load application point free to flex at the other, with nothing binding or side-loading the beam. A load cell squeezed between two rigid plates with no flex clearance will read garbage or nothing at all. Most kits include mounting brackets sized for this exact geometry; if you're 3D printing a bracket, model in a few millimeters of clearance around the beam's flex zone.
Practical Maker Applications
- Filament spool monitoring: a single-point load cell under a spool holder lets an ESP32 estimate remaining filament by weight, far more reliable than filament-runout switches for tracking how much is actually left mid-roll.
- Resin vat level / overflow detection: weighing a print bed or vat catches problems that optical level sensors miss, since it's insensitive to resin color or opacity.
- Shop and kitchen scales: pair with an OLED or TFT display (see this site's display driving guides) for a simple standalone scale, useful for weighing hardware, powder-coat media, or resin/hardener ratios.
- Force-sensing buttons and pedals: a small button load cell reads applied pressure rather than a binary click, useful for adaptive controllers or test rigs.
Troubleshooting
SymptomLikely Cause Reading never changes / stuck at one valueWiring swapped on A+/A-, or HX711 not powered — check for a heartbeat on DOUT with a scope or logic analyzer Reading is wildly noisyLong unshielded signal wires picking up EMI from nearby stepper drivers or switching supplies; keep HX711-to-load-cell wiring short and away from motor cables Value drifts over minutes with no load changeThermal drift — allow warm-up time before taring, or add temperature compensation if precision matters Reading is negative or backwardsSwap the A+/A- signal pair, or negate in software Works on the bench, fails once mountedMechanical bind — the load cell body is contacting the enclosure or bracket somewhere along its flex axisA load cell and HX711 module together cost less than most single sensors covered elsewhere on this site, and the combination turns "how much is left" or "how much force" into a number you can log, graph, or trigger automation from. The main cost is patience during calibration — get the tare and scale factor right once, store them persistently, and the rest of the project is just reading a value like any other sensor.
Related Guides
- How to Use Sensors with Arduino and ESP32: Temperature, Distance, Load, Current, and Hall Effect
- I2C vs SPI vs UART: How to Choose and Use Serial Communication Protocols
- ESP32 ADC Explained: Non-Linearity, Attenuation, and Calibrating Analog Readings for Real Accuracy
- How to Program Addressable LED Strips: WS2812B Patterns, Effects, and Power Design
- How to Control Motors with Arduino and ESP32: Stepper, DC, and Servo Drivers
- ESP32: Setting Up for Arduino IDE
- Arduino vs ESP32: Which Should You Use? A Practical Comparison
- Getting Started with ESP32: GPIO, WiFi, and Your First Project