Arduino HX711 Library Load Cell: Wiring, Code and Simulator
To build this Arduino HX711 Library Load Cell project you need an Arduino Uno and an HX711 load cell amplifier. The HX711 library reads the raw 24-bit value from a load-cell amplifier. Make the 4 connections in the wiring table, upload the Arduino C++ code, and change the weight on the scale, then add scale.tare() and set_scale() to show grams.
Open this circuit in the free Arduino Uno simulator
Parts list
| Qty | Part | What it does |
|---|---|---|
| 1 | Arduino Uno | the microcontroller board |
| 1 | HX711 load cell amplifier | DT goes LOW when a reading is ready; 25 SCK pulses clock out 24 bits, MSB first. The reading is grams × 100. |
Wiring
| # | From | To |
|---|---|---|
| 1 | Arduino Uno 5V | HX711 load cell amplifier VCC |
| 2 | Arduino Uno GND | HX711 load cell amplifier GND |
| 3 | Arduino Uno pin 3 | HX711 load cell amplifier DT |
| 4 | Arduino Uno pin 2 | HX711 load cell amplifier SCK |
Step by step
- Open the simulator. Open the BitForBytes Embedded Lab in your browser and start from the Arduino Uno. No install or account is needed.
- Add the parts. Add an HX711 load cell amplifier from the parts palette.
- Wire 1. Connect Arduino Uno 5V to HX711 load cell amplifier VCC.
- Wire 2. Connect Arduino Uno GND to HX711 load cell amplifier GND.
- Wire 3. Connect Arduino Uno pin 3 to HX711 load cell amplifier DT.
- Wire 4. Connect Arduino Uno pin 2 to HX711 load cell amplifier SCK.
- Paste the Arduino C++ code. Paste the Arduino C++ code below into the code editor.
- Run it. Press Run. Change the weight on the scale, then add scale.tare() and set_scale() to show grams.
Arduino C++ code
// HX711 (bogde): read a load cell. DT on 3, SCK on 2.
#include <HX711.h>
HX711 scale;
void setup() {
Serial.begin(9600);
scale.begin(3, 2);
}
void loop() {
if (scale.is_ready()) {
Serial.print("Raw: ");
Serial.println(scale.read());
}
delay(300);
}
What to try
Change the weight on the scale, then add scale.tare() and set_scale() to show grams.
Frequently asked questions
How do I wire the HX711 Library Load Cell project on an Arduino Uno?
Make 4 connections: Arduino Uno 5V to HX711 load cell amplifier VCC; Arduino Uno GND to HX711 load cell amplifier GND; Arduino Uno pin 3 to HX711 load cell amplifier DT; Arduino Uno pin 2 to HX711 load cell amplifier SCK.
What parts do I need for this Arduino project?
An Arduino Uno and an HX711 load cell amplifier.
Can I simulate this Arduino project online for free?
Yes. The BitForBytes Embedded Lab runs this exact circuit and Arduino C++ code in your browser for free, with no install and no hardware. The sketch is compiled with the real Arduino toolchain and runs on an emulated ATmega328P.
What does the code do?
The HX711 library reads the raw 24-bit value from a load-cell amplifier.
More Arduino Uno projects
- Arduino LED Blink: Wiring, Code and Simulator
- Arduino LDR Light Sensor: Wiring, Code and Simulator
- Arduino NTC Thermistor Thermometer: Wiring, Code and Simulator
- Arduino PWM to Analog RC Filter: Wiring, Code and Simulator
- Arduino Capacitance Meter: Wiring, Code and Simulator
- Arduino DC Motor PWM Speed Control with MOSFET: Wiring, Code and Simulator