Circuit Documentation
Summary
The circuit in question is designed to measure weight using a Load Sensor (50kg capacity) interfaced with an HX711 Weighing Sensor Module. The data from the HX711 is processed by an ESP32-WROOM-32UE microcontroller, which also controls an LCD Display (16x4 I2C) to show the measured weight. Power management is handled by a 18650 battery in a holder, with a Rocker Switch to control the power flow. The circuit includes two resistors for potential voltage division or current limiting purposes.
Component List
Microcontroller
- ESP32-WROOM-32UE: A powerful microcontroller with Wi-Fi and Bluetooth capabilities, featuring a wide range of GPIO pins for interfacing with various sensors and peripherals.
Sensors
- Load Sensor - 50kg: A strain gauge-based sensor used for measuring weight up to 50 kilograms.
- HX711 Weighing Sensor Module: A precision 24-bit analog-to-digital converter (ADC) designed for weigh scales and industrial control applications to interface directly with a bridge sensor.
Power Supply
- 18650 in holder: A rechargeable lithium-ion battery used to power the circuit.
Display
- LCD Display 16x4 I2C: An alphanumeric liquid crystal display capable of showing 4 lines of 16 characters each, with an I2C interface for communication with the microcontroller.
Passive Components
- Resistor: Two resistors, each with a resistance of 200 Ohms, possibly used for current limiting or voltage division.
Switch
- Rocker Switch: A switch to control the on/off state of the circuit.
Wiring Details
ESP32-WROOM-32UE
3v3connected to HX711VCCand LCD DisplayVCCGNDconnected to HX711GND, LCD DisplayGND, and 18650 battery holderGND5Vconnected to one terminal of the Rocker Switch18(SCK) connected to HX711CK/TX19(DOUT) connected to HX711DO/RX22(SCL) connected to LCD DisplaySCL21(SDA) connected to LCD DisplaySDA
Load Sensor - 50kg
Wconnected to HX711A-Rconnected to HX711E+and one end of a 200 Ohm ResistorBconnected to HX711E-and one end of another 200 Ohm Resistor
HX711 Weighing Sensor Module
A-connected to Load SensorWA+connected to the other end of the 200 Ohm ResistorE+connected to Load SensorRand one end of a 200 Ohm ResistorE-connected to Load SensorBand the other end of the 200 Ohm ResistorVCCconnected to ESP323v3CK/TXconnected to ESP3218DO/RXconnected to ESP3219GNDconnected to ESP32GND
18650 in holder
GNDconnected to ESP32GNDVCCconnected to the other terminal of the Rocker Switch
Rocker Switch
- One terminal connected to 18650 battery holder
VCC - The other terminal connected to ESP32
5V
LCD Display 16x4 I2C
SCLconnected to ESP3222SDAconnected to ESP3221VCCconnected to ESP323v3GNDconnected to ESP32GND
Documented Code
ESP32-WROOM-32UE Code
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include "HX711.h"
// HX711 circuit wiring
const int LOADCELL_DOUT_PIN = 19;
const int LOADCELL_SCK_PIN = 18;
HX711 scale;
LiquidCrystal_I2C lcd(0x27, 16, 2); // Set the LCD address to 0x27 for a 16 chars and 2 line display
void setup() {
Serial.begin(115200);
lcd.begin();
lcd.backlight();
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
scale.set_scale(); // Adjust to this calibration factor
scale.tare(); // Reset the scale to 0
lcd.setCursor(0, 0);
lcd.print("Weight:");
}
void loop() {
if (scale.is_ready()) {
float weight = scale.get_units(10); // Get the average of 10 readings
Serial.print("Weight: ");
Serial.print(weight);
Serial.println(" kg");
lcd.setCursor(0, 1);
lcd.print(weight);
lcd.print(" kg "); // Clear any extra characters
} else {
Serial.println("HX711 not found.");
}
delay(1000);
}
This code initializes the HX711 and the LCD display. In the loop, it checks if the HX711 is ready to read the weight, takes the average of 10 readings, and then prints the weight to the serial monitor and the LCD display. If the HX711 is not found, it prints an error message to the serial monitor.
