Cirkit Designer LogoCirkit DesignerYour all-in-one circuit design IDE Launch Cirkit Designer App

How to Use hx711: Examples, Pinouts, and Specs

Image of hx711Design with hx711 in Cirkit Designer

Introduction

The HX711 is a precision 24-bit analog-to-digital converter (ADC) designed for applications requiring high accuracy and stability. It is widely used in weigh scales and industrial control systems due to its ability to interface directly with load cells. The HX711 features a built-in low-noise programmable gain amplifier (PGA), making it ideal for amplifying small signals from load cells and other sensors.

Explore Projects Built with hx711

Use Cirkit Designer to design, explore, and prototype these projects online. Some projects support real-time simulation. Click "Open Project" to start designing instantly!
Image of Smart Weighing System with ESP8266 and HX711 - Battery Powered and Wi-Fi Enabled: A project utilizing hx711 in a practical application
Smart Weighing System with ESP8266 and HX711 - Battery Powered and Wi-Fi Enabled

This circuit is a multi-sensor data acquisition system powered by a 18650 battery and managed by an ESP8266 microcontroller. It includes a load sensor interfaced with an HX711 module for weight measurement, an IR sensor, an ADXL345 accelerometer, a VL53L0X distance sensor, and a Neo 6M GPS module for location tracking. The system is designed for wireless data transmission and is supported by a TP4056 module for battery charging.

Open Project in Cirkit Designer

Common Applications

Technical Specifications

The HX711 is designed to provide high-resolution measurements with minimal external components. Below are its key technical details:

Key Features

Pin Configuration

The HX711 has 16 pins, but in most applications, only 10 pins are used. Below is the pin configuration:

Pin Name Description
1 VCC Power supply (2.6V to 5.5V).
2 AVDD Analog power supply (connect to VCC).
3 VFB Feedback voltage for internal regulator (connect to ground via a capacitor).
4 AGND Analog ground.
5 BGND Bridge ground (connect to load cell ground).
6 B- Negative input for load cell.
7 B+ Positive input for load cell.
8 A- Negative input for load cell (Channel A).
9 A+ Positive input for load cell (Channel A).
10 DGND Digital ground.
11 PD_SCK Power-down and serial clock input.
12 DOUT Serial data output.
13-16 NC Not connected (leave unconnected).

Usage Instructions

Connecting the HX711 to a Load Cell

  1. Power Supply: Connect the VCC pin to a 3.3V or 5V power source and the GND pin to ground.
  2. Load Cell Connections:
    • Connect the load cell's positive excitation wire to the B+ pin.
    • Connect the load cell's negative excitation wire to the B- pin.
    • Connect the load cell's positive signal wire to the A+ pin.
    • Connect the load cell's negative signal wire to the A- pin.
  3. Microcontroller Interface:
    • Connect the PD_SCK pin to a digital output pin on the microcontroller.
    • Connect the DOUT pin to a digital input pin on the microcontroller.

Example Arduino UNO Code

Below is an example of how to use the HX711 with an Arduino UNO to read weight data from a load cell. This code uses the popular HX711 library.

#include "HX711.h" // Include the HX711 library

// Define the pins connected to the HX711
#define DOUT  3  // Data output pin
#define CLK   2  // Clock pin

HX711 scale; // Create an instance of the HX711 class

void setup() {
  Serial.begin(9600); // Initialize serial communication
  scale.begin(DOUT, CLK); // Initialize the HX711 with the defined pins

  // Set the scale to zero (tare)
  Serial.println("Taring the scale...");
  scale.set_scale(); // Set the scale factor to default
  scale.tare();      // Reset the scale to zero
  Serial.println("Scale tared.");
}

void loop() {
  // Read the weight from the load cell
  if (scale.is_ready()) { // Check if the HX711 is ready
    long weight = scale.get_units(); // Get the weight in units
    Serial.print("Weight: ");
    Serial.print(weight);
    Serial.println(" units");
  } else {
    Serial.println("HX711 not ready. Check connections.");
  }

  delay(500); // Wait for 500ms before the next reading
}

Important Considerations

Troubleshooting and FAQs

Common Issues

  1. No Data Output:

    • Cause: Incorrect wiring or loose connections.
    • Solution: Double-check all connections, especially the DOUT and PD_SCK pins.
  2. Unstable Readings:

    • Cause: Electrical noise or unstable power supply.
    • Solution: Use a decoupling capacitor (e.g., 0.1µF) between VCC and GND. Ensure proper grounding.
  3. Incorrect Weight Measurements:

    • Cause: Improper calibration or load cell issues.
    • Solution: Calibrate the scale using a known weight. Verify the load cell's wiring.
  4. HX711 Not Ready:

    • Cause: Faulty HX711 module or incorrect clock signal.
    • Solution: Replace the HX711 module. Verify the clock signal from the microcontroller.

FAQs

Q1: Can the HX711 work with a 3.3V microcontroller?
Yes, the HX711 operates with a supply voltage as low as 2.6V, making it compatible with 3.3V systems.

Q2: How do I calibrate the HX711?
Use a known weight to determine the scale factor. Adjust the scale factor in your code using the set_scale() function.

Q3: Can I use both channels (A and B) simultaneously?
Yes, but note that Channel A has a programmable gain (128 or 64), while Channel B has a fixed gain of 32. Channel A is typically used for higher precision measurements.

Q4: What is the maximum weight the HX711 can measure?
The maximum weight depends on the load cell's capacity. The HX711 itself does not impose a weight limit but converts the load cell's output signal.

Q5: How do I reduce noise in the readings?
Use a stable power supply, shielded cables, and proper grounding. Additionally, average multiple readings in your code to filter out noise.