How to Track Fire With Flame Sensor

Introduction: How to Track Fire With Flame Sensor

About: Electronics Component - PCB [Design, Printing, Inserting] - Electronic Programming

How do we track fire using 8 Channel Flame Sensor that will be driven by servo motor?

The workflow of this fire tracking is the reading of 8 Channel Flame Sensor simultaneously, and then searched for the smallest flame value using the MIN function of the Arduino. Why do we use the smallest? Because the closer the source of flame, the smaller the value will be generated.

After searching for the smallest value, it will then look for the position on which the Flame Sensor detects the flame, which will serve as the reference point of movement of the servo motor. If the first flame sensor is read, then the servo movement will go to 180 degrees. If the 8th flame sensor is read, then the servo will move to 0 degrees.

Teacher Notes

Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.

Step 1: Materials You Need

Step 2: Setup

Connect SFE 8 Channel Flame Sensor, SFE Minsys Atmega8 with Serial, and SG-5010 Servo Motor with jumper wires as schematic above or configuration pin below:

  • A0 = A Flame Sensor
  • A1 = B Flame Sensor
  • A2 = C Flame Sensor
  • Data Servo = 10

Step 3: Code

First, declaration the pin to use:

#define selectorA A0
#define selectorB A1
#define selectorC A2

And then, port initialization used:

Servo myservo; // create servo object to control a servo
void setup()

pinMode(selectorA, OUTPUT);
pinMode(selectorB, OUTPUT);
pinMode(selectorC, OUTPUT); myservo.attach(9); // attaches the servo on pin 9 to the servo object


Create a function to enable the selector and read the flame sensor:

int valFlame[8];
void activeSelector(int a, int b, int c)

digitalWrite(selectorA, a);
digitalWrite(selectorB, b);
digitalWrite(selectorC, c);


void readFlame()


valFlame[0] = analogRead(A3);
valFlame[1] = analogRead(A3);
valFlame[2] = analogRead(A3);
valFlame[3] = analogRead(A3);
valFlame[4] = analogRead(A3);
valFlame[5] = analogRead(A3);
valFlame[6] = analogRead(A3);
valFlame[7] = analogRead(A3);


The main program, this program will find the minimum value and then be used as a reference error for servo movement.

int minVal=1024;
int error;
void loop()

for(int i=0; i<=7; i++)

minVal = min(minVal, valFlame[i]);
if(minVal == valFlame[i])

error = i;





In the above program, the servo will be given the pulse width according to error * 23. The value of 23 is taken due to the maximum degree of servo 180 and the number of 8 sensors, so that 180/8 = 22.5 will be rounded to 23.

Step 4: Check the Video to Know More

Be the First to Share


    • Backyard Contest

      Backyard Contest
    • Silly Hats Speed Challenge

      Silly Hats Speed Challenge
    • Finish It Already Speed Challenge

      Finish It Already Speed Challenge

    2 Discussions