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

Arduino UNO Gas Leak Detection System with Buzzer and Servo Motor

View and Edit Project In Cirkit DesignerImage of Arduino UNO Gas Leak Detection System with Buzzer and Servo Motor

Circuit Documentation

Summary

This circuit is designed to detect gas levels using an MQ2 gas sensor and respond by activating a buzzer and a micro servo motor. The system is controlled by an Arduino UNO microcontroller. When the gas level exceeds a certain threshold, the buzzer sounds, and the servo motor moves to a specified position.

Component List

  1. MQ2 Gas Sensor

    • Pins: VCC, GND, AOUT, DOUT
    • Description: Detects gas levels in the environment.
    • Purpose: Senses gas levels and sends a digital signal to the Arduino.
  2. AC Wire

    • Pins: Line, Earth, Neutral
    • Description: Standard AC wire for power connections.
    • Purpose: Provides power connections in the circuit.
  3. AC Wire

    • Pins: GND, Phase
    • Description: Standard AC wire for power connections.
    • Purpose: Provides power connections in the circuit.
  4. Arduino UNO

    • Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
    • Description: Microcontroller board based on the ATmega328P.
    • Purpose: Controls the entire circuit, processes sensor data, and drives the output devices.
  5. Buzzer

    • Pins: PIN, GND
    • Description: Emits sound when activated.
    • Purpose: Provides an audible alert when gas levels are high.
  6. Micro Servo 9G

    • Pins: GND, +5V, PWM
    • Description: Small servo motor.
    • Purpose: Moves to a specified position when gas levels are high.
  7. IRFZ44N

    • Pins: Gate, Drain, Source
    • Description: N-channel MOSFET.
    • Purpose: Acts as a switch in the circuit.
  8. Resistor

    • Pins: pin1, pin2
    • Description: 200 Ohms resistor.
    • Purpose: Limits current in the circuit.

Wiring Details

MQ2 Gas Sensor

AC Wire

AC Wire

AC Wire

AC Wire

Arduino UNO

Buzzer

Micro Servo 9G

IRFZ44N

Resistor

Code Documentation

#include <Servo.h>
#define gas_sensor  A0
#define buzzer      8

int sensor_value;
Servo servo;

void setup() {
  Serial.begin(9600);
  pinMode(buzzer, OUTPUT);
  servo.attach(9); //servo motor signal pin attached to arduino pin 9
  servo.write(2); //regulator on
}

void loop() {
  sensor_value = analogRead(gas_sensor);
  Serial.println(sensor_value);
  if (sensor_value > 500) // change this value according to sensitivity of gas
  {
    digitalWrite(buzzer, HIGH);
    servo.write(130);
  }
  else
  {
    digitalWrite(buzzer, LOW);
    servo.write(5);
  }
  delay(500);
}

This code initializes the gas sensor, buzzer, and servo motor. In the loop function, it continuously reads the gas sensor value. If the gas level exceeds the threshold (500 in this case), the buzzer is activated, and the servo motor moves to 130 degrees. If the gas level is below the threshold, the buzzer is deactivated, and the servo motor returns to 5 degrees.