0% found this document useful (0 votes)
73 views11 pages

Introduction of IOT Smoke Detector Project

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

Introduction of IOT Smoke Detector Project

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

Introduction of IOT Smoke detector project:

This system is an improved alternative to the


traditional data logger system. We can also use a
data logger project to record the changes in
smoke. However, to view these records, the user
has to visit the data logger circuit and view the
records on an LCD or by connecting the circuit to a
laptop/computer.
In the IOT smoke detection system, historical data
can be seen from anywhere in the world. This is
possible due to the Internet of things techniques.
Due to IOT, the data is available over the could and
can be accessed using the internet and IOT
website. Also, with an increase in demand for
smart cities, the demand for smart homes is also
increasing. This smoke detector IOT project can
also be used in smart homes.

Description of IOT based Smoke Detector


Using Arduino:
We have interfaced the MQ2 gas sensor with
Arduino Uno. This MQ2 smoke sensor operates on 5
volts and provides the output in analog form. We
have connected this output to the “Analog 0” input
pin of Arduino. Arduino has an inbuilt Analog-to-
digital converter (ADC) that converts this analog
voltage into the respective digital value. Then
Arduino displays this value on an LCD display so
that people around the project can read the current
value of smoke.
 One of the important tasks of Arduino is to
monitor the smoke level. Arduino continuously
keeps on reading and displaying smoke value.
 After a certain time interval, it sends the data to
IOT over the cloud. We have used a GSM modem
to send the data over IOT. GSM modem makes
sure that IOT based fire alarm system using
Arduino can operate stand-alone providing
maximum internet connectivity.
 If the smoke crosses the danger level then it
immediately sends an SMS to the registered
mobile numbers.
 IOT smoke detector circuit has a buzzer that
informs people nearby in case smoke is increased
beyond a threshold limit.
 We have also provided a Relay in this project. We
have connected a small DC fan at the output of
this relay. The function of this fan is to help in
reducing the smoke level.

Technical Specifications of the IOT based


Smoke Detector Using Arduino project:
The main components used in this project are as
below:
 MQ2 smoke sensor
 Arduino Uno
 Sim900 or Sim800 GSM modem
 16 x 2 LCD display
 Piezoelectric buzzer
 12-volt Relay and a 12-volt DC fan
 1N4007 diodes, 1000microFarad capacitor, 100
microFarad capacitor, 7805, 7812
 LED, resistors, BC547 transistors, potentiometer,
various connectors

Applications and advantages of IOT smoke


detection system:
 The automatic smoke detector by using IoT
provides protection for life as well as protection
of property.
 This system requires minimal maintenance.
 This system immediately alerts the user
whenever smoke crosses the threshold level.
 One of the limitations of this project is that it
requires an internet connection all the time. This
limitation can be resolved by using a GSM
modem with a Simcard that has good network
connectivity.
 If we install multiple systems in a shopping
complex or residential building then the
firefighters can get the exact location of the fire.
They can also know the intensity of fire at various
places in that area.
 We can add a feature to dial a call to the fire
brigade as a part of future development.

Sofware specifications:
 Arduino IDE software is used to develop the
embedded C language code for IOT based Smoke
detector using Arduino.
 EAGLE PCB Layout software is used to design the
PCB layout of the IOT based Smoke detector
project.
 Any IOT platform or IOT website that can display
the values of the smoke sensor in Graphical
format.

Circuit Diagram: IoT Gas & Smoke Detector


This is the circuit diagram of the IoT Smoke &
Gas Leakage Detector using ESP8266.
Here I have interfaced the MQ2 sensor Analog
Pin A0 pin with the A0 pin of
ESP8266. VCC and GND are connected to
the 3.3 Volt and GND pins
of ESP8266 respectively. After that, I
connected the I2C OLED VCC pin to
the 3.3V pin of NodeMCU and its ground pin
to the ground. Its SCL and SDA pins to
the D1 and D2 pins of NodeMCU. After that, I
connected an LED anode pin to the D5 pin and
its cathode pin to the ground. Lastly, I
connected the buzzer’s positive pin to
the D6 pin of the NodeMCU and its negative
pin to the Ground pin.

CODE:
#include <Wire.h>

#include <PubSubClient.h> // MQTT library

#include <ESP8266WiFi.h> // ESP8266 Wi-Fi library

#define WIFI_SSID "Your_WiFi_SSID"

#define WIFI_PASSWORD "Your_WiFi_Password"

#define MQTT_SERVER "MQTT_Broker_IP"

#define MQTT_PORT 1883


#define MQTT_USER "Your_MQTT_Username"

#define MQTT_PASSWORD "Your_MQTT_Password"

#define MQTT_CLIENT_ID "SmokeGasDetector"

#define SMOKE_SENSOR_PIN A0

#define GAS_SENSOR_PIN A1

WiFiClient espClient;

PubSubClient client(espClient);

void setup_wifi() {

delay(10);

Serial.println();

Serial.print("Connecting to ");

Serial.println(WIFI_SSID);

WiFi.begin(WIFI_SSID, WIFI_PASSWORD);

while (WiFi.status() != WL_CONNECTED) {

delay(500);

Serial.print(".");

Serial.println("");

Serial.print("WiFi connected - IP address: ");


Serial.println(WiFi.localIP());

void callback(char* topic, byte* payload, unsigned int length) {

// Handle received MQTT messages if needed

void reconnect() {

while (!client.connected()) {

Serial.print("Attempting MQTT connection...");

if (client.connect(MQTT_CLIENT_ID, MQTT_USER, MQTT_PASSWORD)) {

Serial.println("connected");

client.subscribe("smoke_gas_detector");

} else {

Serial.print("failed, rc=");

Serial.print(client.state());

Serial.println(" try again in 5 seconds");

delay(5000);

}
void setup() {

Serial.begin(9600);

setup_wifi();

client.setServer(MQTT_SERVER, MQTT_PORT);

client.setCallback(callback);

void loop() {

if (!client.connected()) {

reconnect();

client.loop();

int smokeValue = analogRead(SMOKE_SENSOR_PIN);

int gasValue = analogRead(GAS_SENSOR_PIN);

Serial.print("Smoke Sensor Value: ");

Serial.println(smokeValue);

Serial.print("Gas Sensor Value: ");

Serial.println(gasValue);

// Send sensor values to MQTT topic


char smokeMsg[20];

char gasMsg[20];

sprintf(smokeMsg, "%d", smokeValue);

sprintf(gasMsg, "%d", gasValue);

client.publish("smoke_gas_detector/smoke", smokeMsg);

client.publish("smoke_gas_detector/gas", gasMsg);

delay(1000); // Adjust delay as needed

You might also like