
In this project a fire detection system will be built with Arduino. It mainly uses a KY-026 flame sensor, buzzer and LED.
When the flame sensor detects a fire, the Arduino board orders the buzzer to ring and the red LED to light up.
To make the assembly, we can connect:
The Fire Detection System program is as follows:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
int digitalPin = 4; int analogPin = A0; // KY-026 analog interface int digitalVal; // digital readings int analogVal; //analog readings void setup() { pinMode(digitalPin, OUTPUT); digitalWrite(digitalPin, LOW); } void loop() { // Read the analog interface analogVal = analogRead(analogPin); if (analogVal<=11){ // the KY-026 sensor detects a fire digitalWrite(digitalPin, HIGH); //LED lights up and buzzer rings } else { // sinon digitalWrite(digitalPin, LOW); // LED goes out and buzzer stops ringing } delay(100); } |