0% found this document useful (0 votes)
120 views3 pages

Smoke Detector

Uploaded by

Jasdeep Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
120 views3 pages

Smoke Detector

Uploaded by

Jasdeep Kaur
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiment No: 7

AIM: Design and Implementation of Smoke detector using Arduino Uno.

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

const int trigPin = 9;

const int echoPin = 10;

const int smokeSensorPin = A0;

const int buzzerPin = 8;

const int ledPin = 7;

// Smoke detection threshold

const int smokeThreshold = 300; // Adjust based on calibration

void setup() {

Serial.begin(9600); // Start serial communication

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);

duration = pulseIn(echoPin, HIGH);

distance = duration * 0.034 / 2;

// Read smoke level

int smokeLevel = analogRead(smokeSensorPin);

// Print values to Serial Monitor

Serial.print("Distance: ");

Serial.print(distance);

Serial.print(" cm | Smoke Level: ");

Serial.println(smokeLevel);

// Check for smoke

if (smokeLevel > smokeThreshold) {

digitalWrite(buzzerPin, HIGH); // Turn on buzzer

digitalWrite(ledPin, HIGH); // Turn on LED

} else {

digitalWrite(buzzerPin, LOW); // Turn off buzzer

digitalWrite(ledPin, LOW); // Turn off LED

delay(500); // Delay before the next reading

PROCEDURE:

1. Arduino Digital pin 0 is connected with the (+ve) pin of Buzzer


2. Arduino Digital pin 1 is connected with the (+ve) pin of LED1(green)
3. Arduino Digital pin 2 is connected with the (+ve) pin of LED2(red)
4. Arduino Analog pin A0 is connected with A0 Pin of MQ2 Gas sensor
5. Arduino 5v Power pin is connected with VCC pin of Gas sensor
6. Arduino GND Power pin is connected with GND pin of Gas sensor
7. Arduino GND Power pin is connected with (-ve) pins of LED’s with resistance
8. Arduino GND Power pin is connected with GND pins of a Buzzer with resistance.

CIRCUIT DIAGRAM :

PRECAUTIONS:

1. All the connections should be tight.


2. Handle the equipment carefully.
3. Compile and upload the correct program.
4. While connections take care of the pins of Jumper wires as they are very thin and can break very easily.

RESULT:

The smoke detector has been successfully designed and implemented in the lab.

You might also like