{"id":28718123,"url":"https://github.com/jordymail/fire-and-smoke-detection-esp32","last_synced_at":"2025-07-01T00:07:43.154Z","repository":{"id":287433845,"uuid":"963543909","full_name":"JordyMail/Fire-and-Smoke-Detection-ESP32","owner":"JordyMail","description":"IoT-based environmental monitoring system using an ESP32 microcontroller. It integrates sensors for temperature, humidity, smoke, carbon monoxide (CO), and dust.","archived":false,"fork":false,"pushed_at":"2025-06-07T14:36:01.000Z","size":47,"stargazers_count":3,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-15T04:11:28.803Z","etag":null,"topics":["cpp","detections","fire","fire-and-smoke-detection","internet-of-things","mqtt-broker","sensors","smoke"],"latest_commit_sha":null,"homepage":"","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/JordyMail.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2025-04-09T20:56:53.000Z","updated_at":"2025-06-07T14:36:05.000Z","dependencies_parsed_at":"2025-05-17T06:26:52.307Z","dependency_job_id":"b4fe0514-47fd-4217-8429-cb4fa14b4b10","html_url":"https://github.com/JordyMail/Fire-and-Smoke-Detection-ESP32","commit_stats":null,"previous_names":["jordymail/smoke-detection-project","jordymail/fire-and-smoke-detection-esp32-"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/JordyMail/Fire-and-Smoke-Detection-ESP32","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JordyMail%2FFire-and-Smoke-Detection-ESP32","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JordyMail%2FFire-and-Smoke-Detection-ESP32/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JordyMail%2FFire-and-Smoke-Detection-ESP32/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JordyMail%2FFire-and-Smoke-Detection-ESP32/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/JordyMail","download_url":"https://codeload.github.com/JordyMail/Fire-and-Smoke-Detection-ESP32/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/JordyMail%2FFire-and-Smoke-Detection-ESP32/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262870875,"owners_count":23377313,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["cpp","detections","fire","fire-and-smoke-detection","internet-of-things","mqtt-broker","sensors","smoke"],"created_at":"2025-06-15T04:10:14.267Z","updated_at":"2025-07-01T00:07:43.121Z","avatar_url":"https://github.com/JordyMail.png","language":"C++","funding_links":[],"categories":[],"sub_categories":[],"readme":"\n# IoT Environmental Monitoring System with Fire and Smoke Detection (ESP32)\n\n## Project Benefits\n\nThis project is an **IoT-based environmental monitoring system** using an **ESP32** microcontroller. It integrates sensors for **temperature, humidity, smoke, carbon monoxide (CO), and dust** to:\n- Detect potential fire or smoke hazards in real-time.\n- Provide alerts through a buzzer and indicator LEDs.\n- Send sensor data to an MQTT broker for remote monitoring.\n- Improve safety and air quality awareness in homes, offices, warehouses, or labs.\n\n---\n\n## Hardware Requirements\n\n- **ESP32** (microcontroller)\n- **DHT22** (temperature \u0026 humidity sensor)\n- **MQ7** (carbon monoxide sensor)\n- **MQ135** (air quality / smoke sensor)\n- **Dust sensor** (optical-based)\n- **Buzzer**, **Red/Yellow/Green LEDs**\n- Wi-Fi connection\n- MQTT Broker (e.g., `broker.emqx.io`)\n\n---\n\n## Required Libraries\n\n- `WiFi.h`\n- `PubSubClient.h`\n- `DHT.h`\n- `ArduinoJson.h`\n\nInstall these via Arduino IDE Library Manager.\n\n---\n\n## Configuration\n\n- **Wi-Fi SSID**: `Your-Wifi-name, example: jo-wifi`\n- **Password**: `Your-passowrd-name, example: 123`\n- **MQTT Broker**: `broker.emqx.io`\n- **Port**: `1883`\n- **MQTT Topic**: `example: IoT/group8`\n  \n---\n## Monitoring Web\nclick this \u003ca href=\"https://github.com/JordyMail/iot-system-v1\"\u003eLink\u003c/a\u003e to direct you to the websiete monitorng repository\n\n## Sensor Design\n![CIRCUIT SMOKING DETECTION FIXXXX](https://github.com/user-attachments/assets/dafa3169-6f42-4310-9329-e16d24c4a585) \u003c/br\u003e\n\n\n## Code Overview\n\n### WiFi Setup\n\n```cpp\nvoid setupWifi()\n````\n\nConnects the ESP32 to the configured Wi-Fi network and prints the local IP address.\n\n---\n\n### MQTT Reconnection\n\n```cpp\nvoid reconnectMQTT()\n```\n\nAttempts to reconnect to the MQTT broker if disconnected, using client ID `ESP32Client`.\n\n---\n\n### Read Temperature \u0026 Humidity\n\n```cpp\nfloat readDHTTemperature()\nfloat readDHTHumidity()\n```\n\nReads values from the DHT22 sensor. Returns 0 if the reading fails.\n\n---\n\n### Dust Sensor Reading\n\n```cpp\nint readDustSensor()\n```\n\nTriggers the LED inside the dust sensor, reads analog value from dust pin, and calculates concentration.\n\n---\n\n### CO Conversion (MQ7)\n\n```cpp\nfloat convertMQ7(int rawValue)\n```\n\nConverts raw analog value into an estimated CO concentration in ppm using a basic formula.\n\n---\n\n### MQTT Publish\n\n```cpp\nvoid publishSensorData(...)\n```\n\nSends a JSON-formatted payload to the MQTT topic with sensor readings and environment status.\n\n---\n\n### Output Control\n\n```cpp\nvoid setOutputs(bool buzzer, bool red, bool yellow, bool green)\n```\n\nControls the buzzer and LEDs (ON/OFF) based on the condition detected.\n\n---\n\n### Setup\n\n```cpp\nvoid setup()\n```\n\n* Initializes sensors and pin modes.\n* Turns on the green LED as default state.\n* Connects to Wi-Fi and sets up MQTT.\n\n---\n\n### Main Loop\n\n```cpp\nvoid loop()\n```\n\n* Reads all sensor data.\n* Evaluates the following conditions:\n\n  * 🔴 **FIRE DETECTED**: MQ135 \u003e 1800, Temp \u003e 45°C, Dust \u003e 2000, Humidity \u003c 30%\n  * 🟡 **SMOKE DETECTED**: MQ135 \u003e 800 and CO \u003e 50 ppm\n  * 🟢 **NORMAL**: All values within safe range\n* Controls outputs and sends data via MQTT every second.\n\n---\n\n## Example JSON Payload\n\n```json\n{\n  \"temperature\": 30.5,\n  \"humidity\": 45.3,\n  \"dust\": 1000,\n  \"co\": 80.2,\n  \"air_quality\": 900,\n  \"status\": \"WARNING: Smoke detected\"\n}\n```\n\n---\n\n## Notes\n\n* For accurate CO measurement, calibrate the MQ7 sensor’s R0 resistance value.\n* MQTT data can be visualized using tools like Node-RED, ThingsBoard, or custom dashboards.\n* Can be extended with cloud logging or mobile notifications.\n\n---\n\n## License\n\nThis project is open-source and free to use for educational and non-commercial purposes.\n\n---\n\n## Contributors\n\nDeveloped by **Group 8** - IoT Project 2025\n\n\n### Hotel Room Design 1 (700cm x 320cm)\n\u003cimg src=\"https://github.com/user-attachments/assets/6dfe74dd-7e4b-40ed-97f6-004bd73f500d\" width=\"600\" height=\"auto\"\u003e \u003c/br\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/7f664707-1eb9-49b4-ab60-53efde93ba5c\" width=\"600\" height=\"auto\"\u003e \u003c/br\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/b0da6783-718f-4908-89d3-02926502c173\" width=\"600\" height=\"auto\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/7b36aaf9-586c-4d98-aeb0-4826dea5536a\" width=\"600\" height=\"auto\"\u003e\n\u003cimg src=\"https://github.com/user-attachments/assets/3a70fef4-8a12-4c4b-b101-34f77a80c59c\" width=\"600\" height=\"auto\"\u003e\n\n\n\n  \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjordymail%2Ffire-and-smoke-detection-esp32","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjordymail%2Ffire-and-smoke-detection-esp32","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjordymail%2Ffire-and-smoke-detection-esp32/lists"}