- LED Blink with Button
- Motion Detection Alarm System
- Simple RGB LED Controller
- Blinking LED with WebSocket Control
- Control LED Brightness using PWM
- Web Page with HTML and CSS on ESP32
- Control Multiple LEDs
- ESP32 with Bluetooth Serial Communication
- EEPROM with ESP32
- ESP32 Push Button Input: Reading Digital States
- Interfacing DHT11 Sensor
- Interfacing Ultrasonic Sensor
- Interfacing Flame Sensor
- Interfacing Sound Sensor
- Interfacing Potentiometer
- Interfacing IR Sensor
- Interfacing Servo Motor
- Interfacing Cam Wireless
- Interfacing DC Motor
- Interfacing Shock Sensor
- Interfacing Color Recognition Sensor
- Interfacing RFID Module
- TTGO LoRa32 SX1276 OLED
- Interfacing Keypad
- Interfacing Solenoid Lock
- Interfacing 16x2 LCD
- Interfacing Soil Moisture
- Interfacing MQ-7 Gas Sensor
- Interfacing Light Sleep Mode
- Interfacing Smart Light Control
- Interfacing (IoT) Weather Station
- Interfacing Web Server for Temperature Data Display
- Interfacing Home Automation System with Relay Control
- Interfacing IoT Smart Garden
- Face Recognition-Based Door Unlock System
- Interfacing Wi-Fi Jammer Detector
- Interfacing Health Band with Pulse
- Interfacing Sound Level Logger for Classrooms
- Night Vision Surveillance Camera
- Solar Panel Monitoring System
- Smart Farming Robot for Crop Surveillance
- Smart Water Quality Monitoring System
- Industrial IoT Gateway for Real-Time Monitoring
- Agriculture System with Automated Drone Control
An ESP32-Powered Flame Sensing System for Unstoppable Safety!
Introduction to ESP32 with Flame Sensor
A flame sensor is used to detect the presence of fire or flame. It is a critical component in fire detection systems and is capable of sensing light in the range of 760nm to 1100nm (infrared light). When integrated with the ESP32, it becomes a powerful tool for safety automation in both home and industrial settings.
Components Required
This project demonstrates how to connect a flame sensor to an ESP32 board to detect fire presence and output a response via Serial Monitor.
- Connect Flame Sensor VCC to ESP32 3.3V
- Connect Flame Sensor GND to ESP32 GND
- Connect Flame Sensor DO (Digital Out) to ESP32 GPIO 5
- Open Arduino IDE and install the ESP32 board definitions
- Select 'ESP32 Dev Module' from Tools > Board
- Connect ESP32 to your PC via USB
- Select the correct COM port
- Create a new sketch and paste the provided code
- Upload the code to the ESP32
- Open Serial Monitor and observe flame detection messages
Formula: Flame Detection = DO Pin Output (LOW when flame is detected)
Components List
- 1 × ESP32 Development Board
- 1 × Flame Sensor Module
- Jumper Wires
- Breadboard (optional)
Pin Configuration
- VCC: Connect to 3.3V of ESP32
- GND: Connect to GND of ESP32
- DO: Connect to GPIO 5 of ESP32
Ensure the sensor is oriented correctly toward the flame source and avoid direct sunlight for accurate results.
Wiring and Connections
- -> 3.3V
- -> GND
- -> GPIO 5
Code for ESP32 with Flame Sensor
1const int flamePin = 5;
2
3void setup() {
4 Serial.begin(115200);
5 pinMode(flamePin, INPUT);
6}
7
8void loop() {
9 int flameState = digitalRead(flamePin);
10 if (flameState == LOW) {
11 Serial.println("Flame Detected!");
12 } else {
13 Serial.println("No Flame.");
14 }
15 delay(1000);
16}
Code Explanation
- const int flamePin = 5;: Assigns GPIO 5 to the flame sensor’s digital output pin.
- pinMode(flamePin, INPUT);: Sets the GPIO pin as an input to read digital signals from the flame sensor.
- digitalRead(flamePin);: Reads the current state of the sensor—LOW means flame is detected.
- Serial.println(...);: Prints whether flame is detected or not on the Serial Monitor.
- delay(1000);: Introduces a 1-second delay between each reading.
Applications
- Fire detection and safety systems
- Smart firefighting robots
- Industrial fire monitoring
- Home fire alarm systems
Conclusion
You’ve successfully interfaced a flame sensor with the ESP32 using a digital output pin. This setup can detect the presence of a flame and alert users via Serial Monitor, offering a foundation for more complex safety systems.