Microbit Lesson-12: Flame Sensor


Over here we will show you what is the flame sensor and how it works, you can follow this lesson to get how to use the flame sensor with the micro bit.

Flame sensor (Infrared receiving triode) is specially used on robots to find the fire source. This sensor is of high sensitivity to flame. Flame sensor is made based on the principle that infrared ray is highly sensitive to flame. It has an infrared receiving tube to detect fire, and then converts the flame brightness into fluctuating level signal. In this lesson, we are going to  show how to read the flame sensor’s value, then control the buzzer sound through inputting the fluctuating level signal into micro:bit board.

Parts Needed

  • 1x micro:bit
  • 1x Micro B USB Cable
  • 1x micro:bit Breakout (with Headers)
  • 1x Breadboard
  • 5x Jumper Wires
  • 1x  Flame Sensor Module

About Flame Sensor

The Flame Sensor can detect flames in the 760 – 1100 nano meter wavelength range. Small flames like a lighter flame can be detected at roughly 0.8m. Detection angle is roughly 60 degrees and the sensor is particularly sensitive to the flame spectrum. The module consists of an IR sensor, potentiometer, OP-Amp circuitry and a led indicator. An on board LM393 op amp is used as a comparator to adjust the sensitivity level. The sensor has a digital and analog output and sensitivity can be adjusted via the blue potentiometer.


  • The operating voltage is from 3.3 – 5V.
  • It gives us both analog and digital output.
  • It has a led indicator, which indicates that whether the flame is detected or not.
  • The threshold value can be changes by rotating the top of potentiometer.
  • Flame detection distance, lighter flame test can be triggered within 0.8m, if the intensity of flame is high, the detection distance will be increased.
  • The detection angle of the flame sensor module is about 60 degrees.

It has both outputs, analog and digital. The analog output gives us a real time voltage output signal on thermal resistance while the digital output allows us to set a threshold via a potentiometer. In our tutorial we are going to use both of these outputs one by one and see how the sensor works.We can use the flame sensor to make an alarm when detecting the fire, for safety purpose in many projects and in many more ways.

Working Principle

  • Flame sensor is very sensitive to flame and other lights.
  • Its analog output provides real time output voltage on the thermal resistance.
  • When the temperatures reaches at the certain threshold the output high and low signal threshold adjustable via potentio-meter , Its the task of digital output.

Flame Sensor Pin Out 

Wiring Diagram for the Experiment

Connection for flame sensor:

Flame sensor Microbit Breakout 
VCC 3.3V
A0 P0

Run Your Script

Either copy and paste, or re-create the following code into your own MakeCode editor by clicking the “Edit” Option in the upper right-hand corner of the editor window. You can also just download this example by clicking the download button in the lower right-hand corner of the code window.

Code to Note

Let’s take a look at the code blocks in this experiment.
If you are having a hard time viewing this code, click on the image above to get a better look!


If flame sensor detects the flame nearby,  the led matrix will show “Fire!”, or else it will show “safe~”.

Leave a Reply

Your email address will not be published. Required fields are marked *