hi welcome to an Arduino step-by-step course by Robojax if you found this tutorial helpful
please thumb up and also click on the subscribe on the right side in the lower corner I really
appreciate it in this lecture we are going to learn about this flame sensor that detects flame
actually element elements of infrared in the flame will cause this to be triggered and
turn something on or off we're going to see how the flame can trigger this on and off
to explain the module we have a flame sensor here this is actually this is an infrared sensor
which can be triggered also with tv remote control and then we have an op amp here that
amplifies a signal the sensitivity of this is adjusted using this 10 kilo ohm potentiometer
one zero four this is a multi-turn potentiometer and you when you rotate it make sure to rotate
it multiple times and when it reaches to one end it means it makes click let me show you
that click
is from this and the same way when you turn it counterclockwise again you will see clicks
and then we have here DO that is the digital out will be connected to pin two this plus is
connected to vcc or five volts this ga's ground will be connected to the ground a0 that is analog
out and that is not of our concern because the application that we are using it
is to detect the flame so this is not used on this module we have two LEDs this is the power
led when you connect it to five volts it will turn on and this ldd is supposed to be turned on when a
flame is detected but they made it such that this is the opposite
it will be turned on all the time when the flame comes it turns off this is a defect in the design
but this is how this module is offered in case if you got this blue module which is the same exact
module as the red one except the potentiometer is different and there is no cut
but exact components have been used this is the flame sensor and this is the op-amp lm393
that's the potentiometer that you adjust the sensitivity the tripon here do ground and vcc
this will be connected to ground vcc will be connected to 5 volts and do will be connected
let me explain the code for the flame sensor we define pin two as a flame
n pin this is a pin that is coming from data out or go of the flame sensor to this pin
then two and we define another pin pin 8 for buzzer or for relay I call that relay here
and the on time and off times or the amount of time that in on time when a signal is detected
a flame is detected you want to wait for this many millisecond or second that you want
the off time is where every time it goes and checks it waits for this
amount of time before it goes to the next checking inside the setup this code will run only once
and then we initialize the serial monitor with 9600 bot this is to print the information on the
serial monitor which you can open it from here and then using pin mode we define the flame endpin as
input so we can read the data and then we define relay pin as an output so we can send signal to
this pin which is pin 8 to turn on a buzzer or led or really whatever you want in our case I’m
using a buzzer which buzzes and then we print this text for our own information on the serial monitor
inside the loop this code here will be repeated continuously first we use digital read and we
check the flame end pin which is pin two and the result is this value and we compare it
to see if it is high and using these two equal sign that's for comparison purpose if that is
true which means if high is detected and the flame have been detected
then we take action of this tree line the first line will print this fire fire on the screen
the second one using digital write relay pin high we send high signal to pan eight so the button
buzzes or maybe you can control a relay which we have explained how to use the relay before
and then we wait for this much time on time which have been defined above
every time a file is detected for example you can you can wait it can you can make the program
to wait for one second and continuously pass or reduce it it's up to you if this is not true which
means the flame is not detected we go to else and we take these three line action and you can change
it accordingly and here also you can change it you can do something else but in our case we just use
digital right relay pin low so the buzzer which was high now we are turning it off so it can go
off otherwise otherwise it will stay on for as long as the Arduino has power and then we print
this text on the screen piece and then we wait for this much time which have been defined above
like 2200 millisecond or less or more and because this is loop the code will continuously execute
this is the wiring diagram for the red flame sensor module at the right we have do data out
or digital out this pin have been connected using a purple wire to pin two the middle pin has been
labeled as plus or vcc this has been connected using white wire to 5 volts and the gray wire
from ground have been connected to the ground in case if you purchased this blue module which work
exactly the same and has a potentiometer as well the wiring will be a little different vcc is on
the other side the first one it has been connected to five volts ground is at the middle have been
connected to the ground and d o or digital out or data out is on the left side using a
purple wire have been connected to pin two and here the actual wiring on the module
d or digital out have been connected to pin two using this purple wire the middle wire is
plus I’ve been labeled as plus or vcc using white wire have been connected to five volts a turban
from this side have been connected using a gray wire to the ground the last pin a zero have not
been used for the buzzer I have connected pin 8 to a point and this pin is connected to ground
of Arduino and my buzzer is this greenish pin aid this is ground my brother is five
volts and the long pin is the positive which has been connected on this side to the green wire
this is a demonstration of the flame sensor that the code that I shown you now is printing piece
when nothing happens and here is the my lighter I will turn it on as you can see it shows fire fire
on this screen and also the buzzer is turning on you can control a relay that can control a
motor or something on or you can send a text take picture whatever you want the action is up to you
the most important part is to be able to detect the flame when a flame happens it triggers this
is now facing my window I brought the curtains down but still there are small spots left and I’m
going to show you that this can be triggered using those infrared that is coming from the
window
and now I went clockwise fully
and now the light from the window is now triggering this if I put my hand here
it blocks it and it doesn't affect so keep in mind that this can work in an area that there is no
sunlight or elements of infrared from outside otherwise this will not work
and in order to eliminate all those extra
signal or whatever that is coming from outside we can just adjust it using this potentiometer now
so if you go clockwise fully you will make it more sensitive counterclockwise
now I have to go counterclockwise to make it less sensitive
keep in mind that this is a multi-term potentiometer and you need to rotate it like
five six eight turn before you see some changes
now this is now ignoring anything that is coming from window and if I use
the flames it will work and in your application in case if you are dealing with a huge flame
again you can reduce the sensitivity so this will not be able to trigger it
as you can see now it's not being triggered so either this has to be huge as you can see now this
is not this is barely triggering it but it has to be huge in order for this to work so you can
determine what distance it works and how big the flame should be using this potentiometer
this was how to use this flame sensor with Arduino thanks for watching please make sure to subscribe
by clicking at the subscribe button in here thank you thank you for watching tutorial from Robojax
if you learned something and found this useful please thumb up as this will help my video in the
search algorithm of YouTube if you have comment or question please post it at the comment section
below I try to answer and reply and don't forget subscribe to get updates on my upcoming videos