Fire Suppressor

In this project, we are going to use a flame sensor to detect fire and blow it out using a fan mounted on DC motor. We will also use an LED to show presence of fire.

The flame sensor provides HIGH (5V) signal by default. We will keep the motor & LED off when the flame sensor signal is HIGH. When the flame sensor detects fire by its photodiode, the signal goes LOW (0V). We will use the LOW signal from flame sensor as trigger to run DC motor as well as LED.

Components

Connections

Connect the battery block Vs pin to the Vs pin of the microcontroller block. Connect any of black (negative) pins on the battery block to one of the negative (black) pin on the microcontroller block.

Connect the base pin (blue) of the transistor block to microcontroller block pin D9. Connect the collector (red) pin of the microcontroller block to battery block 5V pin. Connect emitter (black) pin of the transistor block to the black terminal of DC motor block. Connect the red terminal of DC motor block to battery block ground (black) pin. The DC motor terminals can be reversed to change the rotation direction as needed.

Connect the flame sensor block red terminal to microcontroller block 5V pin. Connect the flame sensor black terminal to microcontroller ground (black) pin. Connect the yellow terminal of flame sensor to microcontroller block pin D2

Connect the LED block red and black terminal to microcontroller block D4 pin and ground pin respectively.

Code

/*
 In this project we use flame sensor to detect fire. If fire is detected,
 DC motor will switch on blowing the air on fire to suppress it.
 LED is visual indicator of fire detection
 Makernova Robotics @2025
*/

const int motorPin = 9;  // declare pin D9 as motorpin
const int flamePin = 2;  // declare pin D2 as flame signal pin
const int ledPin = 4;    // declare pin D4 for led pin

void setup() {
  // initialize motor pin & LED pin as outputs & flame sensor pin as input
  pinMode(motorPin, OUTPUT);
  pinMode(ledPin, OUTPUT);
  pinMode(flamePin, INPUT);
}

void loop() {
  // if the flame signal pin is turned LOW, it indicates fire detection
  if (digitalRead(flamePin) == LOW) {
    digitalWrite(motorPin, HIGH);  // turn on the DC motor with full speed
    digitalWrite(ledPin, HIGH);    // turn the LED on
    delay(1000);                   // keep the motor on for 1 second to make sure fire is put out
  } else {                         // if the flame signal is HIGH then keep the motor & LED off
    digitalWrite(motorPin, LOW);
    digitalWrite(ledPin, LOW);
  }
  delay(50);  // take 20 readings every second
}