A fire detection system using an ESP32 board, KY-026 Flame Sensor, and a buzzer works by detecting the presence of a flame and activating an alarm to alert people nearby. This setup is simple and effective for fire detection in small areas, thanks to the ESP32's ability to process sensor data and trigger actions.
The KY-026 Flame Sensor is connected to one of the digital input pins on the ESP32. This sensor has both analog and digital outputs, though typically, the digital output is used for simple fire detection.
When a flame is detected, the KY-026 outputs a low digital signal (logic 0) to the ESP32. This signal change is what the ESP32 monitors.
The ESP32 continuously checks the sensor’s output. When it detects a signal indicating the presence of a flame, it triggers the buzzer to alert people in the area.
ESP32 Board:
The main controller that reads the sensor data from the KY-026 Flame Sensor and activates the buzzer.
KY-026 Flame Sensor:
Detects infrared light emitted by flames. The sensor outputs a digital signal to the ESP32 when it detects a flame or high heat source.
Buzzer:
Acts as an alert mechanism, producing a loud sound when a flame is detected.
Jumper Wires:
For making temporary connections and wiring between components.
Breadboard:
A breadboard is a useful tool for creating temporary electronic circuits. It allows you to connect components without soldering.
To perform the assembly, you can connect :
the buzzer terminal (+) to pin D4 of the ESP32 board
the buzzer terminal (-) to the GND pin of the ESP32 board
pin DO of the flame sensor to pin D34 of the ESP32 board the VCC
pin of the flame sensor to the 3.3V pin of the ESP32 board
the GND pin of the flame sensor to the GND pin of the ESP32 board
Here is the program of the fire detection system:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
from machine import Pin, ADC from time import sleep flamePin = ADC(Pin(34)) flamePin.atten(ADC.ATTN_11DB) #Full range: 3.3v buzzer=Pin(4,Pin.OUT) while True: flame_value = flamePin.read() print(pot_value) sleep(0.1) if (flame_value<4095): #if the sensor detects a flame buzzer.value(1) #the buzzer sounds else: buzzer.value(0) #the buzzer stops ringing |
Explanation of the Code
The flamePin is defined for reading the KY-026 output, while the buzzerPin is for controlling the buzzer.
The ESP32 initializes the flame sensor as an input and the buzzer as an output.
In the while function:
The ESP32 continuously reads the digital state of the flame sensor.
If the sensor reads flame_value < 4095 (indicating a flame), the ESP32 turns on the buzzer. If the sensor reads flame_value > 4095 (no flame detected), the buzzer is turned off.
Educational robotics refers to the use of robots and robotics technology to promote learning in educational settings. It involves the integration of technology, engineering, and computer science into the classroom, allowing students to engage in hands-on, project-based learning experiences.
In this context, our website represents an excellent resource for parents, teachers and children who wish to discover robotics.
Zaouiet Kontech-Jemmel-Monastir-Tunisia
+216 92 886 231
medaliprof@gmail.com
Robotic site created by MedAli-Teacher info