This smart weighing system uses the ESP32-WROOM-32 microcontroller paired with the precision HX711 24-bit ADC to read measurements from a 50kg load cell and display real-time weight values on a 16×2 I2C LCD — all powered by a single 18650 Li-ion battery.
① Load Detection
50kg load cell converts mechanical force into a millivolt-level analog signal using strain gauges.
② Amplify & Convert
HX711 amplifies the signal and converts it to 24-bit digital data sent over a 2-wire protocol.
③ Process (ESP32)
ESP32 reads digital values, applies calibration factor, converts to kg/g units.
④ Display Output
16×2 LCD via I2C shows live weight and status messages with only 2 data wires.
2Components Required
🔲
ESP32-WROOM-32
1× Development Board
⚖️
50kg Load Cell
1× Strain Gauge Sensor
🔬
HX711 Module
1× 24-bit ADC Amplifier
🖥️
16×2 LCD + I2C
1× with PCF8574 adapter
🔋
18650 Li-ion Battery
1× 3.7V Cell
🔌
Rocker Switch
1× Power ON/OFF
🔩
Resistors
10kΩ × 2, 1kΩ × 2
🔗
Jumper Wires
Male-to-Male set
💡
Make sure your 16×2 LCD already has the I2C backpack module (PCF8574) soldered on. This reduces wiring from 6+ pins to just 4 (VCC, GND, SDA, SCL).
Secure the 50kg load cell to a rigid base plate. The cell must be fixed at one end (load side) and mounted at the other end. Ensure it is horizontal and level for accurate readings.
2
Connect Load Cell to HX711
Wire the four load cell leads to HX711: Red → E+, Black → E−, Green → A+, White/Yellow → A−. These are the excitation and signal lines for the Wheatstone bridge.
3
Wire HX711 to ESP32
Connect HX711 VCC to 3.3V, GND to GND, DT to GPIO4, and SCK to GPIO5. The HX711 uses a custom 2-wire serial protocol, not standard SPI or I2C.
4
Connect I2C LCD Display
Wire the 16×2 LCD (with I2C backpack): VCC → 3.3V, GND → GND, SDA → GPIO21, SCL → GPIO22. Note the default I2C address for PCF8574 is 0x27 or 0x3F.
5
Add Power Circuit
Connect the 18650 battery positive terminal through the rocker switch to ESP32 VIN. Connect the battery negative to GND. The rocker switch provides safe ON/OFF control.
6
Upload and Calibrate
Upload the sketch below. Open Serial Monitor at 115200 baud. Place a known weight on the scale, note the raw HX711 value, then calculate and set your calibration factor: calibration_factor = raw_reading / known_weight_kg.
7
Test and Verify
Power on with the rocker switch. The LCD should show "Initializing..." then display live weight in kg. Test with known weights (500g, 1kg, 5kg) to verify accuracy. Adjust calibration factor if needed.
⚠️
Calibration Note: Always perform a tare (zero) calibration with an empty scale before measuring. The calibration factor varies per load cell unit — always calibrate with a known reference weight.
5Arduino Code
📦
Install these libraries via Arduino IDE → Library Manager: HX711 by bogde, LiquidCrystal_I2C by Frank de Brabander.
C++ / Arduino · esp32_weighing_scale.ino
/*
* ESP32 Digital Weighing Scale
* MakeMindz.com — makemindz.com/2026/02/esp32-based-digital-weighing-scale.html
*
* Hardware: ESP32-WROOM-32, HX711, 50kg Load Cell,
* 16x2 I2C LCD, 18650 Battery, Rocker Switch
*
* Connections:
* HX711 DT → GPIO4 | HX711 SCK → GPIO5
* LCD SDA → GPIO21 | LCD SCL → GPIO22
*/#include <HX711.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
// ── Pin Definitions ──────────────────────────────────────────#defineHX711_DT_PIN4// HX711 Data pin#defineHX711_SCK_PIN5// HX711 Clock pin#defineLCD_I2C_ADDR0x27// Try 0x3F if display is blank#defineLCD_COLS16#defineLCD_ROWS2// ── Calibration ──────────────────────────────────────────────// Adjust this factor for your specific load cell.
// Formula: calibration_factor = raw_value / actual_weight_kgfloatcalibration_factor = -7050.0;
// ── Object Instances ──────────────────────────────────────────HX711scale;
LiquidCrystal_I2Clcd(LCD_I2C_ADDR, LCD_COLS, LCD_ROWS);
// ── Setup ────────────────────────────────────────────────────voidsetup() {
Serial.begin(115200);
Serial.println("ESP32 Digital Weighing Scale — MakeMindz");
// Initialize LCD
lcd.init();
lcd.backlight();
lcd.setCursor(0, 0);
lcd.print("MakeMindz Scale");
lcd.setCursor(0, 1);
lcd.print("Initializing...");
// Initialize HX711
scale.begin(HX711_DT_PIN, HX711_SCK_PIN);
scale.set_scale(calibration_factor);
scale.tare(); // Reset scale to zerodelay(2000);
lcd.clear();
lcd.setCursor(0, 0);
lcd.print("Weight:");
Serial.println("Scale ready. Place object on platform.");
}
// ── Main Loop ────────────────────────────────────────────────voidloop() {
if (scale.is_ready()) {
floatweight_kg = scale.get_units(5); // Average of 5 readings// Clamp negative noise to zeroif (weight_kg < 0) weight_kg = 0;
// Display on LCD
lcd.setCursor(0, 1);
lcd.print(" "); // Clear line 2
lcd.setCursor(0, 1);
if (weight_kg < 1.0) {
// Show grams if under 1kg
lcd.print((int)(weight_kg * 1000));
lcd.print(" g");
} else {
lcd.print(weight_kg, 3);
lcd.print(" kg");
}
// Serial output for calibration
Serial.print("Weight: ");
Serial.print(weight_kg, 3);
Serial.println(" kg");
} else {
Serial.println("HX711 not found. Check wiring.");
lcd.setCursor(0, 1);
lcd.print("Sensor Error!");
}
delay(500);
}
// ── Calibration Helper (run once, then comment out) ──────────voidcalibrate() {
Serial.println("Starting calibration mode...");
scale.set_scale();
scale.tare();
Serial.println("Tare done. Add 1kg and wait...");
delay(5000);
longraw = scale.get_value(20);
Serial.print("Raw reading: ");
Serial.println(raw);
Serial.print("Set calibration_factor = ");
Serial.println(raw / 1.0); // Divide by weight in kg
}
7Simulation Links
Run and test this project online before building hardware. Use the links below for interactive circuit simulation:
How to use: Copy the diagram.json above → Open CirkitDesigner → New Project → Import JSON → Run simulation. The HX711 simulation allows you to manually input weight values to test LCD output.
8Possible Enhancements
☁️
Wi-Fi Cloud Upload
Send weight data to ThingSpeak, Blynk, or your own MQTT broker via ESP32 Wi-Fi.
📱
Mobile App Monitoring
Use Blynk or MIT App Inventor to build a custom mobile dashboard for live weight tracking.
🔋
Battery Level Display
Use ESP32 ADC to monitor 18650 voltage and show battery % on the second LCD row.
💾
SD Card Logging
Log timestamped weight readings to a microSD card using the SPI interface for data analysis.
🔔
Weight Threshold Alert
Add a buzzer or LED that triggers when weight exceeds a set limit — great for safety systems.
😴
Deep Sleep Mode
Use ESP32 deep sleep between measurements to extend battery life from hours to days.
Comments
Post a Comment