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

ESP32-Based Smart Weighing Scale with Wi-Fi and Environmental Monitoring

View and Edit Project In Cirkit DesignerImage of ESP32-Based Smart Weighing Scale with Wi-Fi and Environmental Monitoring

Circuit Documentation

Summary

This circuit is designed to measure weight using a load cell and an HX711 amplifier, read temperature and humidity using a DHT22 sensor, and display the data on a 20x4 I2C LCD. The ESP32 microcontroller is used to process the data and send it to the Blynk IoT platform for remote monitoring.

Component List

  1. HX711 - Bridge Sensor Interface

    • Description: Amplifies the signal from the load cell and converts it to a digital signal.
    • Pins: E+, E-, A-, A+, B-, B+, GND, DATA (OUT), SCK (IN), 3.3/3.5V Supply
  2. DHT22

    • Description: Measures temperature and humidity.
    • Pins: +, Out, -
  3. Load Cell - Red/white/black/green

    • Description: Measures weight.
    • Pins: E+, A-, E-, A+
  4. Lcd 20x4 i2c

    • Description: Displays data on a 20x4 character LCD using I2C communication.
    • Pins: GND, 5V, SCA, SCL
  5. ESP32

    • Description: Microcontroller used for processing data and communication with the Blynk IoT platform.
    • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, VIN, 3V3, D15, D2, D4, RX2, TX2, D5, D18, D19, D21, RX0, TX0, D22, D23, BOOT

Wiring Details

HX711 - Bridge Sensor Interface

DHT22

Load Cell - Red/white/black/green**

Lcd 20x4 i2c

ESP32

Code Documentation

#define BLYNK_TEMPLATE_ID "TMPL6P-ui2uWk"
#define BLYNK_TEMPLATE_NAME "Timbangan 10 Kg"
#define BLYNK_AUTH_TOKEN "LvyVJ6w76SOZJhu0Z7ClDJvb4KbiSuZC"

#include <WiFi.h>
#include <BlynkSimpleEsp32.h>
#include <HX711.h>
#include <DHT.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>

// WiFi credentials
char ssid[] = "Kost Pink";
char pass[] = "Rumahkami12345678";

// HX711 pins
#define LOADCELL_DOUT_PIN 4
#define LOADCELL_SCK_PIN 5

// DHT22 pin
#define DHTPIN 2
#define DHTTYPE DHT22

// Initialize HX711
HX711 scale;

// Initialize DHT22
DHT dht(DHTPIN, DHTTYPE);

// Initialize LCD
LiquidCrystal_I2C lcd(0x27, 20, 4);

void setup() {
  // Start serial communication
  Serial.begin(115200);

  // Connect to WiFi
  WiFi.begin(ssid, pass);
  while (WiFi.status() != WL_CONNECTED) {
    delay(1000);
    Serial.println("Connecting to WiFi...");
  }
  Serial.println("Connected to WiFi");

  // Connect to Blynk
  Blynk.begin(BLYNK_AUTH_TOKEN, ssid, pass);

  // Initialize HX711
  scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);

  // Initialize DHT22
  dht.begin();

  // Initialize LCD
  lcd.init();
  lcd.backlight();
  lcd.setCursor(0, 0);
  lcd.print("Initializing...");
}

void loop() {
  // Run Blynk
  Blynk.run();

  // Read weight from load cell
  float weight = scale.get_units(10);

  // Read temperature and humidity from DHT22
  float temperature = dht.readTemperature();
  float humidity = dht.readHumidity();

  // Display values on LCD
  lcd.clear();
  lcd.setCursor(0, 0);
  lcd.print("Weight: ");
  lcd.print(weight);
  lcd.print(" kg");
  lcd.setCursor(0, 1);
  lcd.print("Temp: ");
  lcd.print(temperature);
  lcd.print(" C");
  lcd.setCursor(0, 2);
  lcd.print("Humidity: ");
  lcd.print(humidity);
  lcd.print(" %");

  // Send values to Blynk
  Blynk.virtualWrite(V1, weight);
  Blynk.virtualWrite(V2, temperature);
  Blynk.virtualWrite(V3, humidity);

  // Wait before next loop
  delay(2000);
}

This code initializes the ESP32, connects it to WiFi and Blynk, and sets up the HX711, DHT22, and LCD. In the main loop, it reads the weight, temperature, and humidity, displays them on the LCD, and sends them to the Blynk platform.