Cirkit Designer Logo
Cirkit Designer
Your all-in-one circuit design IDE
Home / 
Project Documentation

ESP32-Based Smart Air Quality and Vibration Monitoring System with Web Control

Image of ESP32-Based Smart Air Quality and Vibration Monitoring System with Web Control

Circuit Documentation

Summary of the Circuit

The circuit is designed to monitor and control various devices based on environmental inputs. It includes a vibration sensor (SW-420), a smoke sensor (MQ-2), a DC motor speed controller (CCMHC 10A), a power supply (12V 5A), two DC motors, an exhaust fan, three LEDs (red, yellow, green), a resistor, an LM2596 step-down module, an ESP32 microcontroller, four solid-state relays (SSR-40A and SSR-25A), two limit switches, two fuses, a circuit breaker, and an AC supply. The ESP32 microcontroller is programmed to detect vibrations and smoke, control an exhaust fan and a DC motor, and provide visual alerts using LEDs. It also hosts a web server for remote monitoring and control.

Component List

CCMHC 10A DC Motor Speed Controller (PWM)

  • Description: A PWM-based controller for adjusting the speed of a DC motor.
  • Pins: Power+, Power-, Motor+, Motor-

MQ-2 SENSOR

  • Description: A gas sensor for detecting smoke and other gases.
  • Pins: VCC, GND, A0, D0

POWER SUPPLY 12V 5AMP

  • Description: A power supply unit that provides 12V DC output from a 220V AC input.
  • Pins: 220V Positive Pole (AC), 220V Negative Pole (AC), GND, GND (DC), 12V-24V Output (DC)

DC Motor

  • Description: An electric motor that runs on direct current (DC) electricity.
  • Pins: pin 1, pin 2

Exhaust Fan 12"

  • Description: A 12-inch fan used for ventilation.
  • Pins: Live, Neutral

LED: Two Pin (red, green, yellow)

  • Description: Light Emitting Diodes used for status indication.
  • Pins: cathode, anode

Resistor

  • Description: A passive two-terminal electrical component that implements electrical resistance.
  • Pins: pin1, pin2
  • Properties: Resistance - 200 Ohms

LM2596 Step Down Module

  • Description: A voltage regulator that steps down input voltage to a lower output voltage.
  • Pins: OUT-, OUT+, IN-, IN+

ESP32 (30 pin)

  • Description: A microcontroller with Wi-Fi capabilities for controlling and monitoring the circuit.
  • 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

SSR-40A

  • Description: Solid-state relays for switching high currents using low voltage control signals.
  • Pins: -, +, Lin, Lout

SSR-25A

  • Description: A solid-state relay for switching moderate currents.
  • Pins: -, +, 1-in, 2-out

Limit Switch

  • Description: A switch that is actuated by the motion of a machine part or presence of an object.
  • Pins: S, G, V

Fuse

  • Description: A safety device that protects an electrical circuit from excessive current.
  • Pins: Terminal 1, Terminal 2

Circuit Breaker

  • Description: An automatically operated electrical switch designed to protect an electrical circuit from damage caused by overload or short circuit.
  • Pins: -, +

Ac Supply

  • Description: A source of alternating current (AC) electricity.
  • Pins: +ve, -ve

SW-420 Vibration Sensor

  • Description: A sensor that detects vibrations.
  • Pins: vcc, Ground, Digital output

Wiring Details

CCMHC 10A DC Motor Speed Controller (PWM)

  • Power+ connected to 12V-24V Output (DC) of POWER SUPPLY 12V 5AMP
  • Power- connected to GND (DC) of POWER SUPPLY 12V 5AMP
  • Motor+ connected to Lout of SSR-40A
  • Motor- connected to Lin of SSR-40A

MQ-2 SENSOR

  • VCC connected to OUT+ of LM2596 Step Down Module
  • GND connected to OUT- of LM2596 Step Down Module
  • A0 connected to D4 of ESP32 (30 pin)

POWER SUPPLY 12V 5AMP

  • 220V Positive Pole (AC) connected to Terminal 2 of Fuse
  • 220V Negative Pole (AC) connected to Neutral of Exhaust Fan 12"
  • GND (DC) connected to Power- of CCMHC 10A DC Motor Speed Controller (PWM)
  • 12V-24V Output (DC) connected to Power+ of CCMHC 10A DC Motor Speed Controller (PWM)

DC Motor

  • pin 1 connected to Lin of SSR-40A
  • pin 2 connected to Lout of SSR-40A

Exhaust Fan 12"

  • Live connected to 2-out of SSR-25A
  • Neutral connected to 220V Negative Pole (AC) of POWER SUPPLY 12V 5AMP

LED: Two Pin (red, green, yellow)

  • cathode of all LEDs connected to pin2 of Resistor
  • anode of red LED connected to D14 of ESP32 (30 pin)
  • anode of yellow LED connected to D27 of ESP32 (30 pin)
  • anode of green LED connected to D26 of ESP32 (30 pin)

Resistor

  • pin1 connected to cathode of all LEDs
  • pin2 connected to OUT- of LM2596 Step Down Module

LM2596 Step Down Module

  • OUT+ connected to VCC of MQ-2 SENSOR, vcc of SW-420 Vibration Sensor, V of Limit Switch, and Vin of ESP32 (30 pin)
  • OUT- connected to GND of MQ-2 SENSOR, Ground of SW-420 Vibration Sensor, G of Limit Switch, and GND of ESP32 (30 pin)
  • IN+ connected to 12V-24V Output (DC) of POWER SUPPLY 12V 5AMP
  • IN- connected to GND (DC) of POWER SUPPLY 12V 5AMP

ESP32 (30 pin)

  • D34 connected to S of Limit Switch
  • D35 connected to S of Limit Switch
  • D32 connected to + of SSR-25A
  • D33 connected to + of SSR-40A
  • D25 connected to + of SSR-40A
  • D14 connected to anode of LED: Two Pin (red)
  • D27 connected to anode of LED: Two Pin (yellow)
  • D26 connected to anode of LED: Two Pin (green)
  • D19 connected to Digital output of SW-420 Vibration Sensor
  • D4 connected to A0 of MQ-2 SENSOR
  • GND connected to OUT- of LM2596 Step Down Module, GND of MQ-2 SENSOR, Ground of SW-420 Vibration Sensor, G of Limit Switch, and - of SSR-25A
  • Vin connected to OUT+ of LM2596 Step Down Module

SSR-40A

    • connected to GND of ESP32 (30 pin)
    • connected to D33 of ESP32 (30 pin)
  • Lin connected to Motor- of CCMHC 10A DC Motor Speed Controller (PWM)
  • Lout connected to Motor+ of CCMHC 10A DC Motor Speed Controller (PWM)

SSR-25A

    • connected to GND of ESP32 (30 pin)
    • connected to D32 of ESP32 (30 pin)
  • 1-in connected to Terminal 2 of Fuse
  • 2-out connected to Live of Exhaust Fan 12"

Limit Switch

  • S connected to D34 and D35 of ESP32 (30 pin)
  • G connected to GND of ESP32 (30 pin)
  • V connected to OUT+ of LM2596 Step Down Module

Fuse

  • Terminal 1 connected to + of Circuit Breaker
  • Terminal 2 connected to 220V Positive Pole (AC) of POWER SUPPLY 12V 5AMP and 1-in of SSR-25A

Circuit Breaker

    • connected to +ve of Ac Supply
    • connected to -ve of Ac Supply

Ac Supply

  • +ve connected to + of Circuit Breaker
  • -ve connected to - of Circuit Breaker

SW-420 Vibration Sensor

  • vcc connected to OUT+ of LM2596 Step Down Module
  • Ground connected to OUT- of LM2596 Step Down Module
  • Digital output connected to D19 of ESP32 (30 pin)

Documented Code

/*
 * This Arduino Sketch controls a vibration detector and a smoke detector.
 * If vibration is detected, it alerts the user via serial print and web.
 * If smoke is detected, it activates an exhaust fan through a solid-state relay.
 * The exhaust fan can also be controlled via web, and the DC motor can only
 * be controlled via web. It also sets up a web server to monitor the status
 * and control the fan and motor. Additionally, it uses LEDs to indicate the
 * status: green for