Labs / Electronic modules

GraftSense - HX711-based Weighing Sensor Module (Open Version)

Author: Li Zisheng · Source: FreakStudio open documentation, v1.1 · License: CC BY 4.0 · Driver code (sensors/hx711_driver): MIT License

Contents
HX711
HX711 U1 C1 C2

I. Module Introduction

Weighing sensor module based on HX711, which adopts HX711 high-precision 24-bit A / D conversion chip solution, has a built-in low-noise programmable gain amplifier that can convert the weak analog signal of the weighing sensor into a digital signal; the module is equipped with LDO voltage regulator circuit, power filtering and indicator circuit, powered by 3.3V/5V, communicates with the main controller through a two-wire serial interface, adapts to resistance strain gauge weighing sensors with different sensitivities, has strong anti-interference ability, and is suitable for scenarios such as electronic scales, pressure detection, industrial weighing and DIY force measuring equipment.

II. Introduction to Main Chips

HX711 is a 24-bit high-precision analog-to-digital conversion chip specifically designed for load cells. It integrates dual-channel differential inputs, a programmable gain amplifier, and a regulated power supply, featuring a simple interface and low cost, and is widely used in electronic scales.

2.1 Chip Overview

HX711 24 2.6 5.5V SOP-16

HX711 is a 24-bit A / D converter chip designed specifically for high-precision electronic scales. It integrates a regulated power supply, a clock oscillator, and a low-noise programmable amplifier (with a gain of 64/128 for Channel A and a fixed gain of 32 for Channel B). It supports dual-channel differential input, 10Hz/80Hz data rate, and 50/60Hz power supply interference rejection. Featuring a simple interface that requires no register programming, it operates at a supply voltage of 2.6~5.5V, boasts low power consumption, and is packaged in SOP-16 package.

2.2 Pin Definition

HX711 SOP-16L 1 9 15 10Hz 80Hz

HX711 is SOP-16 packaged, with core pin functions as follows: Pin 1/16 serves as power supply (VSUP / DVDD), Pin 3 is analog power supply AVDD; Pins 7/8 are differential inputs for Channel A, Pins 9/10 are differential inputs for Channel B; Pin 11 (PD_SCK) controls power-down and serial clock, Pin 12 (DOUT) is the data output pin; Pin 15 (RATE) selects 10Hz/80Hz data rate; the remaining pins are related to voltage regulation, clock and ground.

2.3 Functional Block Diagram

HX711 32 64 128 24

HX711 receives the differential signal from an external weighing sensor through the A / B channel. After being switched by the internal multiplexer, the signal is sent to a programmable gain amplifier (with selectable gains of 32,64, or 128 times). The amplified signal is converted from analog to digital by a 24-bit Σ-Δ type ADC, and then communicates with the MCU via the digital interface through the DOUT and PD_SCK pins. Meanwhile, the on-chip voltage regulator, bandgap reference, and oscillator provide stable power supply, reference voltage, and clock signals for the entire system, enabling high-precision weight Data Acquisition.

2.4 Performance Parameters

HX711 0.5 19.7Bits AGND+1.2 AVDD-1.3V

HX711 has core parameters as follows: the 24-bit ADC features an effective resolution of 19.7 bits, a noise-free resolution of 17.3 bits, and an integral nonlinearity of ±0.001% FSR when operating at a gain of 128 and a rate of 10Hz; it supports 10/80Hz data rates, with an input noise as low as 50nV (rms), and both power supply and common-mode rejection ratios reach 100dB; its typical reference voltage is 1.25V, power supply voltage ranges from 2.6V to 5.5V, and the operating current is approximately 1500μA on the analog side and around 100μA on the digital side.

2.5 Reference Circuit

HX711 2.6 5.2V Q1 R1 R2 R3 C3 C4 10uF

HX711 reference circuit for weighing applications: a 2.6-5.2V power supply supplies the chip's AVDD analog power via a 10uF filter capacitor; the differential signal output from the external weighing sensor is filtered by an RC network and then fed to the A channel's INPA / INNA pins. After internal amplification and 24-bit analog-to-digital conversion, the chip communicates with the DOUT and PD_SCK pins to interface with an MCU to realize weight data acquisition and transmission.

2.6 Chip Configuration

None.

R1 R2 100mV HX711 10MHz 8MHz

HX711 DOUT being at high level indicates that the data is not ready; after it is pulled low, 24 clock pulses need to be input to read out the 24-bit data;The 25th to 27th pulses are used for channel and gain selection, with different pulse numbers corresponding to different configurations (the 25th corresponds to channel A / gain 128, the 26th corresponds to channel B / gain 32, the 27th corresponds to channel A / gain 64); a pulse count less than 25 or greater than 27 will result in a communication error. After channel/gain switching, 4 output cycles must elapse before DOUT goes low again and outputs valid data.

HX711 128 32 64

HX711 in the serial communication timing sequence, DOUT being pulled low indicates that data is ready, and the MCU reads the 24-bit data via the PD_SCK; the 25th to 27th clock pulses are used to select the channel and gain for the next conversion, and the number of pulses corresponds respectively to Channel A with a gain of 128, Channel B with a gain of 32, and Channel A with a gain of 64; meanwhile, the high and low levels of PD_SCK must meet the minimum pulse width requirements (high/low level ≥ 0.2μs, time from rising edge to data valid ≤ 0.1μs).

2.8 PCB Routing Precautions

HX711 Q1 R1 C1 2.8

III. Circuit Engineering

3.1 Circuit Source Engineering

To obtain the source code of the circuit, please follow the official account [Freak Embedded]

3.2 Module Usage Instructions

The schematic diagram of this module is shown below:

SCH_Schematic1_Load Cell Module Based on HX711_v1.0.0_2026-05-11.pdf 2.2 MB

HX711 U1 C1 C2 R1 R2

This module provides dual-line serial interfaces DAT and SCK : half-duplex communication using SPI -like protocol, compatible with 3.3V/5V level, and can stably transmit 24-bit high-precision weighing digital signals collected by HX711 , suitable for electronic scales, pressure detection, industrial weighing and DIY force measurement equipment and other scenarios, providing reliable weak weight signal amplification and analog-to-digital conversion data interaction capabilities for the system.

HX711 V1.0.0

Note that the silkscreen labels of the load cell interface on our HX711 module are S+, S-, G, E+, which differ from the commonly seen E+ / E- / A+ / A- definitions online. The corresponding relationship is as follows:

Module SilkscreenActual MeaningCorresponding Sensor WireCircuit Connection Description
E+Excitation Power Positive (Excitation+)Red wire (power positive, connected to E+)3.3V supply output from the module LDO, powers the sensor bridge
GExcitation Power Negative (Excitation-, i.e., E-)Black wire (power negative, connected to E-)Connected directly to GND inside the module, provides the negative supply for the sensor bridge
S+Signal Output Positive (Signal+, i.e., A+)Green wire (signal positive, connected to S+A)Connected to the A+ pin (pin 8) of the HX711, as the positive end of the differential signal
S-Signal Output Negative (Signal-, i.e., A-)White wire (signal negative, connected to S-A)Connected to the A- pin (pin 7) of the HX711, as the negative end of the differential signal

It should be noted that the HX711 communication has no protocol and is purely timing-controlled; any timing error will directly lead to data invalidation, so all codes / frameworks must meet the following requirements:

Before using this module, we need to prepare the following items:

ItemPurposeReference Description
Cantilever beam load cellDeforms under force, producing a bridge signalCommon 4-wire type: red / black / green / white
Standard weight setUsed for range calibrationAt least one weight of known mass is required
Weighing stand (optional)Holds the sensor and keeps the force stableWithout a stand, make sure the sensor is fixed level
100g 50g 20g 10g 5g 1 6 4

The load sensor adopts a cantilever beam structure, with 4 strain gauges (R1/R2/R3/R4) attached to its surface:

R1/R4 R2/R3 R1/R2/R3/R4

HX711 is a 24-bit high-precision ADC, with its core functions as follows:

After completing the assembly of the weighing frame, the wiring of the modules and weighing sensors, and the wiring of the main controller and modules, wait for the modules to stabilize after power-on, and we first need to perform zero calibration (tare to eliminate no-load error):

⚠️ After replacing the sensor, mounting position or module, the zero point must be recalibrated!

Next, perform range calibration: place a standard weight of known mass on the sensor, continuously read the raw ADC values for multiple times, calculate the average value and then compute the calibration coefficient:

Calibration factor = (ADC average for weight - zero-point ADC value) / actual weight of the weight

Save the calibration coefficients for subsequent conversion of ADC values to weight.

⚠️ Calibration sequence must not be reversed: Zero point calibration must be performed first, followed by range calibration!

When weighing an object, read the real-time 24-bit raw ADC value output of the module. The calculation formula for the actual weight is as follows:

Actual weight = (current ADC value - zero offset value) / calibration factor

Of course, this module also supports low-power control:

3.3 Application Experiment

Here, we use the GraftPort-RP2040 development board for testing, and the HX711-based weighing sensor module uses the DIO interface to communicate with the main controller.

Here, we first use the HY2.0-4P connection cable to connect the module to the GraftPort-RP2040 development board's DIO0 interface:

HX711 GraftPort-RP2040
R60

Development Board Pins

Module Pins

Description

Pin 6

DAT

HX711 sensor DATA pin

Pin 7

SCK

HX711 Sensor SCK

Sensor Wiring:

Support frame

Module Terminals

Description

White

E

Positive-phase input of weighing signal

Green

G

Weighing signal inverted input

Red

S-

Sensor power supply negative terminal

Black

S+

Sensor power supply positive terminal

Here, we need to search for the relevant driver packages on uPyPI: https://upypi.net/zh/

106

Enter hx711_driver to search, and the following will be displayed:

hx711_driver 1.0.8 2026 05 29

Click to copy the local installation command:

hx711_driver HX711 2026 05 29 1.0.0

Import the module driver library code via the mip tool. Below are the usage commands for the mpremote tool:

mpremote mip install https://upypi.net/pkgs/hx711_driver/1.0.0

Here, we will first briefly explain the usage of the driver library: the module just powered on has no calibration coefficients, and the values read out are raw values, so calibration is required to display the actual weight.

  1. First run the code above to perform tare (zeroing with no load);
  2. Do not place any object, record the original value: print (hx.read_average ())→ denote it as Value 0;
  3. Place a weight of known mass (e. g., 100g) and record the reading: print (hx.read_average ())→ denote it as Value 1;
  4. Calculate the calibration coefficient:
Calibration factor = (value1 - value0) / weight of the calibration weight

Meanwhile, set the coefficients in the code:

hx.set_scale(校准系数)

Import the MicroPython driver code for the HX711-based weighing sensor module, then copy the following main.py code into our project:

# Python env   : MicroPython v1.23.0
# -*- coding: utf-8 -*-
# @Time    : 2026/1/15 2:30 PM
# @Author  : hogeiha
# @File    : main.py
# @Description : HX711 load cell calibration and measurement program, supporting tare, calibration and real-time weight display

# ======================================== Import Modules =========================================
from hx711_gpio import HX711
from machine import Pin
import time

# ======================================== Global Variables ============================================
# Calibration weight mass, in grams
CAL_WEIGHT = 100

# ======================================== Functions ============================================

# ======================================== Custom Classes ============================================

# ======================================== Initialization configuration ===========================================
# Wait for the system to stabilize
time.sleep(3)
print("FreakStudio: HX711 sensor initialization starting")

# Define the data pin and clock pin
# 6 = DATA, 7 = SCK
pin_DATA = Pin(6, Pin.IN, pull=Pin.PULL_DOWN)
pin_SCK = Pin(7, Pin.OUT)

# Initialize the HX711 sensor
try:
    hx = HX711(pin_SCK, pin_DATA, gain=128)
    print("HX711 initialization successful")
    time.sleep(1)
except Exception as e:
    print("Sensor initialization failed:", e)
    while True:
        pass

# ========================================  Main Program  ============================================
# Perform tare operation
print("Please keep no load, starting tare...")
time.sleep(2)

# Read the average of 20 readings as the offset
offset = hx.read_average(times=20)
hx.set_offset(offset)
# Synchronize the filter baseline value
hx.filtered = offset
print("Tare completed")
print("Zero offset value:", offset)

# Calibration procedure: place the standard weight
input("Please put the standard weight and press Enter to continue...")
time.sleep(2)

# Read the average of 20 readings after loading the weight
cal_raw = hx.read_average(times=20)
net_raw = cal_raw - hx.OFFSET

print("Raw value after loading:", cal_raw)
print("Net increment:", net_raw)

# Check whether the calibration increment is too small
if abs(net_raw) < 1000:
    raise ValueError("Calibration increment too small, please check HX711 wiring, sensor connection or weight correctness")

# Calculate the conversion factor and set it
scale_factor = net_raw / CAL_WEIGHT
hx.set_scale(scale_factor)

print("Calibration completed")
print("SCALE =", scale_factor)
print("----------------------------------------")

# Synchronize the filter again to avoid drift in the first few readings right after calibration
hx.filtered = hx.read_average(times=10)

# Main loop: continuously read and display the weight
while True:
    raw_value = hx.read()
    weight = hx.get_units()
    print("Raw value: {:>10.0f} | Weight: {:>8.2f} g".format(raw_value, weight))
    time.sleep(0.2)

Burn the code, open the terminal, and the output is as follows:

Calibration Procedure:

# Calibration weight mass, in grams
CAL_WEIGHT = 100 #Change to the mass of the calibration object in grams

Example of no-load operation:

HX711
HX711 210089.7

Place the calibration object after the terminal no-load calibration is completed:

100g HX711

Place a 100g weight and press Enter to perform calibration:

HX711 100g 250405.8 37941.14 379.414 250466 100.12

After the calibration is completed, we placed an iPhone 12 mini with a standard weight of 162g to verify the results:

12 HX711
162 5.73 12
7 266361 266428 162.07 162.21 162g 12

The output is 162g, which is consistent with the expectation.
Place a standard 50g weight to verify the result:

HX711 50g
HX711 20 231619 50.88g 50g

The output is 50g, which is consistent with the expectation.

IV. Drivers

hx711_driver-1.0.0.zip 11 KB

None.

VI. Revision History

Document Version

Date Modified

Modifier

Modify Content

v1.0

2026-05-12

Ling Gaoxing

Initialize the document

v1.1

2026-06-06

Xin Ruili

Create an open version of the document based on the internal document version v1.0.

7. Relevant Materials

7.1 Chip Datasheet

HX711.pdf 315 KB

7.2 Unique Icons for PCB Silk Screen

HX711
7.2