Flame Sensor Module¶
Introduction¶
The Flame sensor is a sensor that can detect the presence of fire or flames. It detects fires mainly by sensing infrared radiation emitted by fires or flames. It is widely used in fire detection systems in homes and industries.
Principle¶
The Flame sensor works on the principle of infrared (IR) detection. The sensor has an IR receiver that detects the IR radiation emitted by flames. When fire burns it emits a small amount of Infra-red light, this light will be received by the Photodiode (IR receiver) on the sensor module. Then we use an Op-Amp to check for a change in voltage across the IR Receiver, so that if a fire is detected the output pin (DO) will give 0V(LOW), and if the is no fire the output pin will be 5V(HIGH).
Usage¶
Hardware components
Arduino Uno R4 or R3 board * 1
Flame Sensor Module * 1
Jumper Wires
Circuit Assembly
Code¶
Code explanation¶
The first line of code is a constant integer declaration for the flame sensor pin. We use the digital pin 7 to read the output from the flame sensor.
const int sensorPin = 7;
The
setup()
function initializes the flame sensor pin as an input and the built-in LED pin as an output. It also starts the serial communication at a baud rate of 9600 for printing messages to the serial monitor.void setup() { pinMode(sensorPin, INPUT); // Set the flame sensor pin as input pinMode(LED_BUILTIN, OUTPUT); // Set the built-in LED pin as output Serial.begin(9600); // Initialize the serial monitor at a baud rate of 9600 }
The
loop()
function is where we continuously check the status of the flame sensor. If the sensor detects a flame, the built-in LED is turned on and a message is printed to the serial monitor. If no flame is detected, the LED is turned off and a different message is printed. The process repeats every 100 milliseconds.void loop() { // Check if the sensor is detecting a fire if (digitalRead(sensorPin) == 0) { digitalWrite(LED_BUILTIN, HIGH); // Turn on the built-in LED Serial.println("** Fire detected!!! **"); } else { digitalWrite(LED_BUILTIN, LOW); // Turn off the built-in LED Serial.println("No Fire detected"); } delay(100); }
Additional Ideas¶
Modify the code to trigger a buzzer or sound an alarm when fire is detected.
Incorporate a smoke sensor in addition to the flame sensor to enhance fire detection capabilities.
Plot the analog output instead of just digital HIGH/LOW. Use AO pin.