This is an old revision of the document!


Smoke/ Gas detector

Description

This project aims to develop a Smoke/Combustible Gas detector using ESP32 and MQ-2 sensor. ThingSpeak provides data ingestion and storage for the sensor, with the possibility to build Matlab algorithms to make the system smarter. When a certain threshold is exceeded ESP32 sends an email alert to signal the owner of the building/apartment that a gas leakage has occurred. Also to set up Wifi credentials without hardcoding the SSID and password directly in code, a prior bluetooth connection is established via smartphone, using Bluetooth Terminal HC-05 application.

Hardware Implementation

The hardware schematic contains the following devices:

- ESP32-WROOM-32 (integrated Wifi and Bluetooth)
- MQ-2 Smoke/Combustible Gas sensor
- 5V battery, or any device that can provide 5V (e.g. Arduino Uno 5V pin)

Software Implementation

The following steps describe the functionality of the project:

- boot/reboot device
- introduce Wifi credentials and connect to it
- read data coming from MQ-2 sensor
- publish data on ThingSpeak
- if value is above threshold enter in 'aware state' (read 5 times and see if 2 high values above the threshold are met, if so it means that gas is detected in the room)
- if gas detected in room send email to the owner.
Down below you can check the software diagram.

software_diagram.png

Wifi Connection

The Wifi connection is set up using Bluetooth using Bluetooth Teminal HC-5 application. First connect to the Bluetooth device using the app and give Wifi credentials (SSID and password). After that the Wifi connection is established and the Bluetooth connection is disabled. Wifi and Bluetooth use the same antenna on ESP32 devices and they cannot coexist. The Wifi credentials are saved and loaded every time the ESP device is powered. If you want to change the credentials just reboot the device and introduce them again in application.

ThingSpeak Data Ingestion

Every time data is read from the sensor it is saved online through ThingSpeak API along with Wifi received signal strength indicator (RSSI). I used a ThingSpeak private channel to do that, and data can also be viewed in real time on mobile phone with ThingView Free app.

Resources

iothings/proiecte/2021/gasdetector.1642706621.txt.gz · Last modified: 2022/01/20 21:23 by narcisa.guran
CC Attribution-Share Alike 3.0 Unported
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0