Arduino MKR WiFi 1010 - Flame Sensor

Build fire detection and safety systems! Flame sensors detect infrared radiation from fire, enabling your Arduino MKR WiFi 1010 to respond to flames for safety alarms, automatic suppression systems, or fire monitoring. This tutorial teaches you how to connect a flame sensor to your Arduino MKR WiFi 1010 and program it to detect flames using both digital and analog readings.

What You'll Learn:

Real-World Applications:

Arduino MKR WiFi 1010 infrared flame fire sensor

Safety Applications:

You can extend this Arduino MKR WiFi 1010 flame sensor project by adding buzzers or relays to create automated fire response systems that alert people or activate suppression equipment when flames are detected.

Hardware Preparation

1×Arduino MKR WiFi 1010
1×Micro USB Cable
1×Flame Sensor
1×5-in-1 5-way Flame Sensor
1×Breadboard
1×Jumper Wires

Or you can buy the following kits:

1×DIYables Sensor Kit (30 sensors/displays)
1×DIYables Sensor Kit (18 sensors/displays)
Disclosure: Some of the links provided in this section are Amazon affiliate links. We may receive a commission for any purchases made through these links at no additional cost to you.
Additionally, some of these links are for products from our own brand, DIYables .

Overview of Flame Sensor

What is a Flame Sensor?

infrared flame fire-sensor module

A flame sensor (also called infrared flame sensor, fire sensor, or IR flame detector) is a sensor designed to detect the presence of fire by sensing the infrared radiation emitted by flames.

How Flame Sensors Work:

  • Flames emit infrared (IR) radiation in the wavelength range of 760-1100nm
  • Flame sensors contain IR photodiodes or phototransistors sensitive to this range
  • The sensor detects IR radiation and converts it to electrical signals
  • Built-in comparator converts analog signal to digital output

Why Use Flame Sensors?

  • Fast response: Detects flames instantly (faster than smoke detectors)
  • Direct fire detection: Responds to actual flames, not just heat or smoke
  • Dual outputs: Provides both digital (detected/not detected) and analog (intensity) signals
  • Adjustable sensitivity: Built-in potentiometer allows threshold adjustment
  • Wide detection angle: Typically 60-degree cone of detection
  • Cost-effective: Inexpensive solution for fire detection projects

Important Limitations:

  • False positives possible: Can be triggered by sunlight, hot objects, or other IR sources
  • False negatives possible: May miss fires if flames are blocked or outside detection range
  • Line-of-sight required: Cannot detect fire through walls or obstacles
  • Limited range: Effective detection typically 0.8-1.5 meters
  • Not a safety device: Suitable for projects but not certified for life-safety applications

Common Applications:

  • Fire alarm and detection systems
  • Automatic fire suppression triggers
  • Robot fire-fighting competitions
  • Industrial furnace monitoring
  • Stove and burner flame monitoring
  • Laboratory safety systems
  • Educational fire detection projects

Flame Sensor Outputs

Flame sensors provide two types of outputs that can be used independently or together:

1. Digital Output (DO Pin):

  • Simple fire detection: HIGH when no flame, LOW when flame detected
  • Adjustable threshold: Use built-in potentiometer to set sensitivity
  • LED indicator: Built-in LED shows detection status
  • Perfect for: Alarms, binary detection, triggering actions

2. Analog Output (AO Pin):

  • Flame intensity measurement: Value increases with stronger IR radiation
  • Variable readings: Typically 0-1023 range on Arduino
  • Distance sensing: Higher values when closer to flame
  • Perfect for: Measuring flame strength, distance estimation, gradual responses

Pinout

Flame sensors come in two common configurations:

Available Modules:

Single Flame Sensor Pinout

A standard single flame sensor module has four pins:

Flame Sensor Pinout
image source: diyables.io

Power Pins:

  • VCC pin: Connect to power supply (3.3V or 5V)
    • 5V recommended for best performance
    • Module includes voltage regulator
  • GND pin: Connect to ground (0V)
    • Common ground with Arduino

    Output Pins:

    • DO pin (Digital Output): Digital flame detection signal
      • HIGH: No flame detected (pulled up internally)
      • LOW: Flame detected (above threshold)
      • Threshold adjustable via potentiometer
      • Can connect directly to Arduino digital input
    • AO pin (Analog Output): Analog IR intensity signal
      • Higher values: Stronger IR radiation (closer/bigger flame)
      • Lower values: Weaker IR radiation (farther/smaller flame)
      • Range: 0-1023 on Arduino (10-bit ADC)
      • Not affected by potentiometer adjustment

      LED Indicators:

      Most flame sensor modules include two LEDs:

      • Power LED (usually red):
        • Lights up when module is powered
        • Indicates module is receiving power
        • Always on when VCC connected
      • Status LED (usually green/blue):
        • Connected to DO pin
        • Lights up when flame detected (DO goes LOW)
        • Visual confirmation of detection
        • Helps during sensitivity adjustment

        Potentiometer (Sensitivity Adjustment):

        • Small blue or white adjustment screw on module
        • Turn clockwise: Decrease sensitivity (requires stronger/closer flame)
        • Turn counterclockwise: Increase sensitivity (detects weaker/farther flames)
        • Affects DO pin threshold only (AO pin unaffected)
        • Test and adjust while pointing at flame

        5-in-1 Flame Sensor Configuration

        The 5-in-1 module combines five flame sensors on one board:

        Shared Components:

        • One potentiometer controls all five sensors
        • Common VCC and GND connections
        • Power LED indicator

        Individual Components (per sensor):

        • Separate DO pin (5 total)
        • Separate AO pin (5 total)
        • Each sensor faces different direction
        • Independent detection for each angle

        Advantages:

        • 360-degree coverage (when mounted properly)
        • Redundancy - multiple sensors reduce false negatives
        • Directional fire localization
        • Perfect for robot fire-fighting applications

        How It Works

        Digital Output (DO Pin) Operation

        The digital output provides simple YES/NO flame detection:

        Internal Comparator Circuit:

        1. Flame sensor continuously measures IR radiation
        2. Converts IR intensity to analog voltage
        3. Compares voltage against threshold set by potentiometer
        4. Outputs digital signal based on comparison

        Detection States:

        No Flame Detected: IR Level < Threshold → DO Pin: HIGH → Status LED: OFF → Arduino reads: HIGH Flame Detected: IR Level ≥ Threshold → DO Pin: LOW → Status LED: ON → Arduino reads: LOW

        Sensitivity Adjustment Process:

        1. Power on the module
        2. Point sensor at target flame (at desired detection distance)
        3. Adjust potentiometer while watching status LED:

        - Turn clockwise if LED doesn't light (increase threshold - less sensitive)

        - Turn counterclockwise if LED lights too easily (decrease threshold - more sensitive)

        1. Test at various distances and flame sizes
        2. Fine-tune until detection range matches requirements

        Important Notes:

        • Potentiometer adjustment only affects DO pin
        • AO pin remains unaffected by potentiometer
        • Over-sensitivity causes false positives (sunlight, heat sources)
        • Under-sensitivity causes missed detections

        Analog Output (AO Pin) Operation

        The analog output provides flame intensity measurement:

        Behavior:

        • High IR radiation (strong/close flame) → High analog value (close to 1023)
        • Low IR radiation (weak/far flame) → Low analog value (close to 0)
        • No flameLow baseline value (typically 50-200)

        Typical Value Ranges:

        Scenario Approximate AO Value ───────────────────────────────────────────── No flame (room light) 50-150 Flame 1.5m away 200-400 Flame 1.0m away 400-600 Flame 0.5m away 600-800 Flame very close (<20cm) 800-1000

        Use Cases for Analog Output:

        • Distance estimation: Approximate distance to flame
        • Flame strength: Measure fire intensity
        • Gradual response: Adjust fan speed based on flame proximity
        • Multiple thresholds: Different actions for different intensities
        • Data logging: Record flame intensity over time

        Key Insight:

        The potentiometer does not affect the AO pin. If you need adjustable analog thresholds, implement them in your Arduino code, not via the potentiometer.

Wiring Diagram

The flame sensor module provides two outputs (DO and AO). You can use either one or both depending on your project requirements.

This configuration uses both DO and AO pins for complete flame detection and intensity measurement:

The wiring diagram between Arduino MKR WiFi 1010 infrared flame fire sensor

This image is created using Fritzing. Click to enlarge image

Connections:

  • Flame Sensor VCCArduino 5V
    • Provides power to sensor module
    • 5V recommended for optimal performance
  • Flame Sensor GNDArduino GND
    • Common ground connection
  • Flame Sensor DOArduino D2 (digital input)
    • Digital flame detection signal
    • Configure as INPUT in code
  • Flame Sensor AOArduino A0 (analog input)
    • Analog flame intensity signal
    • Read with analogRead() function

    When to Use Digital Only:

    • Simple fire alarm (detected/not detected)
    • Triggering relay or buzzer
    • Binary fire detection
    • Fewer Arduino pins needed

    When to Use Analog Only:

    • Measuring flame intensity
    • Distance-based responses
    • Gradual flame strength monitoring
    • Custom threshold in software

    When to Use Both Outputs:

    • Need both detection confirmation and intensity measurement
    • Want to compare digital threshold with analog value
    • Testing and calibration purposes
    • Advanced fire detection algorithms

    Wiring Tips:

    • Sensor orientation: Point IR detector toward expected flame location
    • Mounting: Use stable mount to prevent vibration affecting readings
    • Distance: Keep wires short (under 50cm) to minimize noise
    • Testing: Test with real flame (candle, lighter) during setup
    • Safety: Never leave flame unattended during testing

    Power Supply:

    For This Project: Simply plug your Arduino MKR WiFi 1010 into your computer's USB port. The flame sensor module draws minimal current (<50mA), well within USB power limits.

Arduino MKR WiFi 1010 Code - Read Value from DO Pin

This first example uses the digital output for simple flame detection. Perfect for fire alarms, automated suppression triggers, or any application requiring YES/NO flame detection.

What the Code Does:

  • Configures digital pin D2 as input for flame sensor DO pin
  • Continuously reads digital state (HIGH = no flame, LOW = flame detected)
  • Displays clear "DETECTED" or "NOT DETECTED" messages
  • Updates readings every 500ms for real-time monitoring
  • Simple binary detection - no analog complexity
/* * This Arduino MKR WiFi 1010 code was developed by newbiely.com * * This Arduino MKR WiFi 1010 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-mkr/arduino-mkr-wifi-1010-flame-sensor */ #define DO_PIN 2 // Arduino's pin connected to DO pin of the flame sensor void setup() { // initialize serial communication Serial.begin(9600); // initialize the Arduino's pin as an input pinMode(DO_PIN, INPUT); } void loop() { int flame_state = digitalRead(DO_PIN); if (flame_state == HIGH) Serial.println("The flame is NOT present => The fire is NOT detected"); else Serial.println("The flame is present => The fire is detected"); }

Code Explanation - Digital Detection

Pin Configuration:

const int FLAME_SENSOR_PIN = D2; pinMode(FLAME_SENSOR_PIN, INPUT);

Configures D2 as digital input. No pull-up needed - flame sensor has active output driver.

Reading Digital State:

int flameState = digitalRead(FLAME_SENSOR_PIN);

Reads current DO pin state:

  • LOW: Flame detected (IR level above threshold)
  • HIGH: No flame detected (IR level below threshold)

Interpreting Results:

if (flameState == LOW) { Serial.println("Flame detected => Fire is DETECTED!"); } else { Serial.println("No flame => Fire is NOT detected"); }

Important: LOW means detected (inverse logic due to sensor design).

Practical Applications:

1. Fire Alarm:

if (flameState == LOW) { digitalWrite(BUZZER_PIN, HIGH); // Sound alarm digitalWrite(LED_PIN, HIGH); // Warning light }

2. Automatic Suppression:

if (flameState == LOW) { digitalWrite(RELAY_PIN, HIGH); // Activate extinguisher delay(5000); // Run for 5 seconds digitalWrite(RELAY_PIN, LOW); }

3. Safety Cutoff:

if (flameState == LOW) { digitalWrite(FUEL_VALVE_PIN, LOW); // Close fuel valve sendAlert("Fire detected - system shutdown"); }

Detailed Instructions

New to Arduino MKR WiFi 1010? Complete our Getting Started with Arduino MKR WiFi 1010 tutorial first to set up your development environment.

Step 1: Hardware Setup

  • Connect flame sensor to Arduino MKR WiFi 1010 following wiring diagram:
    • VCC to 5V
    • GND to GND
    • DO to D2
  • Mount sensor pointing toward test area

Step 2: Connect and Configure

  • Use USB cable to connect Arduino MKR WiFi 1010 to your computer
  • Launch Arduino IDE
  • Select Arduino MKR WiFi 1010 board and COM port

Step 3: Upload Code

  • Copy the code above
  • Open in Arduino IDE
  • Click Upload button
  • Wait for "Done uploading" message

Step 4: Adjust Sensitivity

  • Open Serial Monitor (baud rate: 9600)
  • Light a candle or use lighter
  • Place flame about 30-50cm from sensor
  • Observe Serial Monitor:
    • If flame not detected, turn potentiometer counterclockwise (increase sensitivity)
    • If false positives occur, turn potentiometer clockwise (decrease sensitivity)
  • Find optimal setting where flame reliably detected at desired distance

Step 5: Test Flame Detection

  • Point sensor at flame - should see "DETECTED" messages
  • Remove flame - should see "NOT DETECTED" messages
  • Watch status LED on sensor module (lights when flame detected)
  • Test at various distances to verify detection range

Expected Serial Monitor Output:

COM6
Send
No flame detected => The fire is NOT detected No flame detected => The fire is NOT detected Flame detected => The fire is DETECTED Flame detected => The fire is DETECTED Flame detected => The fire is DETECTED No flame detected => The fire is NOT detected No flame detected => The fire is NOT detected
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Sensitivity Adjustment Tips:

  • LED stays on constantly: Too sensitive - turn clockwise
  • LED never lights: Not sensitive enough - turn counterclockwise
  • Intermittent false triggers: Reduce sensitivity or shield from sunlight
  • Optimal setting: Detects flame at desired distance without false positives

Arduino MKR WiFi 1010 Code - Read Value from AO Pin

This second example uses the analog output to measure flame intensity. Perfect for distance estimation, gradual responses, or analyzing flame characteristics.

What the Code Does:

  • Configures analog pin A0 as input for flame sensor AO pin
  • Continuously reads analog value (0-1023 range)
  • Displays raw analog readings for analysis
  • Higher values indicate stronger IR radiation (closer/bigger flame)
  • Updates readings every 200ms for smooth data flow
  • Potentiometer adjustment does NOT affect these readings
/* * This Arduino MKR WiFi 1010 code was developed by newbiely.com * * This Arduino MKR WiFi 1010 code is made available for public use without any restriction * * For comprehensive instructions and wiring diagrams, please visit: * https://newbiely.com/tutorials/arduino-mkr/arduino-mkr-wifi-1010-flame-sensor */ #define AO_PIN A0 // Arduino's pin connected to AO pin of the flame sensor void setup() { // initialize serial communication Serial.begin(9600); } void loop() { int flameValue = analogRead(AO_PIN); Serial.println(flameValue); }

Code Explanation - Analog Intensity Measurement

Reading Analog Value:

int analogValue = analogRead(FLAME_SENSOR_PIN); Serial.println(analogValue);

Reads 10-bit ADC value (0-1023):

  • Low values (0-200): No flame or very distant
  • Medium values (200-600): Flame detected at moderate distance
  • High values (600-1023): Strong flame or very close

Understanding the Values:

Typical Reading Interpretation: Value Range Meaning ────────────────────────────────────── 0-150 No flame (background IR) 150-300 Possible distant flame 300-500 Flame detected (far) 500-700 Flame detected (moderate) 700-900 Flame detected (close) 900-1023 Flame very close (danger!)

Practical Applications:

1. Distance-Based Response:

int analogValue = analogRead(A0); if (analogValue > 800) { Serial.println("DANGER: Very close!"); activateEmergencyShutdown(); } else if (analogValue > 500) { Serial.println("WARNING: Flame nearby"); digitalWrite(BUZZER_PIN, HIGH); } else if (analogValue > 300) { Serial.println("ALERT: Flame detected"); }

2. Variable Fan Speed:

// Stronger flame = faster fan int fanSpeed = map(analogValue, 300, 1000, 0, 255); fanSpeed = constrain(fanSpeed, 0, 255); analogWrite(FAN_PIN, fanSpeed);

3. Fire-Fighting Robot:

int leftSensor = analogRead(A0); int rightSensor = analogRead(A1); // Navigate toward flame if (leftSensor > rightSensor) { turnLeft(); // Flame is on left side } else if (rightSensor > leftSensor) { turnRight(); // Flame is on right side } else { moveForward(); // Flame ahead }

4. Data Logging:

unsigned long timestamp = millis(); logFile.print(timestamp); logFile.print(","); logFile.println(analogValue); // Analyze flame behavior over time

Detailed Instructions

New to Arduino MKR WiFi 1010? Complete our Getting Started with Arduino MKR WiFi 1010 tutorial first to set up your development environment.

Step 1: Hardware Setup

  • Connect flame sensor to Arduino MKR WiFi 1010:
    • VCC to 5V
    • GND to GND
    • AO to A0 (analog input)
  • Position sensor pointing toward test area

Step 2: Upload and Test

  • Copy the code above into Arduino IDE
  • Select Arduino MKR WiFi 1010 board and COM port
  • Click Upload button
  • Open Serial Monitor (baud rate: 9600)

Step 3: Observe Analog Values

  • With no flame, note baseline value (typically 50-200)
  • Light a candle
  • Slowly move flame closer to sensor
  • Watch values increase as flame gets closer
  • Move flame away and watch values decrease

Expected Serial Monitor Output:

COM6
Send
245 246 246 573 677 949 955 1004 1007 1013 1018 641 543 340 179
Autoscroll Show timestamp
Clear output
9600 baud  
Newline  

Understanding Your Readings:

  • Low consistent values (50-200): No flame present
  • Sudden increase (300+): Flame entering detection range
  • High values (700-1000): Flame very close
  • Gradual decrease: Flame moving away
  • Fluctuating values: Normal - flames are dynamic

Calibration Tips:

  • Note maximum value at desired detection distance
  • Set software threshold slightly below maximum
  • Test with different flame sizes (candle vs lighter)
  • Account for ambient IR sources (sunlight)
  • Remember: Potentiometer does NOT affect analog readings

Troubleshooting Common Issues

Problem: Sensor Always Detects Flame (DO LED Always On)

Possible Causes:

  • Potentiometer set too sensitive
  • Strong ambient IR sources (sunlight, hot objects)
  • Sensor pointing at heat source
  • Faulty sensor module

Solutions:

  1. Turn potentiometer clockwise to decrease sensitivity
  2. Shield sensor from direct sunlight
  3. Point sensor away from hot surfaces (computers, lamps)
  4. Test in controlled lighting conditions
  5. Verify sensor in dark room first

Problem: Sensor Never Detects Flame

Possible Causes:

  • Potentiometer set not sensitive enough
  • Flame outside detection range (>1.5m)
  • Sensor not pointed at flame
  • Wiring error
  • Dead sensor

Solutions:

  1. Turn potentiometer counterclockwise to increase sensitivity
  2. Move sensor closer to flame (30-50cm)
  3. Check sensor orientation - IR detector faces flame
  4. Verify wiring: VCC to 5V, GND to GND, DO to D2
  5. Test DO pin voltage with multimeter
  6. Try different flame sensor module

Problem: Analog Values Always Read Low (~50-150)

Possible Causes:

  • AO pin not connected properly
  • Wrong pin in code
  • Sensor not powered
  • Faulty AO circuit

Solutions:

  1. Verify AO pin connected to A0 on Arduino
  2. Check code: analogRead(A0) matches your wiring
  3. Confirm VCC and GND connected
  4. Test sensor with known-good flame (candle)
  5. Try different analog pin and update code

Problem: Erratic or Noisy Readings

Possible Causes:

  • Electrical interference
  • Long or poor quality wires
  • Unstable power supply
  • Ambient IR fluctuations

Solutions:

  1. Use shorter wires (<30cm) between sensor and Arduino
  2. Add 100μF capacitor between VCC and GND (near sensor)
  3. Average multiple readings in code:
int sum = 0; for (int i = 0; i < 10; i++) { sum += analogRead(A0); delay(10); } int average = sum / 10;
  1. Shield wires from motors and power lines
  2. Use filtered power supply

Problem: False Positives from Sunlight

Cause: Sunlight contains IR radiation that triggers sensor.

Solutions:

  1. Shield sensor from direct sunlight
  2. Reduce sensitivity with potentiometer
  3. Mount sensor indoors away from windows
  4. Add IR filter in front of sensor (flame wavelengths only)
  5. Use dual confirmation (multiple sensors)

Problem: DO and AO Give Conflicting Results

Cause: Potentiometer threshold doesn't match your analog threshold in code.

Solution: Remember that potentiometer only affects DO pin. Set thresholds independently:

  • DO threshold: Adjust with potentiometer
  • AO threshold: Set in code based on observed values

Challenge Yourself - Creative Extensions

Once you have the basic flame sensor working, try these enhancements:

1. Complete Fire Alarm System

Combine flame sensor with buzzer and LED:

const int BUZZER_PIN = D6; const int RED_LED_PIN = D7; if (digitalRead(FLAME_SENSOR_PIN) == LOW) { digitalWrite(BUZZER_PIN, HIGH); // Sound alarm digitalWrite(RED_LED_PIN, HIGH); // Warning light delay(100); digitalWrite(RED_LED_PIN, LOW); // Blink effect delay(100); }

2. WiFi Fire Alert Notifications

Send alerts to your phone using Arduino MKR WiFi 1010's WiFi:

#include <WiFiNINA.h> if (flameDetected) { sendPushNotification("FIRE DETECTED!"); sendEmail("alert@example.com", "Fire Alert"); logToCloud("Fire at: " + getTimestamp()); }

3. Automatic Fire Suppression

Activate water pump or CO2 system:

const int PUMP_RELAY_PIN = D8; if (flameState == LOW) { digitalWrite(PUMP_RELAY_PIN, HIGH); // Activate pump delay(10000); // Run for 10 seconds digitalWrite(PUMP_RELAY_PIN, LOW); // Stop pump }

4. Multi-Zone Fire Detection

Monitor multiple rooms with multiple sensors:

const int ZONES = 4; const int FLAME_PINS[] = {D2, D3, D4, D5}; const char* ZONE_NAMES[] = {"Kitchen", "Living Room", "Bedroom", "Garage"}; for (int i = 0; i < ZONES; i++) { if (digitalRead(FLAME_PINS[i]) == LOW) { Serial.print("FIRE IN: "); Serial.println(ZONE_NAMES[i]); soundAlarm(); } }

5. Fire-Fighting Robot

Create autonomous fire-fighting robot:

int frontFlame = analogRead(A0); int leftFlame = analogRead(A1); int rightFlame = analogRead(A2); // Find strongest flame signal int maxFlame = max(max(frontFlame, leftFlame), rightFlame); if (maxFlame > 500) { // Flame detected if (maxFlame == frontFlame) { moveForward(); // Flame ahead } else if (maxFlame == leftFlame) { turnLeft(); // Flame on left } else { turnRight(); // Flame on right } } else { searchPattern(); // No flame, keep searching }

6. LCD Fire Status Display

Show detection status on LCD:

#include <LiquidCrystal_I2C.h> LiquidCrystal_I2C lcd(0x27, 16, 2); int analogValue = analogRead(A0); lcd.setCursor(0, 0); lcd.print("Flame Level:"); lcd.setCursor(0, 1); lcd.print(analogValue); lcd.print(" "); if (analogValue > 500) { lcd.setCursor(10, 1); lcd.print("ALERT!"); }

7. Temperature-Compensated Detection

Combine with temperature sensor for better accuracy:

float temperature = dht.readTemperature(); int flameValue = analogRead(A0); // Adjust threshold based on ambient temperature int threshold = map(temperature, 15, 35, 400, 600); if (flameValue > threshold) { flameDetected(); }

8. Data Logging to SD Card

Log all flame events with timestamps:

#include <SD.h> if (flameDetected) { File logFile = SD.open("firelog.txt", FILE_WRITE); logFile.print(getTimestamp()); logFile.print(",Flame Detected,Value:"); logFile.println(analogRead(A0)); logFile.close(); }

9. Safety Interlock System

Prevent false activations with confirmation delay:

unsigned long flameStartTime = 0; const unsigned long CONFIRM_DELAY = 2000; // 2 seconds if (digitalRead(FLAME_SENSOR_PIN) == LOW) { if (flameStartTime == 0) { flameStartTime = millis(); // Start timer } else if (millis() - flameStartTime > CONFIRM_DELAY) { confirmFireDetected(); // Confirmed after 2 seconds } } else { flameStartTime = 0; // Reset timer }

10. Integration with Home Automation

Control home systems based on fire detection:

if (flameDetected) { // Close all gas valves closeGasValves(); // Unlock all doors unlockExitDoors(); // Turn on all lights turnOnEmergencyLights(); // Stop HVAC (prevent smoke spread) shutdownHVAC(); // Call emergency services (via GSM module) callFireDepartment(); }

Experiment and learn - but always prioritize safety!

Video Tutorial

Learn More

※ OUR MESSAGES

  • As freelancers, We are AVAILABLE for HIRE. See how to outsource your project to us
  • Please feel free to share the link of this tutorial. However, Please do not use our content on any other websites. We invested a lot of effort and time to create the content, please respect our work!