Summary
A fire alarm system can be built as a simple Arduino project using a flame sensor and buzzer. The sensor detects infrared light associated with a flame, Arduino processes the signal, and the buzzer provides an immediate audible warning. This makes the project useful for learning sensor interfacing, digital inputs, and basic safety automation.
In this tutorial, you'll build a fire alarm system using Arduino, wire the flame sensor and buzzer, upload the Arduino code, test the detection system, and explore practical upgrades.

What You Need
- Arduino Uno – Processes the flame sensor signal
- Flame Sensor Module – Detects infrared light from flames
- Active Buzzer Module – Produces the alarm sound
- Breadboard – Enables temporary circuit prototyping
- Jumper Wires – Connects the circuit components
- USB Cable – Powers and programs the Arduino
These are the same core components specified in the existing project, which uses an Arduino Uno, flame sensor, active buzzer, breadboard, jumper wires, and USB cable
Safety Note: This is an educational prototype, not a replacement for a certified residential or commercial fire alarm. Never rely on a DIY circuit as your primary fire protection system.
Components and Supplies
Parts Required
| Component | Purpose |
|---|---|
| Arduino Uno | Main controller for the alarm |
| Flame Sensor Module | Detects a nearby flame |
| Active Buzzer | Provides audible fire warning |
| Breadboard | Holds temporary circuit connections |
| Jumper Wires | Connects modules to Arduino |
| USB Cable | Programs and powers Arduino |
How the Fire Alarm System Works
The operating principle is straightforward.
The flame sensor continuously monitors its surroundings for infrared light within the range associated with a flame. When the sensor detects a flame, its digital output changes state. Arduino reads this signal and activates the buzzer. When the flame is removed, the buzzer switches off.
The basic sequence is:
Flame detected → Sensor sends signal → Arduino processes input → Buzzer activates
This makes a fire alarm system using Arduino a useful beginner project for understanding how a sensor can trigger an automated response.

Component Overview
Circuit Connections
The project uses just two active modules: the flame sensor and the buzzer.
Flame Sensor to Arduino
| Flame Sensor Pin | Arduino Connection |
|---|---|
| VCC | 5V |
| GND | GND |
| DO | Digital Pin D2 |
Buzzer to Arduino
| Buzzer Pin | Arduino Connection |
|---|---|
| Positive (+) | Digital Pin D8 |
| Negative (-) | GND |
The original circuit uses the flame sensor's digital output on D2 and the buzzer on D8.
Before powering the circuit, check the polarity of the buzzer and confirm that the sensor's VCC and GND connections are correct.
Build the Circuit Step by Step
Step 1: Place the Components
Place the Arduino Uno, flame sensor, and active buzzer on your work surface. Position the components so that the jumper wires can be connected without becoming tangled.
A breadboard makes this stage easier because the connections can be changed without soldering.
Step 2: Connect the Flame Sensor
Connect:
- Flame sensor VCC → Arduino 5V
- Flame sensor GND → Arduino GND
- Flame sensor DO → Arduino D2
The digital output is the signal Arduino uses to determine whether the sensor has detected a flame.
Step 3: Connect the Buzzer
Connect the buzzer's positive terminal to Arduino D8 and its negative terminal to GND.
The buzzer will act as the alarm output whenever Arduino detects the programmed flame condition.
Step 4: Check the Wiring
Before connecting the Arduino to your computer, inspect every connection.
Pay particular attention to:
- VCC and GND connections
- Flame sensor output pin
- Buzzer polarity
- Arduino pin numbers
A wiring mistake can prevent the alarm from working even when the code is correct. The original tutorial also recommends verifying the complete circuit before powering it.

Upload the Arduino Code
Once the circuit is assembled, connect the Arduino Uno to your computer and open the Arduino IDE.
The basic program continuously reads the flame sensor and activates the buzzer when the sensor reports a detected flame.
sensor reports a detected flame.
const int flameSensor = 2;
const int buzzer = 8;
void setup() {
pinMode(flameSensor, INPUT);
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, LOW);
Serial.begin(9600);
}
void loop() {
int flameState = digitalRead(flameSensor);
if (flameState == LOW) {
digitalWrite(buzzer, HIGH);
Serial.println("Fire Detected!");
}
else {
digitalWrite(buzzer, LOW);
Serial.println("No Fire");
}
delay(200);
}
The original project uses the same pin assignments and logic: the flame sensor is read on D2, the buzzer is controlled through D8, and the Serial Monitor displays either "Fire Detected!" or "No Fire."
Understanding the Code
The code is built around a simple sequence: read the flame sensor → determine whether a flame is detected → control the buzzer → display the status.
1. Define the Pins
const int flameSensor = 2;
const int buzzer = 8;
These lines assign the Arduino pins used by the flame sensor and buzzer. The flame sensor is connected to D2, while the buzzer is connected to D8.
Using named variables instead of repeatedly writing pin numbers also makes the code easier to modify later.
2. Configure the Components
Inside setup(), the pins are configured according to their functions:
pinMode(flameSensor, INPUT);
pinMode(buzzer, OUTPUT);
The flame sensor provides information to the Arduino, so it is configured as an INPUT. The buzzer receives a control signal from the Arduino, so it is configured as an OUTPUT.
The buzzer is initially switched off:
digitalWrite(buzzer, LOW);
The Serial Monitor is also initialized:
Serial.begin(9600);
This allows the Arduino to display messages such as "Fire Detected!" and "No Fire" while the project is running.
3. Read the Flame Sensor
The loop() function continuously reads the sensor:
int flameState = digitalRead(flameSensor);
The sensor's digital output is stored in the flameState variable. The Arduino can then use this value to determine whether the programmed detection condition has occurred.
4. Trigger the Alarm
The if statement determines what happens when the sensor detects a flame:
if (flameState == LOW) {
digitalWrite(buzzer, HIGH);
Serial.println("Fire Detected!");
}
When the sensor returns LOW, the Arduino activates the buzzer by setting D8 to HIGH. It also prints "Fire Detected!" to the Serial Monitor.
If the detection condition is not present, the else block keeps the buzzer switched off:
else {
digitalWrite(buzzer, LOW);
Serial.println("No Fire");
}
This creates the basic decision-making logic behind the fire alarm system using Arduino.
5. Add a Short Delay
Finally:
delay(200);
The Arduino waits for 200 milliseconds before reading the sensor again. The loop then repeats continuously, allowing the system to monitor the flame sensor and respond to changes.
In simple terms, the complete logic is:
Read sensor → Check sensor state → Activate or deactivate buzzer → Display status → Repeat
This same input-processing-output structure is useful well beyond this project and forms the foundation of many Arduino-based automation systems.
Test the Fire Alarm System
Once the code is uploaded, open the Serial Monitor in the Arduino IDE and set the baud rate to 9600.
The system should continuously display the sensor status. When the flame sensor detects a flame, the Arduino should activate the buzzer and display a corresponding alert.
For testing, keep the flame source at a safe distance and never leave it unattended.
A basic test sequence is:
- Power the Arduino.
- Confirm that the buzzer remains off without a detected flame.
- Introduce a small flame within the sensor's detection range.
- Check that the buzzer activates.
- Remove the flame and confirm that the buzzer switches off.
This confirms that the sensor, Arduino program, and alarm output are communicating correctly.
Adjusting the Flame Sensor
Most flame sensor modules include a small potentiometer that allows you to adjust their detection sensitivity.
If the buzzer activates when there is no flame, the sensor may be too sensitive. If it fails to detect a nearby flame, the sensitivity may need adjustment.
Make small changes to the potentiometer and test the sensor again.
Keep in mind that environmental factors such as sunlight and other infrared sources can affect the sensor. A simple flame sensor should therefore be treated as an educational detection mechanism rather than a certified fire-detection device.
Troubleshooting Common Problems
| Problem | Possible Cause | Solution |
|---|---|---|
| Buzzer doesn't activate | Incorrect wiring | Check D8, VCC, and GND connections |
| Flame isn't detected | Sensor sensitivity is too low | Adjust the sensor's potentiometer |
| Buzzer stays ON | Sensor detects infrared light continuously | Reposition the sensor and adjust sensitivity |
| Serial Monitor shows incorrect output | Wrong baud rate | Set Serial Monitor to 9600 baud |
| Arduino doesn't respond | Code or USB connection issue | Recheck the sketch and USB connection |
Testing each component independently can make troubleshooting much easier.
How to Improve the Project
The basic fire alarm system using Arduino is intentionally simple, but several additions can make the project more informative and capable.
Add an LED Indicator
A red LED can indicate an alarm condition while a green LED can show that the system is operating normally.
This provides visual feedback in addition to the buzzer.
Add an LCD or OLED Display
A display can show messages such as:
- System Ready
- Fire Detected
- Sensor Monitoring
This is particularly useful for educational demonstrations.
Add a Temperature Sensor
A temperature sensor can provide another measurement alongside flame detection. Arduino could then evaluate both temperature and flame-related inputs before triggering an alert.
Using multiple sensors can make the system more robust than relying on a single input.
Add Remote Notifications
An ESP32 or another communication module can extend the project beyond a standalone alarm.
For example, the system could potentially:
- Send an alert to a phone
- Log detection events
- Display sensor readings remotely
- Connect to an IoT dashboard
This turns a basic Arduino experiment into a broader monitoring project.
Where You Can Take the Project Next
Once you're comfortable working with sensors and automated alerts, you can apply the same Arduino concepts to other practical projects.
For example, an RFID-based Smart Attendance System uses a microcontroller to detect identification cards and record attendance automatically. It introduces a different type of sensor input while following the same basic principle of input → processing → output.
You can also explore access-control applications with Build Your Own Smart Door Lock Using Arduino, where an RFID reader and servo motor are combined to create an automated locking mechanism.
These projects demonstrate how the same fundamentals can be applied to different real-world automation problems.
Safety Considerations
A DIY Arduino circuit should not be used as the primary fire protection system in a home, school, laboratory, or commercial building.
Certified smoke and fire alarms use dedicated sensors, testing standards, alarm levels, backup power, and safety certifications that a basic Arduino project does not provide.
For this reason, treat this project as an educational prototype for learning about sensors and automation. Keep any test flame small, controlled, and away from flammable materials.
Final Thoughts
A fire alarm system using Arduino is a straightforward project that demonstrates how a microcontroller can monitor an environment and respond automatically to a detected condition.
The basic setup requires only an Arduino Uno, flame sensor, buzzer, breadboard, and jumper wires. From there, you can add LEDs, displays, temperature sensors, or wireless connectivity to explore more advanced monitoring systems.
The most important lesson is the underlying design pattern: a sensor provides an input, the Arduino processes that information, and an output device responds to the detected condition. Once you understand that workflow, you can apply it to a wide range of electronics, robotics, and automation projects.




