Arduino UNO and ESP32-CAM Based Smart Fire and Gas Detection System with Battery Power
View and Edit Project In Cirkit Designer
Circuit Documentation
Summary
This circuit is designed to integrate multiple sensors and a camera module with an Arduino UNO microcontroller. The sensors include a KY-026 Flame Sensor, an MQ-2 Gas Sensor, and a DHT22 Temperature and Humidity Sensor. Additionally, an ESP32-CAM module is used for capturing images. The entire system is powered by two 18650 Li-ion batteries.
Component List
KY-026 Flame Sensor
- Description: A sensor used to detect flame or fire.
- Pins: A0, GND, VCC, D0
Arduino UNO
- Description: A microcontroller board based on the ATmega328P.
- Pins: UNUSED, IOREF, Reset, 3.3V, 5V, GND, Vin, A0, A1, A2, A3, A4, A5, SCL, SDA, AREF, D13, D12, D11, D10, D9, D8, D7, D6, D5, D4, D3, D2, D1, D0
MQ-2 Gas Sensor
- Description: A sensor used to detect gas leaks.
- Pins: GND, VCC, ANALOG, Digital
DHT22 Temperature and Humidity Sensor
- Description: A sensor used to measure temperature and humidity.
- Pins: +, Out, -
ESP32-CAM
- Description: A camera module with an ESP32 microcontroller.
- Pins: 5V, GND, IO12, IO13, IO15, IO14, IO2, IO4, VOT, VOR, VCC, IO0, IO16, 3V3
18650 Li-ion Battery x 2
- Description: Two 18650 Li-ion batteries used to power the circuit.
- Pins: +, -
Wiring Details
KY-026 Flame Sensor
- GND connected to GND of Arduino UNO, MQ-2, DHT22, 18650 Li-ion Battery, and ESP32-CAM.
- VCC connected to 5V of Arduino UNO, MQ-2, DHT22, 18650 Li-ion Battery, and ESP32-CAM.
- D0 connected to D2 of Arduino UNO.
Arduino UNO
- GND connected to GND of KY-026 Flame Sensor, MQ-2, DHT22, 18650 Li-ion Battery, and ESP32-CAM.
- 5V connected to VCC of KY-026 Flame Sensor, MQ-2, DHT22, 18650 Li-ion Battery, and ESP32-CAM.
- D2 connected to D0 of KY-026 Flame Sensor.
- D3 connected to Out of DHT22.
- A0 connected to ANALOG of MQ-2.
- D7 connected to VOR of ESP32-CAM.
- D6 connected to VOT of ESP32-CAM.
MQ-2 Gas Sensor
- GND connected to GND of Arduino UNO, KY-026 Flame Sensor, DHT22, 18650 Li-ion Battery, and ESP32-CAM.
- VCC connected to 5V of Arduino UNO, KY-026 Flame Sensor, DHT22, 18650 Li-ion Battery, and ESP32-CAM.
- ANALOG connected to A0 of Arduino UNO.
DHT22 Temperature and Humidity Sensor
- - connected to GND of Arduino UNO, KY-026 Flame Sensor, MQ-2, 18650 Li-ion Battery, and ESP32-CAM.
- + connected to 5V of Arduino UNO, KY-026 Flame Sensor, MQ-2, 18650 Li-ion Battery, and ESP32-CAM.
- Out connected to D3 of Arduino UNO.
ESP32-CAM
- GND connected to GND of Arduino UNO, KY-026 Flame Sensor, MQ-2, DHT22, and 18650 Li-ion Battery.
- 5V connected to 5V of Arduino UNO, KY-026 Flame Sensor, MQ-2, DHT22, and 18650 Li-ion Battery.
- VOR connected to D7 of Arduino UNO.
- VOT connected to D6 of Arduino UNO.
18650 Li-ion Battery x 2
- - connected to GND of Arduino UNO, KY-026 Flame Sensor, MQ-2, DHT22, and ESP32-CAM.
- + connected to 5V of Arduino UNO, KY-026 Flame Sensor, MQ-2, DHT22, and ESP32-CAM.
Documented Code
Arduino UNO Code
void setup() {
// put your setup code here, to run once:
}
void loop() {
// put your main code here, to run repeatedly:
}
This code is a basic template for the Arduino UNO. The setup() function is where you initialize your sensors and other components, and the loop() function is where you write the main logic that will run repeatedly.