This is an old revision of the document!
ESP32 smoke detector
Introduction
This project implements a simple, low-cost smoke and gas detection system using an ESP32 microcontroller, an MQ-2 gas sensor, and an active buzzer. The system reads analog gas/smoke concentration values via the MQ-2 sensor and sends this data periodically to a Firebase Realtime Database.
When dangerous gas levels are detected (above a configurable threshold — 300 in this project), the system triggers an audible alarm using a connected buzzer and sends an immediate alert email via IFTTT Webhooks integration.
A web-based frontend fetches data from Firebase and visualizes it using a graph, with gas/smoke values on the Y-axis and timestamps (converted from UNIX time) on the X-axis, displayed at regular 3-minute intervals.
Hardware Implementation
🧩 Components
Software Implementation
🖥️ Frontend
☁️ Backend
Firebase – serving as a cloud-hosted NoSQL data store for logging gas/smoke sensor values from the ESP32 microcontroller, data being structured by timestamp-based paths — e.g. /logs/1716760000/value — ensuring clean chronological ordering and ease of querying for frontend consumption
IFTTT - acting as an automation service, receiving webhook triggers from the ESP32 whenever gas/smoke levels exceed a defined threshold, instantly dispatching email alerts to notify the user in real time
📟 Embedded Software (ESP32)
Developed using the Arduino Framework, with the following libraries:
jandrassy/TelnetStream@^1.3.0 – Telnet-based debugging and serial stream
mobizt/Firebase Arduino Client Library for ESP8266 and ESP32@^4.4.17 – Interface for Firebase Realtime Database
mobizt/FirebaseJson@^3.0.9 – Lightweight JSON handler for embedded devices
coryjfowler/mcp_can@^1.5.1 – MCP2515 CAN bus interface library for OBD-II data access