Friday 22 April 2016

Flame Detection Primer

This schematic provides a method of connecting a flame sensor to an Arduino. The code can be used to activate a buzzer.

Flame sensor to A5
Buzzer to Digital 8.

As the code establishes serial communication, you can use the serial monitor to watch the input value to A5 as it changes.
Altering the 600 in the line [ if(val>=600) ] (Reading "if Val is greater or equal to 600") will change the point at which the buzzer sounds.

The code...

int flame=A5; //Define the flame sensor input A5;
 int Beep=8;  //Buzzer to D8
 int val=0;   
 void setup() 
{ pinMode(Beep,OUTPUT); 
 pinMode(flame,INPUT); 
 Serial.begin(9600);//set the baudrate to 9600
                    //this establishes serial communication ;
 } 
void loop() { 
val=analogRead(flame);//analog read the voltage ;
Serial.println(val);
 if(val>=600) //if the analog data large than 600 ;
              //You can of course change this value... ;
 { 
digitalWrite(Beep,HIGH); 
} else
 { digitalWrite(Beep,LOW); }
 }