Lesson 11 Flame Sensor

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 far-infrared flame sensor. It can detect infrared light with wavelength ranging from 700nm to 1000nm. Far-infrared flame probe converts the strength changes of external infrared light into current changes. And then convert analog quantity into digital quantity.

In this experiment, we connect pin D0 to digital port 8 of SunFounder. When the Flame sensor detects flame signals, the LED will be on. Otherwise it will be off.

 

Experimental Procedures

Step 1: Build the circuit

 

       Flame Sensor

SunFounder Uno

D0

8

A0

A0

VCC

5V

GND

GND

 


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

Step 3: Compile the code

Step 4: Upload the sketch to the SunFounder Uno board

Now, if you ignite a lighter near the flame sensor, the LED on the flame sensor module and the LED attached to pin 13 on SunFounder board will light up.

 

Code 

const int analogInPin = A0; //pinA0 attach to A0
const int digitalInPin = 8; //pinD0 attach to pin8 of uno board
const int ledPin = 13; //pin13 built-in led

void setup()
{
  //set the pins state
  pinMode(digitalInPin,INPUT);
  pinMode(ledPin,OUTPUT);
  Serial.begin(9600); //initialize serial monitor
}

void loop()
{
  int analogVal = analogRead(analogInPin);//read the value of A0
  Serial.print("A0: "); 
  Serial.println(analogVal); //print to serial monitor 
  boolean stat = digitalRead(digitalInPin);//read the value of D0
  Serial.print("D0: "); 
  Serial.println(stat); // print to serial monitor 
  if(stat == HIGH)
  { 
    digitalWrite(ledPin,HIGH);//turn on the led
  }
  else
  {
    digitalWrite(ledPin,LOW);
  } 
}

 

Copyright © 2012 - 2016 SunFounder. All Rights Reserved.