Flame Sensor Interfacing with LPC2148

This article is a continuation of the series of tutorials on the LPC2148 Microcontroller (ARM7). The aim of this series is to provide easy and practical examples that anyone can understand. In the previous tutorial, we have interfaced the Touch detection sensor with LPC2148 (ARM7). In this tutorial, we are going to discuss Flame Sensor Interfacing with LPC2148.


Before starting this tutorial we should know the below topics. If you know already, please go further.

Components Required

  • LPC2148 Development Board
  • Flame Sensor
  • LCD Module (To print the Sensor output)


Fire is one of the most dangerous events possible; somewhere in the world, one occurs every minute of every day. While fire can be our friend in some instances, it can be our worst enemy when it’s uncontrolled and allowed to continue through a building. Fire is, of course, destructive, and the smoke from a fire creates a toxic, dangerous atmosphere. The rapid detection of a fire and its control can save several thousand lives, thousands of injuries, and millions of dollars in property loss each year.

The flame is the visible portion of the fire. So if we find the flame, then we can also find the fire.

Characteristics of flame

All flames have certain characteristics in common that include:

  • Production of heat
  • Expansion of gases
  • Production of the by-product of combustion
  • Emission of light (infrared or ultraviolet)
  • Ionization of the atmosphere in and around the flame

Flame detection systems have been developed to incorporate several of these characteristics.

Flame Detector or Fire Detector

flame detector is a sensor designed to detect and respond to the presence of a flame or fire, allowing flame detection.

Today’s flame detectors utilize optical technologies to detect flames. Flames are known to emit electromagnetic radiation in the infrared (IR), visible light, and ultraviolet (UV) wavelengths depending on the fuel source.

Optical flame sensors are divided into many groups depending on which range of the total radiation band they are designed to detect:

  • Ultraviolet detector
  • Near IR array
  • Infrared
  • Infrared thermal cameras
  • UV/IR
  • IR/IR flame detection
  • IR3 flame detection
  • Visible sensors

Flame detector using Infrared

Since more than 90% of the flame’s total radiation is infrared, these detectors receive ample radiation of quite high intensity and will operate with either very weak or very hot flames. So in this tutorial, we are going to use an IR flame detector.

Flame sensors are available in the market in two types one having three pins and the other having four pins respectively. Both of the sensors can be easily interfaced with any microcontroller. I am using the three-pin flame sensor in this tutorial.

Note: If you are using a 4-Pin sensor, you need to use D0 Pin to work with this example.

A flame sensor can detect fire or any other light sources whose wavelength is in the range of 760nm to 1100nm. This device consists of an IR sensor, an LED for indication, an operational amplifier circuit, and a potentiometer. The device is sensitive to flame so when it detects the flame it turns on its LED to show any indication. The sensitivity of the flame sensor can be adjusted according to the requirements. It can be used in different places e.g. in offices, homes, institutions, and industrial applications.

The PCB of this electronic circuit has a potentiometer. The Sensitivity of the Digital pin can be varied using the potentiometer.

Flame Sensor Interfacing with LPC2148


Flame Sensor

  • Vcc – 5v
  • GND – Ground
  • D0 – P1.24


  • RS – P0.8
  • RW – P0.9
  • EN – P0.10
  • Data Lines – P0.0 – P0.7

Flame Sensor Interfacing with LPC2148

Source Code

If it is detecting any flame in front of this sensor, LCD will display “Flame Detected”.

#define bit(x) (1<<x)
#define delay for(i=0;i<7000;i++);
#define FLAME (IO1PIN & (1<<24))
unsigned int i;
void lcd_int();
void dat(unsigned char);
void cmd(unsigned char);
void string(unsigned char *);
void main()
    IO0DIR =0XFFF;
    IO1DIR = 0x0;
    string("EMBETRONICX.COM ");
    while(1) {
            if(FLAME) {
                    string("Flame Detected");
void lcd_int()
void cmd(unsigned char a)
    IO0CLR|=bit(8);                //rs=0
    IO0CLR|=bit(9);                //rw=0
    IO0SET|=bit(10);               //en=1
    IO0CLR|=bit(10);               //en=0
void dat(unsigned char b)
    IO0SET|=bit(8);                //rs=1
    IO0CLR|=bit(9);                //rw=0
    IO0SET|=bit(10);               //en=1
    IO0CLR|=bit(10);               //en=0
void string(unsigned char *p)
    while(*p!='\0') {

Note: In our tutorial, we are using the 3-pin sensor. Only Digital output is available in this sensor. If you want to use the 4-pin sensor, you can use the 4-pin sensor’s, D0 Pin. But somebody may want to use an A0 pin in a 4-pin sensor. In that case, you cannot use this example. You need to use ADC for that case since it is not digital output.

In our next tutorial, we will see how to interface the Rain detecting sensor with LPC2148 (ARM7). If you want to use FreeRTOS on LPC2148, then please refer FreeRTOS series.

You can also read the below tutorials.

Linux Device Driver TutorialsC Programming Tutorials
FreeRTOS TutorialsNuttX RTOS Tutorials
RTX RTOS TutorialsInterrupts Basics
I2C Protocol – Part 1 (Basics)I2C Protocol – Part 2 (Advanced Topics)
STM32 TutorialsLPC2148 (ARM7) Tutorials
PIC16F877A Tutorials8051 Tutorials
Unit Testing in C TutorialsESP32-IDF Tutorials
Raspberry Pi TutorialsEmbedded Interview Topics
Reset Sequence in ARM Cortex-M4BLE Basics
VIC and NVIC in ARMSPI – Serial Peripheral Interface Protocol
STM32F7 Bootloader TutorialsRaspberry PI Pico Tutorials
STM32F103 Bootloader TutorialsRT-Thread RTOS Tutorials
Zephyr RTOS Tutorials - STM32Zephyr RTOS Tutorials - ESP32
AUTOSAR TutorialsUDS Protocol Tutorials
Product ReviewsSTM32 MikroC Bootloader Tutorial
VHDL Tutorials

Notify of

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Inline Feedbacks
View all comments
Table of Contents