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

ESP32-Based Smart Home Monitoring System with GSM and Wi-Fi Connectivity

View and Edit Project In Cirkit DesignerImage of ESP32-Based Smart Home Monitoring System with GSM and Wi-Fi Connectivity

Circuit Documentation

Summary

This circuit is designed to monitor environmental conditions and control various devices based on sensor inputs. It uses an ESP32 microcontroller to read data from sensors, control actuators, and communicate with external devices via WiFi and GSM. The system includes temperature sensors, a light sensor, a current sensor, a door sensor, a servo motor, an LED, a buzzer, an SD card module, and an LCD display.

Component List

  1. ESP32 (30 pin)

    • Description: A powerful microcontroller with WiFi and Bluetooth capabilities.
    • Pins: EN, VP, VN, D34, D35, D32, D33, D25, D26, D27, D14, D12, D13, GND, Vin, D23, D22, TX0, RX0, D21, D19, D18, D5, TX2, RX2, D4, D2, D15, 3V3
  2. Sim800l

    • Description: A GSM module for sending and receiving SMS.
    • Pins: NET, RST, VCC, RXD, TXD, GND
  3. DHT 11

    • Description: A temperature and humidity sensor.
    • Pins: VCC, GND, DATA
  4. Door MC-38

    • Description: A magnetic door sensor.
    • Pins: S, GND
  5. Module LDR

    • Description: A light-dependent resistor module.
    • Pins: VCC, GND, DO, AO
  6. LED: Two Pin (white)

    • Description: A white LED.
    • Pins: cathode, anode
  7. Micro SD Card Module

    • Description: A module for reading and writing to micro SD cards.
    • Pins: cs, sck, mosi, miso, vcc, gnd
  8. ACS712 Current Sensor 5A 20A 30A

    • Description: A current sensor module.
    • Pins: 1, 2, GND, OUT, VCC
  9. Buzzer

    • Description: A simple buzzer for sound alerts.
    • Pins: PIN, GND
  10. 5v battery

    • Description: A 5V power source.
    • Pins: positive, negative
  11. Micro servo 9G

    • Description: A small servo motor.
    • Pins: GND, +5V, PWM
  12. 3.7v battery

    • Description: A 3.7V power source.
    • Pins: +, -
  13. 16x2 I2C LCD

    • Description: A 16x2 character LCD with I2C interface.
    • Pins: GND, VCC, SDA, SCL

Wiring Details

ESP32 (30 pin)

Sim800l

DHT 11

Door MC-38

Module LDR

LED: Two Pin (white)

Micro SD Card Module

ACS712 Current Sensor 5A 20A 30A

Buzzer

5v battery

Micro servo 9G

3.7v battery

16x2 I2C LCD

Documented Code

#include <WiFi.h>
#include <WebServer.h>
#include <Wire.h>
#include <LiquidCrystal_I2C.h>
#include <DHT.h>
#include <Servo.h>
#include <SD.h>
#include <SoftwareSerial.h>

#define DHTTYPE DHT11
#define DHTInsidePin 32
#define DHTOutsidePin 33
#define LDRPin 34
#define CurrentSensorPin 35
#define DoorSensorPin 27
#define ServoPin 25
#define BuzzerPin 26
#define LEDPin 15
#define SD_CS 23
#define GSM_TX 16
#define GSM_RX 17

// WiFi credentials
const char* ssid = "Your_SSID";
const char* password = "Your_PASSWORD";

// Components initialization
DHT dhtInside(DHTInsidePin, DHTTYPE);
DHT dhtOutside(DHTOutsidePin, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2);
Servo windowServo;
SoftwareSerial gsm(GSM_TX, GSM_RX);
WebServer server(80);

void setup() {
  Serial.begin(115200);
  gsm.begin(9600);

  // Initialize peripherals
  lcd.init();
  lcd.backlight();
  dhtInside.begin();
  dhtOutside.begin();
  windowServo.attach(ServoPin);
  pinMode(DoorSensorPin, INPUT_PULLUP);
  pinMode(LDRPin, INPUT);
  pinMode(BuzzerPin, OUTPUT);
  pinMode(LEDPin, OUTPUT);

  // SD card initialization
  if (!SD.begin(SD_CS)) {
    Serial.println("SD card initialization failed!");
  }

  // WiFi connection
  WiFi.begin(ssid, password);
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("\nWiFi connected.