Lesson 27 Flame Sensor

Share for us
Share on facebook
Share on twitter
Share on pinterest
Share on whatsapp

Introduction

A flame sensor module performs detection by capturing infrared wavelengths from flame. It can be used to detect and warn of flames.

Components

– 1 * SunFounder Uno board

– 1 * USB data cable

– 1 * Flame sensor module

– Several jumper wires

Experimental Principle

There are several types of flame sensors. In this experiment, we will use a far-infrared flame sensor. It can detect infrared light with a wavelength ranging from 700nm to 1000nm. A far-infrared flame probe converts the strength changes of the external infrared light into current changes. And then it converts analog quantities into digital ones.

In this experiment, connect pin D0 to D8 of the SunFounder Uno board. When the flame sensor detects flame signals, the LED attached to pin 13 of the Uno board will brighten. Otherwise, it will keep off.

Experimental Procedures

Step 1: Build the circuit

  Flame Module                              SunFounder Uno

                                 AO —————————————— A0

                                  G ——————————————- GND

                                  + ——————————————— 5V

                                 DO —————————————— D8

Step 2: Program (Please refer to the example code in LEARN -> Get Tutorial on our website)

Step 3: Compile

Step 4: Upload the sketch to SunFounder Uno

Now, ignite a lighter near the flame sensor, and the LED on the module and that attached to pin 13 on Uno will light up.

Code

const int analogInPin = A0;
const int digitalInPin = 8;
const int ledPin = 13;void setup()
{
pinMode(digitalInPin,INPUT);
pinMode(ledPin,OUTPUT);
}void loop()
{
int analogVal = analogRead(analogInPin);
boolean stat = digitalRead(digitalInPin);
if(stat == HIGH)
{
digitalWrite(ledPin,HIGH);
}
else
{
digitalWrite(ledPin,LOW);
}
}