Hello everyone! I hope you all will be fine and having fun. Today I am going to tell you that how can you make a simple program for Interfacing Flame Sensor with Arduino.
is used in offices, home and at different places to detect the fire. First of all I would like to tell you about the working principle of the flame sensor
. Flame sensor
is a device designed for the detection of the fire and to respond it. They are usually designed for the detection of most frequently used industrial fuel e.g. diesel, gasoline, karosene, ethylene, hydrogen etc. They are designed in way to distinguish between the radiations from the sunlight and the actual flames.There different types of flame sensors
e.g. Ultraviolet (UV) detectors, Infrared (IR) flame detectors, UV/IR detectors, IR/IR flame detectors, closed circuit video cameras. The purpose of these all flame detectors/sensors
is almost similar i.e. to detect the fire and responding quickly to it. The flame sensors
have a wide range of applications in our daily life e.g. fume cupboards, felt manufacture, nuclear industry, pharmaceutical industries, printing, spray booths, generator, storage tanks, industrial heating and drying systems etc.
Interfacing Flame Sensor with Arduino
In this section of the tutorial Interfacing Flame Sensor with Arduino,
I will explain you the step by step procedure to make a simple algorithm or program in Arduino software for the interfacing of flame sensor with Arduino. The algorithm is pretty simple. I will set a threshold limit, when the temperature exceeds that limit, an LED will be turned on to show the there is something wrong. You can also attach a buzzer with the Arduino. When the fire will be detected buzzer will be turned on automatically. First if all I would like to share the complete source code for Interfacing Flame Sensor with Arduino with all of you guys.
- You can download the complete source code here by clicking on the button below.
- Just download the .rar file, extract it and enjoy the complete simulation.
Here, I am going to show you the list of all the components used in this project.
- Arduino UNO
- Flame Sensor
- Soldering Iron
- Soldering Gum
- Power Supply (12V)
- Jumper Wires
- Varrow Board
Brief Description of the Components
- Arduino UNO acts as the back bone of the project. It manipulates the whole source code uploaded to the board, prints the desired data on the serial monitor and also prints the executed commands on the LCD. Arduino UNO is shown in the figure below.
- Power Supply of 12V is used to turn the entire system ON. Because, we can not test and verify our system until we have not switched it ON. Power supply used for this project is shown in the figure below.
- Jumper Wires are used to make the connections of the all the components in order to make the complete circuit with proper working. Jumper wires are shown in the figure below.
- Flame Sensor is used for the detection of the temperature and for showing the immediate response when the temperature is above the threshold. Flame sensor is shown in the figure below.
- Circuit diagram for the tutorial Interfacing Flame Sensor with Arduino is shown in the figure below.
- You can run this project properly, by making the circuit first, identical to the circuit diagram shown in the figure above.
- The analog pin A5 of the Arduino UNO will help us in reading the data from the sensor.
- The other two pins of the sensor are connected to the supply of 5V and ground respectively as you can see from the above figure.
- The block diagram for the project Interfacing Flame Sensor with Arduino is shown in the figure below.
- Power supply is provided in order to run the project properly.
- Arduino is the backbone of the whole system and controls all of the devices used.
- When the temperature crosses the adjusted threshold the LED will be turned ON to indicator that the fire is detected.
- In normal condition LED will remain Off.
Source Code Descritption
- Source code for Interfacing Flame Sensor with Arduino is given below.
- Just copy the entire code and paste it in your Arduino software and upload it to the Arduino board.
#include<SoftwareSerial.h>//library for software serial object
int sensorPin = A0; // flame sensor is attached to A0 pin of Arduino
int sensorValue = 0; // Initial value of the sensor is 0
int led = 9; // an LED is attached to the pin no 9 of Arduino
void setup() //method used to run the code for the one time
pinMode(led, OUTPUT);//changint the mode of LED as an output
Serial.begin(9600);//rate at which arduino communicates with laptop
void loop()//method used to run the code repeatedly
Serial.println("Welcome to TechPonder Flame Sensor Tutorial");//prints on the serial monitor
sensorValue = analogRead(sensorPin);//reads the analog data from the sensor
Serial.println(sensorValue);//prints the sensor data on serial monitor
if (sensorValue < 100)//threshold for the LED indication
Serial.println("Fire Detected");//prints on the serial monitor
Serial.println("LED on");//prints on the serial monitor
digitalWrite(led,HIGH);//turning on the LED
delay(1000);//delay of 1 second
digitalWrite(led,LOW);//turning of the LED
- First of all I have declared library of software serial.
- Then I have defined the pins of Arduino UNO at which the flame sensor and LED are connected.
- Then I have changed the mode of LED to output.
- Then I have started reading the analog data from the flame sensor.
- I have adjusted a threshold, when the temperature exceeds that value LED will be turned on.
- When the temperature is below the threshold LED will remain off e.g in normal conditions.
So, that is all from the tutorial Interfacing Flame Sensor with Arduino. I hope you enjoyed this tutorial. If you face any sort of problem you can ask me in comments anytime without even feeling any kind of hesitation. I will try my level best to solve your issues in a better way, if possible. I will explore Arduino by making different projects on it and will share all of them with you as well in my later tutorials. Till then, Take care :)