Arduino Project

Flame Monitor 3.0

Course Introduction

In this lesson, you’ll learn how to use a Flame Sensor, an I2C LCD Display, and the Arduino UNO R4 to monitor fire intensity. The LCD shows real-time readings, while buzzer provide sound alerts for different flame levels.

Note

If this is your first time working with an Arduino project, we recommend downloading and reviewing the basic materials first.

1.1 Install Arduino IDE(Important)
1.2 Introduction of Arduino IDE

Required Components

In this project, we need the following components:

SN

COMPONENT INTRODUCTION

QUANTITY

PURCHASE LINK

1

Arduino UNO R4 Minima

1

2

USB Type-C cable

1

×

3

Breadboard

1

BUY

4

Wires

Several

5

Flame Sensor Module

1

6

Buzzer Modudle

1

7

I2C LCD 1602

1

Wiring

7.png__PID:93f4bd15-941a-4e3c-bcff-2139e95f01f0

Common Connections:

Flame Sensor Module
A0:
Connect to A0 on the Arduino.
GND: Connect to breadboard’s negative power bus.
VCC: Connect to breadboard’s red power bus.

Buzzer Modudle
I/O:
Connect to 10 on the Arduino.
GND: Connect to breadboard’s negative power bus.
VCC: Connect to breadboard’s red power bus.

I2C LCD 1602
SDA:
Connect to A4 on the Arduino.
SCL: Connect to A5 on the Arduino.
GND: Connect to breadboard’s negative power bus.
VCC: Connect to breadboard’s red power bus.

Writing the Code

Note
You can copy this code into Arduino IDE.
To install the library, use the Arduino Library Manager and search for LiquidCrystal_I2C and install it.
Don’t forget to select the board(Arduino UNO R4 Minima/WIFI) and the correct port before clicking the Upload button.


#include 
#include 

// Pin definitions
const int sensorPin = A0;     // Flame sensor analog pin
const int buzzerPin = 10;     // Buzzer pin

// Threshold values
const int safeThreshold = 100;
const int dangerThreshold = 700;

// LCD object (address 0x27, 16 columns, 2 rows)
LiquidCrystal_I2C lcd(0x27, 16, 2);

int flameValue = 0;

void setup() {
  Serial.begin(9600);

  lcd.init();
  lcd.backlight();

  pinMode(buzzerPin, OUTPUT);

  // Startup screen
  lcd.setCursor(0, 0);
  lcd.print("Flame Monitor");
  lcd.setCursor(0, 1);
  lcd.print("Initializing");
  delay(1200);
  lcd.clear();
}

void loop() {
  // Read sensor value
  int rawValue = analogRead(sensorPin);

  // Convert to intuitive value
  flameValue = 1023 - rawValue;

  // Serial output for debugging
  Serial.print("Flame Sensor Value: ");
  Serial.println(flameValue);

  // Status detection
  if (flameValue < safeThreshold) {
    displayStatus("Status: Safe");
    noTone(buzzerPin);
  }
  else if (flameValue < dangerThreshold) {
    displayStatus("Status: Warning");
    tone(buzzerPin, 800, 200);
  }
  else {
    displayStatus("Status: Danger");
    tone(buzzerPin, 1000, 400);
  }
  // Display value
  lcd.setCursor(0, 1);
  lcd.print("Value: ");
  lcd.print(flameValue);
  delay(200);
}

// Function to display status on first row
void displayStatus(const char* text) {
  lcd.setCursor(0, 0);
  lcd.print("                ");  // clear first row
  lcd.setCursor(0, 0);
  lcd.print(text);
}