Smoke Detector
Smoke Detector
APPARATUS REQUIRED :
1. Arduino Uno
2. MQ2 gas Sensor
3. Jumper wire
4. Buzzer
5. Potentiometer
6. Power supply / Battery.
THEORY :
In this circuit, the MQ2 gas sensor continuously monitors the smoke level in the environment by sending
analog values to the Arduino. The Arduino processes this data and compares it to a predefined threshold.
If the smoke level exceeds the threshold, the Arduino activates a red LED to signal danger and triggers a
buzzer for an audible alarm. Conversely, if the smoke level is below the threshold, the Arduino illuminates
a green LED to indicate a safe environment. This setup provides a simple yet effective smoke detection
system, alerting users to potential hazards with both visual and auditory signals.
PROGRAM USED:
#include <Servo.h>
// Pin definitions
void setup() {
pinMode(trigPin, OUTPUT);
pinMode(echoPin, INPUT);
pinMode(buzzerPin, OUTPUT);
pinMode(ledPin, OUTPUT);
void loop() {
long duration, distance;
// Ultrasonic sensor
digitalWrite(trigPin, LOW);
delayMicroseconds(2);
digitalWrite(trigPin, HIGH);
delayMicroseconds(10);
digitalWrite(trigPin, LOW);
Serial.print("Distance: ");
Serial.print(distance);
Serial.println(smokeLevel);
} else {
PROCEDURE:
CIRCUIT DIAGRAM :
PRECAUTIONS:
RESULT:
The smoke detector has been successfully designed and implemented in the lab.