The circuit in question appears to be designed for a landslide monitoring system that utilizes an ESP32 microcontroller to interface with various sensors and modules. The system is capable of measuring soil moisture, temperature, humidity, and pressure, and it can alert users to potential landslide conditions via SMS messages. The circuit includes power management components, sensors for environmental data collection, a GSM module for communication, and indicators for local alerts.
3.7v Battery:
+
to Step Up Boost Power Converter VIN+
-
to Rocker Switch input
and other -
terminals as needed.Step Up Boost Power Converter, Adjustable Voltage Regulator:
VOUT+
to 7805 Vin
and other +
terminals as needed.VOUT-
to GND terminals.7805 Voltage Regulator:
Vin
from Step Up Boost Power Converter VOUT+
Gnd
to GND terminals.Vout
to VCC
terminals of sensors and ESP32 VIN
.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
connected as per the net list and code requirements.TXD
to ESP32 RX2
RXD
to ESP32 TX2
GND
to GND terminals.VCC
to 3.7v Battery +
.Water Sensors:
-
to GND terminals.+
to positive
terminals of Soil Moisture Modules.Soil Moisture Modules:
Analog
to ESP32 VP
, VN
, D34
respectively.Ground
to GND terminals.VCC
to 7805 Vout
.DHT11:
DATA
to ESP32 D35
GND
to GND terminals.VCC
to 7805 Vout
.HX711 Weighing Sensor Module:
A-
, A+
, E-
, E+
to corresponding Load Cell pins.GND
to GND terminals.VCC
to 7805 Vout
.DO/RX
to ESP32 D21
CK/TX
to ESP32 D22
.Load Cell:
E+
, A-
, E-
, A+
to corresponding HX711 pins.LEDs (Red, Green, Yellow):
anode
to ESP32 D32
, D33
, D23
respectively.cathode
to GND terminals.Buzzer:
PIN
to ESP32 D25
GND
to GND terminals.output
to SIM800L GND
and Step Up Boost Power Converter VIN-
.+
and -
terminals to corresponding power lines and GND.The code provided is for the ESP32 microcontroller and is written in C++ for the Arduino platform. The code is responsible for initializing and reading from the various sensors, determining the alert level based on sensor readings, and sending SMS alerts when necessary.
#include <DHT.h>
#include <HX711.h>
#include <HardwareSerial.h>
// Define SIM800L pins
#define SIM800_TX 17 // ESP32 TX pin to SIM800L RX
#define SIM800_RX 16 // ESP32 RX pin to SIM800L TX
// Define LED and buzzer pins
#define greenLED 23
#define yellowLED 32
#define redLED 33
#define buzzer 25
// Define moisture sensor pins for ESP32
#define moistureSensor1 36
#define moistureSensor2 39
#define moistureSensor3 34
// Define DHT sensor pin and type
#define DHTPIN 35 // GPIO for DHT data pin
#define DHTTYPE DHT22 // DHT 22 (AM2302)
// Define HX711 pins for pressure sensor
#define LOADCELL_DOUT_PIN 21
#define LOADCELL_SCK_PIN 22
// Create instances for HX711, SIM800L, and DHT
HX711 scale;
HardwareSerial sim800(1); // Use Serial1 on ESP32
DHT dht(DHTPIN, DHTTYPE); // Initialize DHT sensor
// Define thresholds
int lowMoistureThreshold = 1600; // Below this is wet (dangerous)
int highMoistureThreshold = 3000; // Above this is dry (safe)
float pressureThreshold = 3.0; // Threshold in kg for red alert
// Phone number to send SMS
String phoneNumber = "+918075461115"; // Replace with your phone number
void setup() {
Serial.begin(115200);
sim800.begin(9600, SERIAL_8N1, SIM800_RX, SIM800_TX);
// Initialize LED and buzzer pins
pinMode(greenLED, OUTPUT);
pinMode(yellowLED, OUTPUT);
pinMode(redLED, OUTPUT);
pinMode(buzzer, OUTPUT);
// Initialize DHT sensor
dht.begin();
// Initialize HX711 module
scale.begin(LOADCELL_DOUT_PIN, LOADCELL_SCK_PIN);
scale.set_scale(); // Calibrate scale to default
scale.tare(); // Reset scale to zero
Serial.println("Landslide Monitoring System Initialized with Temp, Humidity, and Pressure");
delay(1000);
}
void loop() {
// Read moisture sensor values
int moistureValue1 = analogRead(moistureSensor1);
int moistureValue2 = analogRead(moistureSensor2);
int moistureValue3 = analogRead(moistureSensor3);
int avgMoisture = (moistureValue1 + moistureValue2 + moistureValue3) / 3;
// Read temperature and humidity
float temperature = dht.readTemperature();
float humidity = dht.readHumidity();
// Read pressure from HX711
float pressure = scale.get_units(); // Value in kg
// Display sensor readings on Serial Monitor
Serial.print("Temperature: ");
Serial.print(temperature);
Serial.print(" °C, Humidity: ");
Serial.print(humidity);
Serial.print(" %, Pressure: ");
Serial.print(pressure);
Serial.println(" kg");
// Determine alert level
if (avgMoisture < lowMoistureThreshold || pressure >= pressureThreshold) {
// Red Alert for wet condition or high pressure
digitalWrite(greenLED, LOW);
digitalWrite(yellowLED, LOW);
digitalWrite(redLED, HIGH);
digitalWrite(buzzer, HIGH);
Serial.println("Status: Red Alert (Dangerous - Wet or High Pressure)");
// Send SMS for red alert
sendSMS("Red Alert! High landslide risk detected.\nTemp: " + String(temperature) + " °C, Humidity: " + String(humidity) + " %