Working With IR Module Flame Sensor

Introduction

In my previous article I explained about MQ5 Gas Sensor and in this article I'll show you how to use the IR Module Flame Sensor to find out the fire detection.
 
Requirements
  • Arduino Uno-1
  • Bread Board-1
  • IR Module Flame Sensor-1
  • Buzzer-1
  • Led-2
  • Lighter or any other flame resource to testing 
Connection
 
Figure 1: Board 
  • Vcc  to Arduino 5v
  • Gnd to Gnd
  • AOUT to Arduino Analog Pin Out
  • DOUT to Arduino Digital Pin Out 
  • Led1 Anode pin to Arduino Digital Pin 12 and Cathode Pin to Gnd
  • Led2 Anode pin to Arduino Digital Pin 12 and Cathode Pin to Gnd
Programming
  1. int led1=13;  
  2. int led2=12;  
  3. int buzzer=5;  
  4. const int sensormin=0;  
  5. const int sensormax=1000;  
  6.   
  7. void setup()  
  8. {  
  9.   pinMode(led1,OUTPUT);  
  10.   pinMode(led2,OUTPUT);  
  11.   pinMode(buzzer,OUTPUT);  
  12.   Serial.begin(9600);  
  13. }  
  14.   
  15. void loop()  
  16. {  
  17.   int sensorReading;  
  18.   int range;  
  19.   sensorReading=analogRead(A1);  
  20.   range=map(sensorReading,sensormin,sensormax,0,3);  //Apply the calibration to the sensor reading
  21.   switch(range)  
  22.   {  
  23.     case 0:  
  24.     Serial.println("Close Fire");  
  25.     digitalWrite(led1,HIGH);  
  26.     digitalWrite(buzzer,HIGH);  
  27.     break;  
  28.     case 1:  
  29.     Serial.println("Distance Fire");  
  30.     digitalWrite(led1,LOW);
  31.     digitalWrite(led2,HIGH);  
  32.     digitalWrite(buzzer,LOW);  
  33.     break;  
  34.     case 2:  
  35.     Serial.println("No Fire");  
  36.     digitalWrite(led1,LOW);  
  37.     digitalWrite(led2,LOW);  
  38.     digitalWrite(buzzer,LOW);  
  39.     break;  
  40.   }  
  41.   delay(5);  
  42. }  
 Output
 
 
 
Explanation:
 
Initialize the pin number to LED and buzzer and for the Fire Sensor we give the const value. Here the value will not be changed in the runtime. In the Setup() function set the pinMode to the LED and buzzer as OUTPUT and set the baudRate as (9600). In loop() function we want to give the conditions for IR Module Flame Sensor based on our condition it will work. Here we are using the switch condition. 
  1. sensorReading=analogRead(A1);//Read the sensor  
  2. range=map(sensorReading,sensormin,sensormax,0,3);//Apply the calibration to sensor reading  
Case 0: Close fire // led 1 on and Buzzer Sound.
Case 1: Distance Fire //led1 high and there is no buzzer sound.
Case 2: No Fire //Both led and buzzer are in the off condition.

Based upon the above switch case statement we can find the fire detection using IR Module Flame Sensor.
 
Conclusion
 
And finally we made the Automated fire detection using IR Module Flame Sensor 

Up Next
    Ebook Download
    View all
    Learn
    View all