Introduction
In today’s world, safety and security are paramount concerns, especially when it comes to fire hazards. Creating a reliable fire alarm system can be a critical element in safeguarding your home or workplace. With the accessibility of Arduino, you can now build your own DIY fire alarm system with flame detection capabilities. In this article, we’ll guide you through the process, from gathering the necessary components to writing the code and testing your system.
Components Needed
Before diving into the project, let’s assemble the essential components you’ll require:
- Arduino Board (e.g., Arduino Uno or Arduino Nano)
- KY-026 Flame Sensor Module
- Buzzer
- LED (optional for visual alarm)
- Resistor 200ohms
- Jumper Wires
- Breadboard
- Power Source (e.g., 9V Battery or USB Power Supply)
KY-026 Flame Sensor
The KY-026 Flame Sensor is a widely used module for fire detection in DIY electronics projects. It is designed to detect the presence of flames or fire sources by sensing the infrared (IR) radiation emitted by flames.
The KY-026 Flame Sensor is specifically designed to detect flames or fire sources. It’s commonly used in fire alarm systems and other applications where fire detection is crucial. The sensor works on the principle of IR flame detection. It can detect the IR radiation emitted by flames, making it responsive to fire but less sensitive to other light sources like ambient light or incandescent bulbs.
- VCC (Power): This pin is used to supply power to the sensor. It typically operates at 3.3V or 5V, depending on your application.
- GND (Ground): This pin should be connected to the ground (0V) of your power supply or microcontroller.
- D0 (Digital Output): The D0 pin provides a digital output that goes HIGH when the sensor detects a flame or fire source. It goes LOW when no flame is detected.
- A0 (Analog Output): Some versions of the KY-026 sensor also feature an analog output pin (A0), which provides an analog voltage that varies with the intensity of the detected flame. This pin can be used for more precise flame intensity measurements.
Calibration: It’s important to calibrate the sensor according to your specific environment and the type of fires you want to detect. Adjustments may be necessary to set the threshold for flame detection accurately. It can be done with the help of the potentiometer placed on the sensor if the sensor is used in the digital Mode. This current guide is for digital Mode.
Circuit Diagram
Code
int flameSensorPin = 2;
int ledPin = 3;
int buzzerPin = 4;
int flameDetected = 0;
void setup() {
pinMode(flameSensorPin, INPUT);
pinMode(ledPin, OUTPUT);
pinMode(buzzerPin, OUTPUT);
Serial.begin(9600);
}
void loop() {
flameDetected = digitalRead(flameSensorPin);
if (flameDetected == LOW) {
digitalWrite(ledPin, HIGH);
digitalWrite(buzzerPin, HIGH);
Serial.println("Flame detected! Fire alarm activated!");
delay(1000);
} else {
digitalWrite(ledPin, LOW);
digitalWrite(buzzerPin, LOW);
}
}
Code Simplified
In this simplified code, we define the pins for the flame sensor, LED, and buzzer. We set up the sensor pin as an input and the LED and buzzer pins as outputs. The loop continuously checks if the flame sensor detects a flame. If a flame is detected, the LED and buzzer are activated, and a message is sent to the Serial Monitor.
Test the Code
To test your fire alarm system, upload the code to your Arduino board and ensure that all connections are correct. Then, use a lighter or flame source near the flame sensor module. When the sensor detects a flame, the LED will light up, the buzzer will sound, and a message will appear in the Serial Monitor.
Conclusion
Creating a flame detection and fire alarm system with Arduino is a practical and cost-effective way to enhance safety in your environment. By following this guide, you’ve learned how to assemble the necessary components, create a circuit, write the code, and test your DIY fire alarm system. Remember that this project is a basic example, and you can further expand and customize it to meet your specific needs, such as integrating it with a notification system or connecting it to the internet for remote monitoring. Stay safe, and happy tinkering!