How to use flame sensor - Simple tutorial

Thursday, April 27, 2017


This is a simple, brief  guide to use or test your Flame sensor with arduino for first time.
When the Flame sensor is dictates fire LED will glow. 


Parts required 

  • Arduino UNO/Nano (any arduino board)
  • Flame sensor module
  • Jumper cables 
  • LED bulb

Steps

  1.  Connect +ve (long leg) of  LED  to Arduino pin  2
  2.  Connect -ve (short leg) of LED to Arduino  pin GND
  3.  Connect + of flame sensor to Arduino pin 5V
  4.  Connect A0 of  flame sensor to Arduino pin A0
  5.  Connect G of  flame sensor to Arduino pin GND


Circuit diagram of flame sensor with arduino.


Source code for flame sensor with aduino. 

 // Visit : robotechmaker.com  
   
  int firePin = A0; //the analog pin connected to the flame sensor's analoge output   
  int ledPin = 2;  //the digital pin connected to the LED's input   
    
 void setup() {  
  // initialize serial communication @ 9600 baud:  
  pinMode(firePin, INPUT);   
  pinMode(ledPin, OUTPUT);   
  Serial.begin(9600);   
 }  
 void loop() {  
  // read the sensor  
      int sensorReading = analogRead(firePin);  
    
  // LED connected to pin 2  
   pinMode(2, OUTPUT);  
   
  // READING FROM FLAME SENSOR IS REVERSE  
  // WHEN FIRE DETECT THE SENSOR VALUE DECREASE  
  if (sensorReading < 500) // READING FROM FLAME SENSOR IS REVERSE  
  {  
     
  digitalWrite(2, HIGH);  // turn the LED on (HIGH is the voltage level)  
  Serial.print("Fire ditected");  
    
  }  
  delay(50); // delay between reads  
 }  

Click here to download the code

You Might Also Like

0 comments

Click on 'Notify me' to get replies of your comment.

Popular Posts

Like us on Facebook

Contact form

Name

Email *

Message *