
In this project we will realize a fire detection system with the ESP32 card. It mainly uses a KY-026 flame sensor, and a buzzer.
When the flame sensor detects a fire, the ESP32 board instructs the buzzer to sound.
connecting wires
a test plate
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 flamme = ADC(Pin(34)) flamme.atten(ADC.ATTN_11DB) #Full range: 3.3v buzzer=Pin(4,Pin.OUT) while True: flamme_value = flamme.read() print(pot_value) sleep(0.1) if (flamme_value<4095): #if the sensor detects a flame buzzer.value(1) #the buzzer sounds else: buzzer.value(0) #the buzzer stops ringing |