When building closed-loop automated systems, the relationship between actuators and sensors defines your control accuracy. A linear actuator provides the mechanical muscle to push, pull, or lift, but without precise force feedback, it is blind. By pairing a 12V DC linear actuator with an HX711 24-bit ADC and a resistive strain gauge load cell, you can build a system that stops or reverses based on exact gram-level force thresholds. This guide covers the exact wiring, the raw-to-unit conversion math, and the EMI mitigation required to make this sensor-actuator pair reliable on the bench.

The Sensing Principle: Strain Gauges and Wheatstone Bridges

The sensing principle relies on a Wheatstone bridge configuration: four resistive elements bonded to a deformable aluminum or steel beam. As the actuator applies force, the beam flexes, altering the physical geometry of the resistors and shifting their resistance by fractions of an ohm. This minute resistance change unbalances the bridge, producing a differential voltage in the microvolt (µV) range proportional to the applied load.

Because microvolt signals are easily swallowed by noise and are far below the native resolution of standard microcontroller ADCs, the HX711 chip amplifies this signal (selectable 128x or 64x gain) and digitizes it. The output is not an analog voltage; it is a serialized 24-bit digital stream clocked out via a proprietary two-wire protocol. Understanding this digital output is critical before you can map the reading to a physical weight and use it to trigger your actuator's limit switches.

HX711 Wiring and Electrical Specifications

The HX711 operates on a supply range of 2.6V to 5.5V, making it compatible with both 5V Arduino Uno boards and 3.3V ESP32-WROOM-32 modules. However, the logic high threshold for the HX711 data pin is typically 1.2V above ground, meaning a 3.3V ESP32 GPIO can drive it directly without a level shifter. Below is the definitive wiring matrix for pairing the sensor with an ESP32 and a high-current actuator driver.

Table 1: HX711, ESP32, and Actuator Driver Wiring Matrix
Pin / Signal HX711 Board ESP32 / MCU Pin Voltage / Signal Type Engineering Notes
VCC VCC 3V3 or 5V 2.6V - 5.5V DC Must be clean; use an LDO if MCU 5V rail has >50mV ripple.
GND GND GND 0V Reference Star-ground this to the same node as the load cell E- pin.
DT (Data) DT GPIO 4 Digital (Push-Pull) Read by MCU. Do not use ADC-capable pins on ESP32 to avoid noise.
SCK (Clock) SCK GPIO 5 Digital (Push-Pull) Driven by MCU. Keep trace length under 10cm.
E+ / E- E+ / E- N/A (Load Cell) Excitation (Analog) Supplies the Wheatstone bridge. Polarity matters for sign.
A+ / A- A+ / A- N/A (Load Cell) Signal (Differential) High impedance. Use shielded twisted pair cable.
Actuator PWM N/A GPIO 18 PWM (3.3V Logic) Drives BTS7960 R_PWM/L_PWM. Set frequency to 20kHz.
Callout Tip: The Rate Pin
Most cheap HX711 breakout boards have an unpopulated 'RATE' pin. If left unconnected (or pulled LOW), the chip samples at 10 Hz. If you bridge the RATE pin to VCC, the sampling rate jumps to 80 Hz. For fast-acting linear actuators that need rapid stall detection, 80 Hz is highly recommended, provided your I2C/WiFi interrupts don't starve the GPIO bit-banging routine.

Raw ADC to Physical Units: The Calibration Math

A common mistake when interfacing actuators and sensors is conflating the raw digital output with a direct physical unit. The HX711 does not output grams or Newtons. It outputs a 24-bit signed integer in two's complement format, ranging from -8,388,608 to +8,388,607. To convert this raw reading into a usable physical unit (like grams or kilograms), you must perform a two-point calibration to find your OFFSET (tare) and SCALE_FACTOR.

The mathematical relationship is strictly linear within the load cell's rated capacity. The formula to derive the physical weight is:

Weight = (Raw_Reading - Offset) / Scale_Factor

Let's walk through a concrete numeric example using a standard CZEM-102 50kg aluminum parallel beam load cell (typically $12-$15 on the market).

  1. Find the Offset (Tare): With zero load on the beam, read the HX711 20 times and average the result. Let's assume the raw average is 8,388,608 (the exact mid-point of the 24-bit range). This is your OFFSET.
  2. Find the Scale Factor: Place a known reference weight on the cell. We use a calibrated 10,000g (10kg) steel block. The new raw reading averages 12,588,608.
  3. Calculate: The delta is 12,588,608 - 8,388,608 = 4,200,000 counts. Divide the delta by the known weight: 4,200,000 / 10,000g = 420. Your SCALE_FACTOR is 420 counts per gram.

Here is the exact C++ implementation for an ESP32 environment, avoiding floating-point drift by keeping calculations in integer space until the final display step:


// HX711 Raw to Unit Conversion for Actuator Limit Checking
const long OFFSET = 8388608;
const long SCALE_FACTOR = 420; // counts per gram
const long MAX_FORCE_GRAMS = 15000; // 15kg actuator stall limit

long read_raw_hx711() {
    // Bit-banging routine omitted for brevity; returns 24-bit signed long
    return raw_24bit_value; 
}

float get_force_kg() {
    long raw = read_raw_hx711();
    long net_counts = raw - OFFSET;
    // Return as float for telemetry, but use net_counts for fast logic checks
    return (float)net_counts / SCALE_FACTOR / 1000.0; 
}

void check_actuator_limits() {
    long raw = read_raw_hx711();
    long net_counts = raw - OFFSET;
    long current_grams = net_counts / SCALE_FACTOR;
    
    if (current_grams >= MAX_FORCE_GRAMS) {
        stop_linear_actuator(); // Trigger BTS7960 brake
    }
}

For deeper background on how the Wheatstone bridge generates these initial microvolt differentials before the HX711 amplifies them, refer to this technical breakdown of Wheatstone bridge circuits by All About Circuits.

Mitigating Actuator EMI and Closing the Control Loop

The most frequent point of failure when pairing actuators and sensors in DIY builds is electromagnetic interference (EMI). Standard 12V linear actuators use brushed DC motors. The carbon brushes arcing against the commutator generate massive broadband electrical noise. This noise couples capacitively and inductively into the high-impedance A+ and A- signal wires of your load cell, causing the HX711 raw readings to jump erratically by thousands of counts.

If your actuator is running and your load cell readings look like a random number generator, you have an EMI problem. Here is the exact mitigation protocol used in industrial bench setups:

  • Motor Terminal Capacitors: Solder a 100nF (0.1µF) ceramic capacitor directly across the two motor terminals inside the actuator housing. Add a 10µF electrolytic capacitor in parallel. This creates a low-pass filter that shorts high-frequency brush noise to ground before it escapes the motor casing.
  • Twisted Pair Routing: The four wires extending from the load cell (E+, E-, A+, A-) must be twisted together. Specifically, twist A+ and A- tightly as a pair. This ensures that any external magnetic flux induces equal and opposite voltages in the signal wires, which the HX711's differential input rejects as common-mode noise.
  • Driver Selection and PWM Tuning: Avoid the L298N motor driver for linear actuators. It uses bipolar junction transistors (BJTs) that drop up to 2.5V and generate excessive heat. Instead, use a BTS7960 43A half-bridge driver (approx. $15). Crucially, set your ESP32 PWM frequency to at least 20kHz. Lower frequencies (like 500Hz) cause the motor windings to ring audibly and generate low-frequency EMI that is much harder to filter out of the HX711's 10Hz sampling window.
Table 2: Actuator Driver Comparison for Sensor-Heavy Builds
Driver IC Continuous Current Voltage Drop EMI Profile Verdict for Load Cell Setups
L298N (BJT H-Bridge) 2A (3A peak) 1.8V - 2.5V High (slow switching) Avoid. Drops too much voltage, runs hot, noisy.
IBT-2 (BTS7960) 30A - 43A ~0.1V (MOSFET) Low (fast switching) Excellent. Standard for 12V high-torque linear actuators.
Cytron MD10C 10A (13A peak) ~0.05V Very Low Great for smaller 12V actuators under 100N force.

By isolating the high-current actuator switching from the low-level sensor traces, and applying the exact raw-to-unit math outlined above, your ESP32 can reliably read the load cell and command the BTS7960 to halt the actuator within milliseconds of hitting your target force threshold. For official ESP32 GPIO interrupt and timing constraints when bit-banging the HX711 clock line, consult the Espressif GPIO API Reference to ensure your WiFi stack doesn't introduce latency spikes into your sensor polling loop.

Pairing actuators and sensors is ultimately an exercise in signal integrity. Treat the microvolt sensor traces with the same respect you give the 10-amp actuator feed wires, and your closed-loop system will perform flawlessly.