C++ driver for the hx711 24-bit ADC using the Raspberry Pi Pico (RP2350) and the Pico SDK.
The hx711 is commonly used with load cells to build digital scales.
This repository provides a modern C++ class for the Pico, plus calibration examples.
- Supports the HX711 24-bit ADC for load cells
- Fixed configuration: Gain = 128, Output Rate = 10 samples per second (SPS)
- Simple calibration routine with tare and scale factor
- Example applications included:
- Calibration
- Raw sensor value reading
- Saving the calibration to flash memory enablig weighin without new calibratin after powering back on.
- Compatible with Raspberry Pi RP2350 and Pico SDK (CMake build system)
- Uses RP2350’s Programmable I/O (PIO) for efficient sampling
- Parallel reads: Each RP2350 PIO block can run four state machines, allowing up to four HX711 load cells to be read in parallel
- Optional trimmed moving average filter: removes the highest and lowest values in a window to smooth noisy readings while maintaining 10 SPS output rate
This project is licensed under the MIT License.
- Parts of this code are derived from Rob Tillaart’s hx711 library,
Copyright (c) 2019-2025 Rob Tillaart, MIT License. - Parts of this code are derived from Daniel Robertons hx711 PIO,
Copyright (c) 2020 Daniel Robertson, MIT License. - Additions and Pico-specific code
Copyright (c) 2025 Max Penfold, MIT License.
cpg is counts per gram. grams = (raw - offset) / cpg