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

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

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

Circuit Documentation

Summary

This document provides a detailed overview of a smart home security system circuit. The system is built around an ESP32 microcontroller and includes various sensors and modules to monitor environmental conditions and detect security breaches. The system is capable of sending alerts via SMS and displaying information on an OLED screen. The components used in this circuit include a DS3231 RTC module, vibration sensors, a GSM module, a push switch, a PIR motion sensor, a DHT22 temperature and humidity sensor, gas sensors, flame sensors, an OLED display, an IR sensor, and a relay.

Component List

  1. ESP32 38 PINS

    • Description: Main microcontroller
    • Pins: GND, 23, 22/SCL, 1, 2, 21/SDA, 19, 18, 5, 17/TX2, 16/RX2, 4, 0, 15, D1, D0, CLK, 3V3, EN, VP, VN, 34, 35, 32, 33, 25, 26, 27, 14, 12, 13, D2, D3, 11, 5V/VIN
  2. DS3231 RTC

    • Description: Real-time clock module
    • Pins: 32K, SQW, SCL, SDA, VCC, GND
  3. SW-420 Vibration Sensor

    • Description: Vibration sensor
    • Pins: vcc, Ground, Digital output
  4. SIM800L GSM Module

    • Description: GSM module for SMS communication
    • Pins: 5V, GND, VDD, SIM_TXD, SIM_RXD, RST
  5. 2Pin Push Switch

    • Description: Push button switch
    • Pins: Input +, Output +
  6. PIR Motion Sensor (Wokwi Compatible)

    • Description: Motion sensor
    • Pins: VCC, OUT, GND
  7. DHT22

    • Description: Temperature and humidity sensor
    • Pins: GND, VCC, DAT
  8. MQ-2

    • Description: Gas sensor
    • Pins: GND, VCC, ANALOG, Digital
  9. MQ-7 Breakout

    • Description: Carbon monoxide sensor
    • Pins: VCC, GND, DO, AO
  10. KY-026 Flame Sensor

    • Description: Flame sensor
    • Pins: A0, GND, VCC, D0
  11. OLED 1.3"

    • Description: OLED display
    • Pins: GND, VCC, SCL, SDA
  12. IR Sensor

    • Description: Infrared sensor
    • Pins: VCC, GND, D0
  13. 5v relay

    • Description: Relay module
    • Pins: Normally Open, Common terminal, Normally Closed, In, GND, VCC

Wiring Details

ESP32 38 PINS

DS3231 RTC

SW-420 Vibration Sensor

SIM800L GSM Module

2Pin Push Switch

PIR Motion Sensor (Wokwi Compatible)

DHT22

MQ-2

MQ-7 Breakout

KY-026 Flame Sensor

OLED 1.3"

IR Sensor

5v relay

Documented Code

#include <WiFi.h>
#include <ESPAsyncWebServer.h>
#include <Wire.h>
#include <RTClib.h>  // Commented out RTC library
#include <esp_camera.h>

// GSM Module Pins (using hardware Serial1)
#define RX_PIN 16
#define TX_PIN 17

// GSM Phone Number to Send SMS
#define PHONE_NUMBER "+639