ESP32-Powered Wi-Fi Weight Sensor with HX711 Interface

ESP32 Wi-Fi Weight Sensor with HX711 – Complete Tutorial | MakeMindz
📡 IoT Project Tutorial

ESP32 Wi-Fi Weight Sensor
with HX711 Interface

Build a real-time IoT weighing system that measures, processes, and wirelessly transmits weight data using ESP32 and the HX711 24-bit load cell amplifier.

⚙️ ESP32 ⚖️ HX711 📶 Wi-Fi 🔧 Arduino IDE 🌐 IoT 🏭 Industrial

The ESP32 Wi-Fi Weight Measurement System is an advanced IoT-based smart weighing solution designed for real-time remote monitoring and industrial automation. Powered by the high-performance ESP32 and the precision HX711 amplifier, this system delivers accurate 24-bit weight readings and transmits data wirelessly over Wi-Fi.

This project is perfect for smart inventory systems, industrial automation, agriculture monitoring, and IoT research.

🧩 Components Required

🔲 ESP32 Dev Board Wi-Fi + Bluetooth MCU — the brain of the system
⚖️ Load Cell Converts mechanical weight into small analog voltage
🔌 HX711 Module 24-bit ADC amplifier for load cell signals
🔋 USB Power Supply 5V USB or 3.3V regulated supply
🧪 Breadboard For prototyping connections
🔗 Jumper Wires Male-to-male & male-to-female wires

How the System Works

🏋️ STEP 1

Load Cell Senses Weight

Applied weight causes mechanical strain → generates tiny millivolt analog signal via strain gauge

🔬 STEP 2

HX711 Amplifies & Digitizes

Amplifies the weak signal and converts it to 24-bit digital data via SPI-like protocol

🧠 STEP 3

ESP32 Processes Data

Applies calibration factor, averages 10 samples, converts raw counts into kg/grams

📡 STEP 4

Wi-Fi Transmission

Sends data to cloud, IoT dashboard (ThingSpeak/Blynk), or hosts a local web server

🔌 Circuit Diagram

ESP32 + HX711 Load Cell – Wiring Diagram ESP32 Dev Board GPIO12 (DOUT) GPIO14 (SCK) 3.3V (VCC) GND GPIO4 (SDA opt) GPIO5 (SCL opt) TX / RX (Serial) HX711 Module DOUT → SCK → VCC → GND → ← E+ ← E- ← A+ ← A- Load Cell Strain Gauge RED (E+) BLK (E-) GRN (A+) WHT (A-) USB 5V → 3.3V onboard 📡 Wi-Fi Output 📟 Serial Monitor Baud: 115200 Output: "Weight: X kg" WIRE LEGEND: DATA/SCK VCC 3.3V GND LC Excite LC Signal

📋 Pin Connection Table

HX711 Pin ESP32 Pin Wire Colour Description
DOUT GPIO12 Blue Serial data output from HX711
SCK GPIO14 Yellow Clock signal from ESP32
VCC 3.3V Red Power supply (3.3V from ESP32)
GND GND Black Common ground
E+ (Load Cell) HX711 E+ Red wire (LC) Excitation positive to load cell
E- (Load Cell) HX711 E- Black wire (LC) Excitation negative to load cell
A+ (Load Cell) HX711 A+ Green wire (LC) Signal positive from load cell
A- (Load Cell) HX711 A- White/Orange wire (LC) Signal negative from load cell

📝 Step-by-Step Instructions

1

Install Arduino IDE & ESP32 Board Package

Open Arduino IDE → File → Preferences. In "Additional Board Manager URLs" paste:


https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json

Then go to Tools → Board → Board Manager, search for esp32 and install the Espressif package.

2

Install HX711 Library

Go to Sketch → Include Library → Manage Libraries. Search for HX711 and install the library by Bogdan Necula or Rob Tillaart.

  • Library: HX711 by Bogdan Necula
  • Version: Latest stable
  • Include: #include "HX711.h" in your sketch
3

Wire the Hardware

Follow the pin connection table above carefully:

  • Connect HX711 DOUT → ESP32 GPIO12
  • Connect HX711 SCK → ESP32 GPIO14
  • Connect HX711 VCC → ESP32 3.3V (do NOT use 5V)
  • Connect HX711 GND → ESP32 GND
  • Wire your load cell's 4 wires to the HX711 E+, E-, A+, A- terminals
4

Upload the Base Code

Copy the code from the section below into a new Arduino sketch. In Tools → Board, select your ESP32 model (e.g., "ESP32 Dev Module"). Select the correct COM port. Click Upload.

5

Calibrate the Scale

Place a known weight (e.g., 100g or 1kg) on the load cell. Open Serial Monitor at 115200 baud. Adjust the calibration factor scale.set_scale(2280.f) until the reading matches your known weight.

  • If reading is too high, increase the calibration number
  • If reading is too low, decrease the calibration number
  • Start fresh with scale.tare() to zero the scale
6

Verify Output in Serial Monitor

Open Tools → Serial Monitor at 115200 baud. You should see output like:

Weight: 0 kg
Weight: 1 kg
Weight: 1 kg
7

Add Wi-Fi (Optional Extension)

To enable full Wi-Fi functionality, extend the code to:

  • Add your Wi-Fi SSID and password credentials
  • Create a simple WebServer on port 80 to display weight
  • Or use HTTPClient to POST data to ThingSpeak/Blynk
  • Or use the MQTT PubSubClient library for broker integration
⚠️
Calibration is Critical!

The default calibration factor 2280.f is a starting point only. Every load cell is different — always calibrate with a known reference weight before trusting readings. The calibration value is typically between 1000 and 5000.

💡
Pro Tip: Averaging for Stability

The code uses scale.get_units(10) which averages 10 readings. Increase this number (e.g. 20) for more stable readings in vibration-prone environments, at the cost of slightly slower update rate.

💻 Arduino Code

ARDUINO C++  ·  ESP32_HX711_Weight.ino
/*
 * ESP32-Powered Wi-Fi Weight Sensor with HX711 Interface
 *
 * Connections:
 * - HX711 DATA pin → ESP32 GPIO12
 * - HX711 SCK  pin → ESP32 GPIO14
 * - HX711 VCC      → ESP32 3.3V
 * - HX711 GND      → ESP32 GND
 *
 * Tutorial: https://www.makemindz.com
 */

#include "HX711.h"

// Pin definitions
const int LOADCELL_DOUT_PIN = 12;  // GPIO12
const int LOADCELL_SCK_PIN  = 14;  // GPIO14

// HX711 instance
HX711 scale;

void setup() {
  Serial.begin(115200);
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

  // Wait for the HX711 to stabilize
  Serial.println("Initializing the scale...");
  delay(1000);

  if (scale.is_ready()) {
    Serial.println("HX711 is ready.");
  } else {
    Serial.println("HX711 not found. Check wiring!");
    while (1);  // Halt if not found
  }

  // Set calibration factor — adjust this for your load cell
  scale.set_scale(2280.f);
  scale.tare();  // Reset scale to 0
  Serial.println("Scale tared. Ready to weigh!");
}

void loop() {
  if (scale.is_ready()) {
    long reading = scale.get_units(10);  // Average of 10 samples
    Serial.print("Weight: ");
    Serial.print(reading);
    Serial.println(" kg");
  } else {
    Serial.println("HX711 not ready.");
  }

  delay(1000);  // Read every second
}

🚀 Try the Live Simulation

Simulate this entire circuit in your browser using Wokwi or Cirkit Designer — no hardware or installation required!

Key Features

🎯
24-bit Precision ADC

HX711 provides industrial-grade 24-bit resolution for highly accurate weight readings

📶
Wi-Fi Ready

Built-in ESP32 Wi-Fi eliminates the need for any external communication module

Real-Time Monitoring

1-second update cycle with averaged readings for stable, noise-free output

🔋
Low Power Consumption

ESP32 deep sleep modes available for battery-powered deployments

⚙️
Calibration Control

Simple single-variable calibration factor makes tuning straightforward

📦
Compact & Scalable

Minimal hardware footprint, easily expandable to LCD, MQTT, or cloud dashboards

🏭 Applications

⚖️ Smart Weighing Scales 🏭 Industrial Weight Monitoring 📦 Smart Inventory Management 🌾 Agriculture Load Monitoring 🚛 Logistics & Transportation 🏗️ Factory Automation 📊 IoT Measurement Dashboards 🔬 IoT Research Projects

🚀 Future Enhancements

📱 Mobile App Dashboard
☁️ Firebase / AWS Cloud
📊 Data Logging & Analytics
📩 SMS / Email Alerts
🔗 MQTT Broker Integration
🔋 Battery-Powered Version
🖥️ OLED / LCD Local Display
📈 ThingSpeak / Blynk

© 2026 MakeMindz · ESP32 Wi-Fi Weight Sensor Tutorial · All rights reserved

Comments

try for free