Smart Gas Detector System

by NUR FARAHIN NABIHAH in Circuits > Arduino

522 Views, 0 Favorites, 0 Comments

Smart Gas Detector System

edd87aef-42e3-45c4-96aa-8c374d57e752.jpg
msg1061003761-16887.jpg
msg1061003761-16889.jpg

INTRODUCTION

Have you ever wanted to build a compact ESP8266 IoT Gas leak detection? If so, this Instructables is for you!

This detection can display data about your kitchen environment on your smartphone or computer using Telegram, an IoT platform. In this project we will create a fire or flame detector, also a gas detector, with Arduino and sensor. This optical flame sensor, gas sensor, allows to detect the existence of combustion by the light emitted by fire. Furthermore, this project will measure the ambient temperature using the desired sensors whether they are at normal or dangerous levels.

However, you can also build this project using a couple breakout boards from Adafruit. Check out the video to see how it works...

Supplies

1. NodeMCU esp8266 - http://surl.li/cglyx

2.Arduino UNO board - http://surl.li/cglzb

3. Small Breadboard - http://surl.li/cglzb

4. Jumper Wire Male to Male - http://surl.li/cglzb

5. Flame Sensor - http://surl.li/cglzb

6. MQ-5 Gas Sensor - http://surl.li/cglzb

7. Temperature Sensor DHT11 - http://surl.li/cglzb

8. USB Cable - http://surl.li/cglzb

HOW IT WORKS

Gas Leak Detection

As can be seen in the video showing the step-by-step manufacturing of the project by producing three types of output to the user as a preventive measure such as gas detection data, fire data and ambient temperature when performing any activity. In fact, WiFi is used to provide wireless communication, as Telegram Bot has guided users to know how to use it. IOT involvement in the gas leak detection project is to send information to users from time to time.

SETUP HARDWARE AND COMPONENT

circuit diagram.png
msg1061003761-16882.jpg
msg1061003761-16885.jpg

Insert nodemcu esp8266 to the breadboard

  • Temperature

Connect the Temperature sensor to pins on nodemcu esp8266.

1. Connect a jumper wire from + to Arduino 3V

2. Connect a jumper wire from out(e, 27) to Arduino D1

3. Connect a jumper wire from - to Arduino GND

  • Gas Leak

Connect the Gas Leak(MQ-5) sensor to pins on nodemcu esp8266.

1. Connect a jumper wire from VCC to Arduino 3V

2. Connect a jumper wire from GND to Arduino GND

3. Connect a jumper wire from (a, 9) to Arduino A0

  • Flame

Connect the Flame sensor 3 pins to pins on nodemcu ESP8266.

1. Connect a jumper wire from VCC to Arduino 3V

2. Connect a jumper wire from GND to Arduino GND

3. Connect a jumper wire from (a,16) Arduino D2

Lastly, USB for connection with power

Done setup component!!

CODE

Screenshot (842).png
Screenshot (840).png
  • Install ESP8266 Boards: (paste in Arduino preferences)

"https://arduino.esp8266.com/stable/package_esp8266com_index.json"

  • Install Libraries: (search for under sketch->include library->manage libraries)

"Sensor.h" - Adafruit

"DHT.h" - Temperature

"CTBot.h"-Telegram Bot

  • Code Changes:

Change WiFi SSID

Change WiFi PASSWORD

Add your previously saved Telegram Bot Token

  • Insert Micro SD Card and Upload Code

Downloads

TELEGRAM BOT

msg1061003761-16883.jpg

For our project, we will be creating a simple bot using Telegram. The rest of others will be coded in the ESP board itself, which will communicate to our bot using the chat ID.

1. Install Telegram from Play Store and make an account if you don't have one already and follow the next steps to get your TG bot working.

2. Search for “botfather” and click it . Or you can directly open this link t.me/botfather

on your smartphone.

Note: Botfather is a pre-built Telegram bot that lets you create,manage, and delete your bots.

3. Click on the start button and choose /newbot Give your bot a name and username.

4. If your bot is successfully created, you’ll receive a message with a link to access your newly created bot and the bot token.

Note: Bot token is a unique id used to communicate with the bot.

Steps for getting your Telegram User ID

5. In your Telegram account, search for “IDBot”.

6. Start a conversation with that bot and type /getid. You will get a reply back with your user ID. (user id as we’ll need it later)

Installing the Telegram Bot Library
7. Click this link to download the Universal Arduino Telegram Bot library

8. Go to Sketch > Include Library > Add.ZIP Library. Add the library you’ve just downloaded and the library is installed. Note: For details about the library, you can check out the Universal Arduino Telegram Bot Library GitHub page.

ArduinoJson Library
You also have to install the ArduinoJson library. Go to Sketch > Include Library > Manage Libraries. Search for “ArduinoJson”. Select the latest version available.Install the library.

Done installing all the required libraries.

Programming the esp8266 Based Telegram Bot

10. Firstly, we start with importing the required libraries.

11. After that, we initialize the variables to store the SSID and Password of your Wi-Fi.

Note: define the variables for holding the bot token and chat id. You need to put your credentials in these variables. Done setup Telegram Bot. Upload the above-mentioned code to your esp8266 board through Arduino IDE.

After uploading the sketch, press the EN/Reset button on the board, so that it starts executing the code. Open the serial monitor, and wait to get connected. Now, open Telegram and start a conversation with your bot by going to the link provided by Botfather and typing /start.

Done for setup!!

TEST THE GAS LEAK DETECTION

Smart Gas Leak Detection

Watch the video of the final demonstration of the project.

->Whether the condition is stable the notification will displayed example : Temperature, Humidity and No Leaking Gas

->If gas detected leak> send notification (“Warning, GAS LEAKING in your kitchen!!”)

->Notification in telegram bot will send the “Warning, FLAME” when detected the Flame

CONCLUSION

To conclude that the detection of smart gas is unusual in the project system. Gas is very useful in industrial and domestic purposes, especially for cooking activities. We took the initiative to develop a system that could save lives before untoward incidents occur. The creation of the gas leak detection project system which includes IoT structuring has given technological development to individual home dwellers.

Our hope is that this project can help others find their way in the exciting world of electronics, robotics and IoT See you at our next instructable!

Thank you