0% found this document useful (0 votes)
29 views56 pages

Shubham Internship Report Final 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
29 views56 pages

Shubham Internship Report Final 1

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

AUTOMATIC FIRE-FIGHTING ROBOT USING

ARDUINO UNO

TCIL - CHANDIGARH

Submitted in partial fulfillment of the


Requirements for the award of
Degree of Bachelor of Technology in Electronics & Communication
Engineering

Submitted by:
Name: Shubham Negi Roll No. 22010104060

Training period: 03/06/2025 to 14/07/2025

Submitted to: Er. Akshay Kanwar

Department of Electronics & Communication


Engineering
JAWAHARLAL NEHRU GOVERNMENT
ENGINEERING COLLEGE, SUNDERNAGAR,
DISTRICT MANDI (HP)
AUTOMATIC FIRE-FIGHTING ROBOT USING
ARDUINO UNO

TCIL - CHANDIGARH

Submitted in partial fulfillment of the


Requirements for the award of
Degree of Bachelor of Technology in Electronics & Communication
Engineering

Submitted by:
Name: Shubham Negi Roll No. 22010104060

Training period: 03/06/2025 to 14/07/2025

Submitted to: Er. Akshay Kanwar

Department of Electronics & Communication


Engineering
JAWAHARLAL NEHRU GOVERNMENT
ENGINEERING COLLEGE, SUNDERNAGAR,
DISTRICT MANDI (HP)
TABLE OF CONTENTS

Certificate........................................................................................................................i

Declaration......................................................................................................................ii

Acknowledement...........................................................................................................iii

Training Evaluation sheet.............................................................................................iv

Training Assessment report......................................................................................v-vi

About Institute.............................................................................................................vii

List of Figure & Tables............................................................................................viii-ix

Chapter-1: Introduction to the Training Project..........................................................1

1.1 Introduction to Embedded System.....................................................................1

1.1.1 Defining an Embedded System...........................................................1

1.1.2 Core Components of an Embedded System........................................2

1.1.3 Application areas................................................................................2

1.2 The Internet of Things........................................................................................2

1.2.1 Defining the "Internet of Things"........................................................3

1.2.2 Key Components of an IoT System.....................................................3

1.2.3 Purpose of IoT in Industry...................................................................3

1.3 Development Environment and Tools................................................................3

1.3.1 The Arduino Platform.........................................................................3

1.3.2 Basic Programming Structure.............................................................4

1.3.3 Core I/O Functions..............................................................................4

1.4 Problem Statement & Motivation.......................................................................5

1.4.1 The Unpredictable Nature of Fire........................................................5

1.4.2 Limitations of Manual Firefighting.....................................................5


1.4.3 The Need for an Automated Solution..................................................5

1.5 Literature Review...............................................................................................5

1.5.1 Flame Detection Technologies............................................................6

1.5.2 Robotic Navigation and Control..........................................................6

1.5.3 Common Extinguishing Mechanisms.................................................6

1.6 Project Overview................................................................................................6

1.6.1 Project Conception..............................................................................6

1.6.2 System Functionality...........................................................................6

1.6.3 Project Objectives...............................................................................7

Chapter-2: Weekly Progress Report...........................................................................8-9

Chapter-3: System Model & Technical Content.........................................................10

3.1 System Architecture.........................................................................................10

3.2 Hardware Components.....................................................................................11

3.2.1 Arduino UNO....................................................................................11

3.2.2 L298N Motor Driver.........................................................................15

3.2.3 Robot Chassis & BO Motors.............................................................18

3.2.4 Sensing Unit: IR Flame Sensors........................................................20

3.2.5 Fire Extinguishing Unit.....................................................................20

3.3 Software Components......................................................................................21

3.3.1 Arduino IDE.....................................................................................21

3.4 System Implementation...................................................................................24

3.4.1 System Flow Chart...........................................................................24

3.4.2 Circuit Diagram................................................................................26

3.4.3 Working Principle & Code Logic.....................................................28

Chapter-4: Result & Comparison...............................................................................29


Chapter-5: Conclusion & Future work.......................................................................34

Abstract.........................................................................................................................36

References......................................................................................................................41
CERTIFICATE

i
DECLARATION BY STUDENT

I hereby declare that the Industrial Training Report entitled ("AUTOMATIC FIRE-
FIGHTING ROBOT USING ARDUINO UNO") is an authentic record of work carried
out by me during my training at TCIL-IT, Chandigarh from 03 June 2025 to 14 July 2025
under the supervision of my training supervisor "Mr. Manoj Dhiman, Head - Training &
Development, TCIL-IT" for the award of the degree of [Link]. in Electronics &
Communication Engineering.

Date: ____________ Signature of Student: ______________


Shubham negi
22010104060

Signature of Head of Department:_______________

Examined by:

(Signature of Internal Examiner) ( Signature of External Examiner)

ii
ACKNOWLEDGEMENT

The elation and gratification of this training will be incomplete without mentioning all
the people who helped me to make it possible, whose gratitude and encouragement were
invaluable to me. Firstly, I express my sincere gratitude to "Mr. Manoj Dhiman, Head -
Training & Development" at TCIL-IT, Chandigarh for his support and guidance. I am
also thankful to my parents and friends for their love and encouragement throughout the
internship.

Date: Signature of student


Shubham Negi
22010104060

iii
TRAINING EVALUATION SHEET

iv
TRAINING ASSESSMENT REPORT

v
vi
ABOUT THE INSTITUTE

Telecommunication Consultants India Limited (TCIL), a prime engineering and


consultancy company, is a Mini Ratna Category-I wholly owned Government of
India Public Sector Enterprise under the administrative control of the Department of
Telecommunications (DOT), Ministry of Communications, Government of India.
TCIL was set up in 1978 with the primary mission of providing Indian telecom
expertise in all fields of telecom, Civil, and IT to developing countries around the
world.

The company's core competence is extensive, covering fields such as Switching,


Transmission Systems, Cellular services, Rural Telecommunication, Optical fibre
based backbone trans systems, IT & Networking Solutions, Application Software,
e-Governance, and also Civil construction projects. TCIL-IT, Chandigarh, is the
dedicated industrial and corporate training division of TCIL. This division was
established in 1999 and is managed by ICS Group (ICSIL), a joint venture of
DSIIDC and TCIL itself. It serves as a global training provider for high-end
emerging technologies, catering to aspiring engineering graduates ([Link]- CSE,
IT, ECE, ME) & MCA/MSC-IT. I had the opportunity to take part in an internship
at this institute on Embedded Systems and IoT, where I worked on multiple
projects. In this report, I will be sharing one of them with you.

Fig. 1. TCIL-CHANDIGARH Lab

vii
LIST OF FIGURES

Figure Figure Title / Description Pag


No. e
No.
Fig. 1.1 TCIL-CHANDIGARH Lab vii
Fig. 3.1 Block Diagram of Fire-Fighting Robot 10
Fig. 3.2 Arduino UNO Development Board 11
Fig. 3.3 Pin Diagram of Arduino UNO 12
Fig. 3.4 Arduino IDE Interface 13
Fig. 3.5 Sensors & Actuators Compatible with 13
Arduino
Fig. 3.6 Arduino IDE Sketch Structure 14
Fig. 3.7 L298N Motor Driver 15
Fig. 3.8 L298N Pin Diagram 16
Fig. 3.9 Connection of Arduino UNO with 17
L298N Motor Driver
Fig. Entry-Level Robot Chassis 18
3.10
Fig. BO Gear Motors 19
3.11
Fig. IR Flame Sensor 20
3.12
Fig. Servo Motor (SG90) 20
3.13
Fig. 9V Water Pump 21
3.14
Fig. TIP-122 Transistor 21
3.15
Fig. Arduino IDE Code Editor 22
3.16
Fig. Arduino IDE Library Manager 22
3.17
Fig. Serial Monitor Interface 23
3.18
Fig. System Flow Chart of Robot’s Working 24
3.19 Logic
Fig. Complete Circuit Diagram of the Fire- 26
3.20 Fighting Robot
Fig. Final Prototype of Automatic Fire- 29
3.21 Fighting Robot

viii
LIST OF TABLES

Table Title / Description Page


No. No.
Table Motor Driver Direction Control (Truth 24
3.1 Table)
Table Final Prototype Component Specifications 30
4.1
Table Autonomous Test Scenario Results 31
4.2
Table Potential Application Areas 33
4.3

ix
CHAPTER-1

INTRODUCTION

1.1 Introduction to Embedded Systems

1.1.1 Defining an Embedded System

An Embedded System is a dedicated computer system defined as an electronic system


or machine that combines computer hardware and software to perform a specific,
dedicated task. It is "embedded" because it operates as a component within a larger
mechanical or electrical system. The CPU chip, which can be a microprocessor or a
microcontroller, acts as the "brain" of the system. The software, often called firmware,
is stored in program memory and contains the specific instructions the CPU executes to
process inputs and control outputs.

This contrasts sharply with a general-purpose computer (like a PC or laptop), which is


designed to run a wide variety of applications (like web browsers, word processors, or
games) on a complex operating system. An embedded system is built for a single, defined
purpose. For example, the system inside a digital microwave is only designed to control
heating elements and read the keypad; it cannot run other software. The first modern
embedded system was used in the "Building Apollo Guidance System" by Charles Stark
Draper at MIT in 1960.

Key characteristics of an embedded system include:

• Task-Specific: It is designed to perform one pre-defined task or a very small set


of related tasks.
• Real-time Operation: Many embedded systems must respond to inputs and
events within a strict, predictable timeframe (e.g., a car's airbag system or a
robot's obstacle avoidance).
• High Reliability and Stability: They are designed to function continuously for
long periods without failure or needing a reboot, such as in industrial or medical
applications.
• Compact and Low Power: They are often battery-powered and must fit inside
a larger product, so energy efficiency and a small physical footprint are critical.

1.1.2 Core Components of an Embedded System

A typical embedded system is comprised of four main parts, as illustrated in the block
diagram. Each part performs a distinct role in the system's operation.

1
• Digital Input / Electronic Circuit: This is the sensory part of the system. It
gathers signals from the real world, such as a button press, a change in
temperature from a sensor, or a signal from another electronic component.
• CPU (Central Processing Unit): This is the "brain" of the system, which can be
either a Microprocessor or a Microcontroller. It fetches instructions from the
Program Memory, processes the input data, and makes decisions based on its
programming.
• Output / Display: This is the part of the system that performs an action on the
physical world. It includes components like LEDs, buzzers, motors, relays, or an
LCD screen that displays information.
• Program Memory / Instructions: This memory (often Flash or ROM) stores the
firmware or code that dictates the system's logic and behavior. These instructions
are permanent and do not change unless the system is reprogrammed.

1.1.3 Application Areas

Because of their dedicated nature, high reliability, and low cost, embedded systems are
ubiquitous in modern technology. Most people use them daily, often without realizing it.

Key application areas include:

• Home Appliances: Microwaves, washing machines, refrigerators, and smart


TVs.
• Home Automation: Smart lighting, thermostats, and automated sprinkler
systems.
• Security Systems: Digital locks, alarm systems, and surveillance cameras.
• Biomedical Instruments: Patient monitoring systems, pacemakers, and medical
imaging devices.
• Automobiles: Engine control units (ECUs), anti-lock braking systems (ABS),
and in-vehicle infotainment systems.
• Industrial Automation: Process control, monitoring systems, and assembly line
machinery.
• Robotics & Artificial Intelligence: Robotic arms, autonomous vehicles, and
drones.

1.2 Introduction to the Internet of Things (IoT)

1.2.1 Defining the "Internet of Things"

The Internet of Things (IoT) is a concept that was developed to establish communication
between embedded electronic systems and the internet. It refers to the network of
physical objects, or "things," that are embedded with sensors, software, and other

2
technologies for the purpose of connecting and exchanging data with other devices and
systems over the internet. In essence, it allows a dedicated embedded system to be
monitored and controlled from anywhere in the world, moving it from a standalone
device to a smart, connected device.

1.2.2 Key Components of an IoT System

A complete IoT solution fundamentally requires two main components:

• IoT - HARDWARE: This is the embedded system itself, equipped with a


communication module (like Wi-Fi or Bluetooth) that allows it to connect to the
internet. A prominent example of IoT hardware used in this training is the ESP32
microcontroller, which has Wi-Fi and Bluetooth integrated on the chip.

• IoT - CLOUD: This is a web-based service or platform that acts as the "web
interface". It is used to receive, store, and visualize the data sent from the IoT
hardware. It also provides a dashboard to send commands back to the device for
remote control. An example used during the training was the Cayenne IOT
dashboard.

For security, the IoT Hardware must be synced with the IoT Cloud, often through unique
certificates, Authorization codes, or API keys, to ensure that data is being sent and
received from a trusted source.

1.2.3 Purpose of IoT in Industry

The primary goals of implementing IoT in an industrial or consumer context are to add
remote capabilities that are impossible with a traditional embedded system:

• Remote Monitoring: To be able to check the status, sensor data, and values of a
machine or system from anywhere in the world using a web browser or mobile
app.
• Remote Control: To be able to control devices or machines (e.g., turn them on
or off, change settings) from anywhere, without being physically present.

1.3 Development Environment and Tools

1.3.1 The Arduino Platform

The training at TCIL-IT was centered on the Arduino platform, an easy-to-use, open-
source electronics platform ideal for creating embedded system projects. It consists of
both a physical hardware board and a software component (the IDE).

3
• Arduino Boards (UNO/Nano): These are the physical microcon

• .troller boards that serve as the project's brain. The Arduino UNO and Arduino
Nano were the primary boards used during the training. They contain the main
microcontroller (ATmega328P), digital I/O pins, analog input pins, and a USB
interface for programming and power. The Nano is particularly popular for
projects where space is limited due to its compact, breadboard-friendly size.

• Arduino IDE: This is the Arduino Integrated Development Environment (IDE),


a crucial open-source tool for working with Arduino-compatible boards. It is a
cross-platform application (runs on Windows, macOS, Linux) that provides a
simple, user-friendly interface to write, compile, and upload code (called
"sketches") to the microcontroller. Its key features include a Library Manager
for easily adding new functionalities (like for sensors or displays) and a Serial
Monitor for real-time debugging and data communication.

1.3.2 Basic Programming Structure

An Arduino sketch has two main functions that are required for any program to run,
making the code structure simple and organized.

• void setup(): This function is called only once when the sketch starts or after the
board is reset. It is used to initialize variables, set pin modes (input/output), and
start any communication libraries (like [Link]()).

• void loop(): After the setup() function has run, the loop() function runs
continuously and actively controls the board. All the main logic of the project,
such as reading sensors and controlling motors, is placed inside this function.

1.3.3 Core I/O Functions

To interact with the physical world, the following fundamental functions were used:

• pinMode(pin, mode): This function configures a specific digital pin to behave


as either an INPUT or an OUTPUT. An INPUT pin is used to read data from a
sensor or switch, while an OUTPUT pin is used to send data to control an actuator
like an LED or motor.

• digitalWrite(pin, value): This function writes a digital value (HIGH or LOW)


to a pin that has been configured as an OUTPUT. HIGH represents the voltage
of the microcontroller (e.g., 5V), and LOW represents 0V (ground). This is used
to turn components on or off.

• digitalRead(pin): This function reads the value (HIGH or LOW) from a digital
input pin, such as a switch or a digital sensor.

4
• analogRead(pin): This function reads the value from one of the dedicated analog
input pins (A0-A7 on the Nano). This function is essential for reading sensors
that provide a varying output, as it converts an incoming analog voltage (typically
0V to 5V) into a digital number ranging from 0 to 1023.

1.4 Problem Statement & Motivation

1.4.1 The Unpredictable Nature of Fire

Fire accidents are a severe and unpredictable hazard, with the potential to occur
anywhere, at any time. They can be caused by a multitude of factors, from faulty wiring
and unattended cooking to careless smoking. The danger lies in the "immense heat, toxic
smoke, and rapid spread of flames," which can lead to severe burns, smoke inhalation,
fatalities, and extensive property damage. These accidents pose a huge risk to both life
and property.

1.4.2 Limitations of Manual Firefighting

In any fire scenario, quick detection and response are crucial to minimize damage. The
traditional approach of manual firefighting, while heroic, is inherently dangerous for
human firefighters and can be time-consuming. The delay between the initial detection
of a fire and the arrival of a response team can be the critical factor that allows a small,
manageable fire to grow into an uncontrollable blaze.

1.4.3 The Need for an Automated Solution

This critical gap in response time creates a strong need for an automated solution.
Robotics and embedded systems offer a way to "automate fire detection and
extinguishing". An autonomous robot, like the one developed in this project, can act as
a "first line of defense." It can monitor an area 24/7, detect a fire at its inception, respond
immediately, and begin suppression, all while protecting human lives and equipment.

1.5 Literature Review

To develop a feasible and cost-effective solution for this project, a review of existing
technologies and common approaches in small-scale robotics was conducted. This
review focused on three key areas: flame detection, navigation, and extinguishing
mechanisms.

5
1.5.1 Flame Detection Technologies

Research shows various prototypes for fire detection. High-end industrial robots often
rely on thermal cameras and computer vision for precise fire localization. While these
methods are highly accurate, they are also expensive and require significant processing
power, making them unsuitable for a low-cost prototype. For small-scale Arduino and
IoT projects, IR (Infrared) Flame Sensors are the preferred choice. They are low-cost,
provide fast detection of infrared radiation emitted by a fire, and can be easily interfaced
with a microcontroller like the Arduino.

1.5.2 Robotic Navigation and Control

In the area of autonomous navigation, advanced systems often apply complex algorithms
like SLAM (Simultaneous Localization and Mapping) or computer vision for intelligent
pathfinding. However, for simple projects, this level of complexity is unnecessary.
Studies show that a common and effective method for basic navigation relies on the
Arduino UNO and an L298N motor driver. This combination is well-documented, cost-
effective, and provides reliable directional control for the BO motors, making it ideal for
the project's objectives.

1.5.3 Common Extinguishing Mechanisms

The method of extinguishing the fire also varies with the robot's scale. Large industrial
systems may use CO2 or fine mist for higher efficiency and to protect electronics. For
small, proof-of-concept robots, the most common and practical mechanism is a DC water
pump paired with a servo-controlled nozzle9. This approach is simple to implement, safe
for a household or lab environment, and effectively targets a small, localized fire.

1.6 Project Overview

1.6.1 Project Conception

The capstone project for this internship is the "AUTOMATIC FIRE-FIGHTING


ROBOT USING ARDUINO UNO". This project serves as a practical implementation
of the "Embedded Systems" principles learned during the training at TCIL-IT. It
synthesizes all the core training modules: sensor input (from the flame sensors),
microcontroller processing (using the Arduino UNO), and actuator control (managing
the motors and water pump).

1.6.2 System Functionality

The robot is an autonomous vehicle designed to provide a first line of defense against
indoor fires. Its operation is based on a clear sensing-processing-acting loop:

6
• Sensing: The robot uses three IR flame sensors (placed left, center, and right) to
constantly scan for a fire. This setup allows it to not only detect the presence of a
flame but also determine its direction.

• Processing & Navigation: All sensor data is fed to the Arduino UNO, which
acts as the main controller. Based on which sensor detects the flame, the
Arduino's code autonomously navigates the robot toward the fire source using
four BO motors controlled by an L298N motor driver.

• Actuation: Once the robot is close to the fire, the Arduino activates the
extinguishing mechanism. It sends a signal to a TIP-122 transistor, which
switches on the mini water pump. Simultaneously, it controls a mini servo motor
to sweep the water nozzle from side to side, spraying water over the fire until it
is suppressed.

1.6.3 Project Objectives

The specific, formal objectives for this project are as follows:

• Fire Detection: To utilize three flame sensors (left, right, center) to effectively
detect the presence and direction of a fire.

• Autonomous Navigation: To program the robot to autonomously navigate


toward the fire source by controlling BO motors with an L298N motor driver.

• Fire Extinguishing: To use a mini water pump with a servo-controlled nozzle to


automatically spray water directly on the detected flame .

• Compact Design: To build a functional, low-cost prototype using an Arduino


UNO and other easily available components.

7
CHAPTER-2

WEEKLY PROGRESS REPORT

Week 1: Fundamentals of Embedded Systems & Arduino

• Learned the fundamentals of Embedded Systems, including their


definition as a combination of hardware and software for a specific task,
and their basic architecture.
• Introduced to the Arduino platform, focusing on the Arduino UNO and
Arduino Nano boards.
• Studied the Arduino IDE, its user-friendly interface, Library Manager,
and the basic C++ programming structure (void setup() and void loop()).
• Performed initial experiments, including basic LED blinking and using
the Serial Monitor for debugging.

Week 2: Sensors and Motor Control

• Studied DC Motors (specifically BO Motors) and the L298N Motor


Driver module, which is required to control the speed and direction of
motors from a microcontroller.
• Assembled the basic 4-wheel robot chassis with the BO motors.
• Wrote the first motor control program to make the robot move Forward,
Backward, Left, and Right using digitalWrite() commands.
• Studied analog sensors and the Analog-to-Digital Converter (ADC).
Interfaced the first IR Flame Sensor and learned to read its analog value
using the analogRead() function.

Week 3: Logic and Multi-Sensor Integration

• Integrated all three IR Flame Sensors onto the robot chassis, placing
them to cover the Left, Center, and Right fields of view as per the project
objective.
• Developed the core autonomous logic for the robot using if-else
statements. This logic compares the values from the three sensors to a
threshold to determine the direction of the fire.
• Combined the sensor logic with the motor control code from Week 2.

8
• Tested the robot's ability to autonomously turn and move towards a
simulated fire source (e.g., a lighter), successfully demonstrating the core
navigation logic.

Week 4: Actuator & Extinguishing System

• Studied the Mini Water Pump and its high current requirements, which
cannot be supplied directly from an Arduino pin.
• Learned to use a TIP-122 Transistor as a digital switch (driver) to safely
power the pump using an external battery, based on a HIGH signal from
the Arduino.
• Studied Pulse Width Modulation (PWM) and interfaced the SG90 Mini
Servo Motor, which will be used to aim the water nozzle.
• Wrote separate test sketches to successfully control the water pump
(On/Off) and sweep the servo motor.

Week 5: Full System Integration & IoT Concepts

• Mounted the water pump, servo motor, and Water Tank onto the robot
chassis.
• Combined all individual code modules (sensor reading, directional logic,
motor control, and extinguishing system) into one final, master program.
• Conducted full system integration tests and began debugging the complete
autonomous logic (e.g., stopping the motors before activating the pump).
• As part of the IoT training, we studied the ESP32 microcontroller and
its built-in Wi-Fi/Bluetooth, along with cloud platforms like Cayenne, to
plan for future project upgrades.

Week 6: Final Testing, Documentation, and Report

• Calibrated the final flame sensor sensitivity (analog threshold values).


• Performed final demonstrations of the complete robot. The tests
successfully showed the robot detecting a controlled flame, navigating to
it, stopping, and extinguishing it, as described in the working principle.
• Documented the project, including the final circuit diagram and all source
code.
• Compiled the final six-weeks industrial training report.

9
CHAPTER-3

SYSTEM MODEL & TECHNICAL CONTENT

This chapter provides a detailed technical overview of the Automatic Fire-Fighting


Robot. It describes the system architecture, hardware components, software tools, and
the core logic that enables the robot to function.

3.1 ARCHITECTURE

The architecture of the fire-fighting robot is centered around the Arduino UNO, which
acts as the main processing unit. The system is designed based on a simple input-
processing-output model.

Fig. 3.1. Block Diagram

• Input: The Arduino receives data from the three IR Flame Sensors. This
data indicates the presence and direction of a fire.

• Processing: The Arduino UNO continuously reads and processes this


sensor data, comparing it to a predefined threshold to make decisions.

• Output: Based on its logic, the Arduino sends commands to two main
actuator systems:

10
1. The L298N Motor Driver: which controls the BO Motors for
navigation.

2. The TIP-122 Pump Driver and Mini Servo: which operate the
Water Pump and nozzle to extinguish the fire.

3.2 Hardware Components

3.2.1 Arduino Uno

The Arduino UNO is the main microcontroller and "brain" of the robot. It is based on the
ATmega328P microcontroller and provides 14 digital I/O pins (6 of which are PWM-
capable) and 6 analog input pins. It was chosen for this project due to its simplicity,
extensive online community support, and the ease of programming using the Arduino
IDE. The flame sensors are connected to its analog pins, while the motor driver and pump
circuit are controlled via its digital pins.

Fig. 3.2. Arduino UNO Development Board

11
Components on the Arduino UNO Board

• ATmega328P Microcontroller — The “brain” of the board


• USB Port (Type-B) — For programming and serial communication with PCs.
• Voltage Regulator — Provides stable 5V and 3.3 V supply to the board
• DC Power Jack — External power supply input (7—12 V).
• Digital Pins (0—13) — General purpose input/output pins, some with PWM
support.
• Analog Pins (AO—A5) — For analog sensor input (10-bit ADC).
• Reset Button — Resets the microcontroller program.
• Crystal Oscillator (16 MHz) — Provides timing signals for accurate processing.
• Power Pins:
o 0 5V pin (regulated output)
o 3.3 V pin (from onboard
regulator)
o GND (ground reference)
o Vin(input from external supply)
• ICSP Header — For programming the microcontroller directly (In-System
Programming).
• LED Indicators:
o ON (power indicator)
o TX/RX (serial data transmission indicators)
o Pin 13 LED (user-programmable)

Fig. 3.3. Pin Diagram of Arduino Uno

12
Working of Arduino UNO

• When powered on, the ATmega328P microcontroller executes the code stored in
its Flash memory.
• Users upload programs (called sketches) via the Arduino IDE using a USB cable.

Fig. 3.4. Arduino IDE

• Input devices like sensors, switches, or Bluetooth modules provide data to the
Arduino through digital/analog pins.

Fig. 3.5. Sensors & Actuators Compatible with Arduino

• The Arduino processes the data and controls output devices like LEDs, motors,
displays, or relays through its GPIO pins.
13
• Communication with other devices can be established using UART, SPI, or 12C
protocols.

Programming Arduino UNO

• Programming Language: C/C++ (simplified with Arduino libraries).


• Development Tool: Arduino IDE or Arduino Web Editor.
• Typical Sketch Structure:
o setup() - Runs once to initialize settings (e.g., pinMode, Serial. begin).
o loop() - Runs continuously for main logic execution.

Fig. 3.6. Arduino IDE Sketch Structure

Limitations of Arduino UNO

• Limited memory (32 KB flash, 2 KB SRAM).


• Operates only at 5V logic level (some modern sensors use 3.3 V)
• Limited processing power (8-bit, 16 MHz) compared to advanced boards (e.g.,
Raspberry Pi, STM32).
• Not suitable for high-speed or real-time complex applications.

14
3.2.2 L298N Motor Driver

The L298N Motor Driver Module is one of the most commonly used motor driver
boards in robotics and embedded systems. It is based on the L298N dual H-bridge IC,
which allows controlling the direction and speed of two DC motors, or one stepper
motor, simultaneously.

Since microcontrollers (like Arduino, Raspberry Pi, or STM32) cannot provide enough
current to drive motors directly, the L298N acts as an interface between low-power
control circuits and high-power motors.

Fig. 3.7. L298N Motor Driver

Pin Configuration
• L298N IC (internal pins):
o IN 1, IN2: Motor A direction control
o IN3, IN4: Motor B direction control
o ENA, ENB: Enable pins (used for PWM speed control of Motor A&B)
o Vs (Vcc): Motor supply voltage (up to 35V)
o Vss (Logic Supply): 5V logic power.
o GND: Common ground
o OUT l, OUT2: Motor A outputs
o OUT3, OUT4: Motor B outputs

15
• L298N Module (commonly used breakout):
o 12 V (or 7—12 V) Pin: External motor power supply
o 5 V Pin: On-board regulator output (can power Arduino if jumper is
connected)
o GND: Ground (must be common with controller)
o ENA, ENB Speed control (connect to PWM pins on Arduino)
o IN 1, IN2: Control Motor A direction
o IN3, IN4: Control Motor B direction
o OUT 1, OUT2: Connect to Motor A terminals
o OUT3, OUT4: Connect to Motor B terminals

Fig. 3.8. L298N Pin Diagram

Working Principle

The L298N motor driver works on the H-Bridge circuit principle.

• An H-Bridge allows current to flow in either direction through the motor.

16
• By controlling the input signals (IN 1, IN2, IN3, IN4), you can make the
motor rotate forward, backward, or stop
• The Enable pins (ENA, ENB) control whether the motor is active or not and
allow PWM signals to regulate speed.

Table 3.1. Motor Direction Control (Truth Table):

EN IN1 IN2 MOTOR ACTION


1 1 0 Forward
1 0 1 Reverse
1 0 0 Stop (Coast)
1 1 1 Stop (Break)
0 x x Disable (off)

Typical Connection with Arduino UNO

1. Connect ENB - Arduino PWM pins (e.g., D3).


2. Connect IN3, IN4 - Arduino digital pins (e.g., D5, D6).
3. Connect OUT 1, OUT2 - Motor terminals.
4. Connect 12 V pin - Battery/motor power supply
5. Connect GND - Common ground with Arduino.
6. Optional Jumper - Use on-board 5V regulator to power Arduino.

Fig. 3.9. Connection of Arduino UNO with L298n Motor Driver

17
3.2.3 Robot Chassis & BO Motors

ROBOT CHASSIS

A robot chassis is the base frame or structural body of a robot. It acts as the foundation
that holds all the essential components together, such as motors, wheels, sensors,
controllers (Arduino, Raspberry Pi, etc.), motor drivers, batteries, and other mechanical
parts.

The chassis not only provides mechanical support but also determines the stability,
mobility, and durability of the robot. Its design plays a critical role in how well the robot
performs in different environments and applications.

Fig. 3.10. Entry level Robot Chassis

BO MOTORS

A BO (Battery Operated) Gear Motor is a small, lightweight, and low-cost DC geared


motor commonly used in robotics, embedded systems, and DIY projects. These motors
are designed to run on low DC voltages (3—12 V) and provide high torque at low speeds
due to their built-in gear reduction system.

Because of their compact design, easy mounting, and affordable cost, BO gear motors
are especially popular for line-following robots, obstacle-avoiding robots, Bluetooth-
controlled cars, and other educational robotic kits.

18
Fig. 3.11. BO Gear Motors

Working Principle
• When DC voltage is applied, the internal DC motor rotates at high speed.
• This high-speed, low-torque rotation passes through a gear reduction
mechanism, which slows down the shaft speed but increases torque.
• By changing the polarity of the input voltage, the motor shaft can rotate
clockwise or counterclockwise.
• The motor speed can be controlled using PWM signals from a motor driver (e.g.,
L298N, L293D, or BTS7960).

Technical Specifications (Typical 6V BO Motor)


• Voltage Range: 3—12 V
• Rated Voltage: 6V
• RPM @ 6V: ~150 RPM
• Torque @ 6V: ~1.2 kg cm
• Current @ No Load: 60—70 mA
• Stall Current: —300 mA
• Shaft Diameter: 6 mm (compatible with common plastic wheels)

19
3.2.4 Sensing Unit: IR Flame Sensors

The "eyes" of the robot are three IR (Infrared) Flame Sensors. These sensors are
specifically designed to detect infrared radiation emitted by fire within a specific
spectrum (typically 760 nm to 1100 nm). Three sensors are used and placed at the front
of the robot (left, center, and right). This configuration is critical, as it allows the robot
to not only detect the presence of a fire but also to determine its direction, enabling
autonomous navigation.

Fig. 3.12. IR Flame sensor

3.2.5 Fire Extinguishing Unit

This subsystem is responsible for putting out the fire and consists of three parts:

• Mini Servo Motor (SG90): A small, low-cost servo used to aim the water
nozzle. It is controlled by a PWM signal from the Arduino to sweep left and
right, covering a wider area.

Fig. 3.13. Servo Motor

20
• 5-9V Water Pump: A simple DC pump that draws water from the onboard tank
and ejects it through the nozzle.

Fig. 3.14. 9V Water Pump

• TIP-122 Transistor: This is a crucial component that acts as a digital switch.


The Arduino's 5V pin cannot power the pump directly. Instead, the Arduino
sends a small signal to the "Base" of the TIP-122, which allows the higher
current from the main battery pack to flow through it and power the pump.

Fig. 3.15. TIP-122 Transistor

3.3 Software Components

3.3.1 Arduino IDE

The Arduino Integrated Development Environment (IDE) is the open-source software


used to write, compile, and upload code to the Arduino UNO board. It is a cross-platform
application that uses a simplified version of C++. Key features used in this project
include:

21
• Code Editor: For writing the program logic (the "sketch").

Fig. 3.16. Code Editor

• Library Manager: For including pre-written code for hardware like the Servo
motor (Servo.h).

Fig. 3.17. Arduino IDE Library Manager

22
• Serial Monitor: An essential tool for debugging. It allowed for printing sensor
values in real-time to calibrate the flame detection threshold and verify the robot's
logic.

Fig. 3.18. Serial Monitor

Components of Arduino IDE


• The Arduino IDE has several key parts:
• Menu Bar — Contains options like File, Edit, Sketch, Tools, and Help
• Toolbar — Provides quick access to Verify, Upload, New, Open, Save, and
Serial Monitor.
• Code Area (Editor Window) — Main area where you write your sketches
(programs).
• Message Area — Displays information, errors, and warnings during
compiling/uploading.
• Text Console — Shows detailed output messages, including errors.
• Board & Port Selection — Allows selecting the connected Arduino board and
communication port.

Workflow of Arduino IDE


• Write Code in the sketch editor.
• Verify/Compile the code to check for errors.
• Connect Arduino Board to PC via USB cable.
• Select Board & Port from the Tools menu
• Upload Code to the Arduino board
• Monitor Output using Serial Monitor or Serial Plotter.

23
3.4 System Implementation

3.4.1 System Flow Chart

The following flow chart illustrates the decision-making logic of the robot's program.
The entire process is a continuous loop of sensing, deciding, and acting.

Fig. 3.19. System Flow Chart

The process is as follows:

1. Start: The program execution begins.

2. Initialize Arduino, Sensors & Motors: When the robot is powered on, the
Arduino UNO runs its setup () function. This step initializes all hardware, sets
the pin modes (INPUT/OUTPUT) for the three flame sensors, the L298N motor
driver pins, the servo motor, and the TIP-122 transistor (pump driver).

3. Read Flame Sensor: The robot enters its main continuous loop (). The first
action is to read the values from all three flame sensors (left, center, right).

24
4. Fire Detected? (Decision): The robot's core logic is a decision block. The
Arduino compares the values from the sensors to a predefined threshold. If all
sensor values are above the threshold, no fire is detected. If any sensor value
drops below the threshold, a fire is detected.

5. 'No' Path (Patrolling): If no fire is detected, the "No" path is taken. The robot
remains in its idle state, "No Fire Detected - Keep Patrolling". In this state, the
motors are stopped, and the robot simply waits, ready to read the sensors again
in the next loop.

6. 'Yes' Path (Navigation): If a fire is detected by any sensor, the "Yes" path is
taken. The robot executes the "Move Towards Fire" block. This block contains
the directional logic:
o If the center sensor detects fire, the robot moves forward.
o If the left sensor detects fire, the robot turns left.
o If the right sensor detects fire, the robot turns right.

7. Activate Pump + Servo Nozzle: As the robot moves towards the fire, it
simultaneously activates the extinguishing mechanism. The Arduino sends a
HIGH signal to the TIP-122 transistor (turning on the water pump) and sends
PWM signals to the servo motor to sweep the nozzle side-to-side.

8. Is Fire Extinguished? (Decision): While the pump is active, the robot


continuously re-checks the flame sensors.

9. 'No' Path (Loop): If the fire is still detected (sensor values are still low), the
"No" path loops back, keeping the pump and servo active. The robot may also
continue to adjust its position.

10. 'Yes' Path (Success): Once the sensor readings return to normal (above the
threshold), the fire is considered extinguished. The "Yes" path is taken , and the
robot executes "Stop Pump, Return to Petrol". This deactivates the pump and
centers the servo.

11. Continue Scanning: The robot then returns to its main detection loop, ready to
detect any new fire.

25
3.4.2 Circuit Diagram

The circuit diagram below shows the complete wiring of all components, including the
sensors, Arduino, motor driver, and pump circuit. All components share a common
ground (GND).

Fig. 3.20. Circuit Diagram

The circuit can be broken down into four main subsystems:

A. Power Supply
• The entire system is powered by a 7.4V Li-ion Battery Pack.
• A main power switch is connected between the battery and the rest of the circuit
to turn the robot on and off.
• The 7.4V positive (red) and negative (black/GND) wires are distributed to the
components that require high current: the L298N Motor Driver (12V input) and
the water pump circuit.
• The Arduino UNO is powered via its Vin pin, which is connected to the 7.4V
positive rail. The Arduino's onboard voltage regulator steps this down to 5V for
its own operation.

B. Input (Sensors)

26
• The three IR Flame Sensors are the robot's inputs.
• VCC (Power): Each sensor is connected to the 5V pin on the Arduino.
• GND: Each sensor is connected to the common GND.
• Output: The analog output pins (A0) of the three sensors are connected to three
Analog In pins (A0, A1, A2) on the Arduino. This allows the Arduino to read a
varying value representing the intensity of the fire, which is more reliable than a
simple digital ON/OFF.

C. Navigation (Motor Control)


• The L298N Motor Driver controls the four BO Motors.
• Power: The L298N's 12V input pin is connected to the 7.4V battery. Its GND pin
is connected to the common ground.
• Control Pins: The L298N's logic input pins (IN1, IN2, IN3, IN4) are connected
to four digital pins on the Arduino (e.g., D8, D9, D10, D11). The Enable pins
(ENA, ENB) are also connected to Arduino digital (PWM) pins to control motor
speed.
• Output: The L298N's four output terminals are connected to the four BO motors,
with two motors on each side wired in parallel.

D. Extinguishing System (Pump & Servo)

This subsystem consists of two parts:

1. Mini Servo Motor:


o The servo (which aims the nozzle) is powered by the 5V output pin on the
L298N module.
o Its GND pin is connected to the common ground.
o Its Signal (yellow/orange) pin is connected to a digital (PWM-capable)
pin on the Arduino (e.g., D3).

2. Water Pump & Driver Circuit:


o The Water Pump is a high-current device and cannot be connected directly
to the Arduino. It is controlled using a TIP-122 Transistor (or a similar
NPN Darlington transistor) as a switch.
o The pump's positive (red) wire is connected directly to the 7.4V battery
positive rail.
o The pump's negative (black) wire is connected to the Collector pin (the
middle pin) of the TIP-122 transistor.
o The transistor's Emitter pin (the right-most pin) is connected to the
common GND.
o The transistor's Base pin (the left-most pin, which acts as the "switch") is
connected to an Arduino digital pin (e.g., D7) through a 1kΩ Resistor.
o How it works: When the Arduino pin is LOW, the transistor is "off," and
no current flows. When the Arduino sends a HIGH signal, it activates the

27
transistor, "closing" the circuit and allowing current to flow from the
battery, through the pump, through the transistor, and to ground, thus
turning the pump on.

3.4.3 Working Principle & Code Logic

The working principle follows the logic defined in the flow chart :

1. Initialization: In the setup () function, all Arduino pins are configured. The
sensor pins are set as INPUT, while the motor driver, servo, and pump driver pins
are set as OUTPUT. The Serial Monitor is also initialized ([Link](9600))
for debugging.

2. Fire Detection (in loop ()): In every loop, the Arduino continuously reads the
analog values from the three flame sensors. A threshold value is defined in the
code. If a sensor's reading drops below this threshold, it signifies that a flame has
been detected.

3. Navigation Logic: This is the core if-else logic of the robot:


o if (center_sensor < threshold): Fire is straight ahead. The robot is
programmed to Move Forward.
o else if (left_sensor < threshold): Fire is to the left. The robot is
programmed to Turn Left.
o else if (right_sensor < threshold): Fire is to the right. The robot is
programmed to Turn Right.
o else: No fire is detected. The robot is programmed to Stop (or "Keep
Patrolling").

4. Extinguishing Logic: When the robot gets very close to the fire (e.g., when the
center sensor reading is very low, or all three sensors detect fire), the navigation
logic is paused, and the extinguishing function is called. This function:
o Sets all motor driver pins to LOW to Stop the robot.
o Sends a HIGH signal to the TIP-122 transistor pin, activating the pump.
o Uses the [Link]() command to sweep the servo from side to side to
ensure the water jet covers the entire flame.
o This continues until the sensors no longer detect a flame, at which point
the pump stops, and the robot returns to its "Patrolling" state.

28
CHAPTER 4

FINDING AND RESULT

4.1 Final Prototype Specifications

After the final assembly and integration of all subsystems, the "Automatic Fire-Fighting
Robot" prototype was complete. The final system, as shown in the figure below,
successfully integrates the 4-wheel drive chassis, the Arduino UNO microcontroller, the
L298N motor driver, the 7.4V Li-ion battery pack, the three IR flame sensors at the front,
and the water pump system with its servo-controlled nozzle.

Fig. 3.21. Final Prototype

29
The specifications of the key components were finalized as follows, forming a complete
and functional system:

Table 4.1: Final Prototype Component Specifications

Component Model / Type Role in Project

The "brain" of the robot; processes


Arduino UNO
Microcontroller all sensor data and controls all
(ATmega328P)
actuators.

Receives logic signals from the


L298N Dual H-
Motor Driver Arduino to control the speed and
Bridge
direction of the four BO motors.

4x BO (Battery
Provide 4-wheel drive (4WD) for the
Motors Operated) DC
robot's chassis.
Motors

Powers the Arduino (via Vin), the


7.4V Li-ion Battery
Power Supply L298N motor driver, and the water
Pack
pump.

3x IR (Infrared) The primary input; used to detect the


Flame Sensors
Flame Sensors presence and direction of a fire.

Acts as a digital switch, allowing the


TIP-122 NPN
Pump Driver Arduino's low-current pin to control
Transistor
the high-current water pump.

SG90 Mini Servo Aims the water nozzle by sweeping


Nozzle Control
Motor left and right to cover a wider area.

5-9V Mini
The primary actuator for
Pump Submersible Water
extinguishing the fire.
Pump

30
4.2 Testing Methodology and Results

4.2.1 Testing Scenarios

The robot was tested against its core objectives:


1. Detection: Does the robot correctly identify a fire?
2. Navigation: Does the robot correctly move towards the fire based on sensor
input?
3. Extinguishing: Does the robot successfully activate the pump and servo when it
reaches the fire?
4. Autonomy: Does the full "detect, navigate, and extinguish" loop function
without human intervention?

4.2.2 Quantitative Test Results

The following table summarizes the performance of the robot's logic in various scenarios.
The flame sensors output a LOW signal when a flame is detected.

Table 4.2: Autonomous Test Scenario Results

Sensor
Scenario Response
Test Navigation
(Fire (Left, Extinguishing Result
# Action
Location) Center,
Right)

HIGH,
Stop /
1 No Fire HIGH, OFF Pass
Patrol
HIGH

HIGH,
Fire@1m, Move ON (while
2 LOW, Pass
Center Forward moving)
HIGH

LOW,
[email protected], ON (while
3 HIGH, Turn Left Pass
Left moving)
HIGH

31
Sensor
Scenario Response
Test Navigation
(Fire (Left, Extinguishing Result
# Action
Location) Center,
Right)

HIGH,
[email protected], ON (while
4 HIGH, Turn Right Pass
Right moving)
LOW

LOW,
Close-range Stop ON (Active
5 LOW, Pass
Fire Motors Sweep)
LOW

4.3 Advantages of the System

The designed prototype offers several key advantages over manual intervention or more
expensive systems.
• Early Fire Detection & Rapid Response: The robot is an "always-on"
monitoring system. It can detect a fire at its inception, far earlier than a human
might, and can take immediate action. This rapid response is crucial to preventing
a small fire from spreading.
• Autonomous Operation & Human Safety: The system is fully autonomous. It
detects, navigates, and extinguishes without any human involvement. This is its
single greatest advantage, as it removes the risk to human life, whether it's a
firefighter or a household member.
• Low-Cost & Accessible: The robot is based on an Arduino UNO, L298N motor
driver, and generic IR sensors, all of which are extremely cheap and widely
available. This makes it an accessible and affordable solution for students,
hobbyists, or even for deployment in multiple rooms of a home.
• Compact & Portable Design: Its small chassis allows it to operate in confined
indoor spaces like kitchens, laboratories, or server rooms where larger industrial
robots or human firefighters might struggle to maneuver.

32
4.4 Real-Time Applications

Table 4.3: Potential Application Areas

Specific
Sector Benefit & Use Case
Application

Monitors high-risk areas like kitchens or


Household
Residential workshops. Can extinguish a small stove fire
Safety 6
or electrical spark before it spreads.

Provides 24/7 monitoring in large, unmanned


Warehouses &
Industrial areas storing flammable goods, reducing the
Factories 7
risk of catastrophic accidents.

Protects sensitive, expensive, and often


Research & Labs & Server irreplaceable electronic equipment by
IT Rooms 8 detecting and suppressing a fire at its earliest
stage.

Acts as an additional automated safety layer,


Public Schools &
suppressing a fire while human-centric
Sector Hospitals 9
evacuation procedures are underway.

4.5 System Performance Analysis & Limitations

A critical analysis of the project also reveals several challenges and limitations that
were identified during testing.
• Sensor Limitations: The low-cost IR flame sensors have a limited effective
range (approx. 1-2 meters). They are also susceptible to false positives if
exposed to direct sunlight, which contains strong IR radiation.
• Mobility Limitations: The 4-wheel chassis is only effective on flat, indoor
surfaces. It has no mechanism for climbing over obstacles, opening doors, or
navigating stairs.
• Extinguishing Capability: The onboard water tank (a small bottle) provides a
very limited supply of water. This system is only effective for small, incipient-
stage fires and would be quickly overwhelmed by a larger blaze.
• Lack of Obstacle Avoidance: The robot's navigation is based only on the fire's
location. It lacks ultrasonic or IR proximity sensors. This means it will run into
any wall, chair, or furniture that is between it and the fire.

33
34
CHAPTER-5

CONCLUSION & FUTURE WORK

5.1 CONCLUSION

The industrial training project on the "Automatic Fire-Fighting Robot" was a


comprehensive and successful undertaking. It provided a valuable hands-on experience
in the domains of embedded systems and robotics, successfully bridging the gap
between academic theory and real-world engineering. The project successfully achieved
its primary objective: to design, build, and test a low-cost, autonomous robot capable of
detecting, navigating to, and extinguishing a small indoor fire.
Over the course of the training, a strong foundation was built in Arduino programming,
motor control, and sensor interfacing. The project demonstrated the effective
combination of simple, low-cost technology—like the Arduino UNO, IR flame sensors,
and an L298N motor driver—to create a practical solution to a real-world problem.
While not a replacement for professional firefighters, the robot serves as a powerful
proof-of-concept for an automated assistant that can reduce risk, save critical response
time, and enhance safety in homes, labs, and industries. This internship at TCIL-IT has
significantly enhanced my practical knowledge, problem-solving abilities, and technical
confidence, preparing me for future advanced projects in embedded systems, IoT, and
automation.
Key achievements and takeaways from the project include:
• Successful System Integration: All hardware components, including multiple
sensors (IR Flame Sensors), actuators (DC Motors, Servo Motor, Water Pump),
and drivers (L298N, TIP-122), were successfully integrated and controlled by a
single Arduino UNO microcontroller.
• Demonstrated Autonomous Logic: The robot proved its ability to operate
autonomously, successfully performing the complete "detect, navigate, and
extinguish" loop without any human intervention.
• Cost-Effective Solution: The project demonstrated that a functional, life-saving
device can be created using simple, low-cost, and widely available components.
• Practical Problem Solving: The project served as a powerful proof-of-concept
for an automated assistant that can reduce risk, save critical response time, and
enhance safety in homes, labs, and industries.

35
5.2 FUTURE WORK

• Obstacle Avoidance: The most critical short-term upgrade would be the addition
of Ultrasonic Sensors (like the HC-SR04). This would allow the robot to detect
and navigate around obstacles (like walls and furniture) instead of stopping,
making its autonomous navigation far more practical for a real-world
environment.
• IoT Integration (ESP32 Upgrade): The Arduino UNO could be replaced with
an ESP32 microcontroller. The ESP32 is a powerful, low-cost board with built-
in Wi-Fi and Bluetooth. This single upgrade is the gateway to all future IoT
capabilities.
• Cloud Connectivity & Remote Alerts: With the ESP32, the robot could be
connected to the internet. Upon detecting a fire, it could use an IoT Cloud
platform like Cayenne or ThingSpeak to send an instant alert notification to a
user's smartphone. This would inform the owner of the fire, even if they are not
at home.
• Live Video Feed: The ESP32 upgrade could also be an ESP32-CAM module.
This would allow the robot to stream a live video feed to the user's phone,
allowing them to visually confirm the fire and the robot's status, transforming it
from a simple robot into a smart, remote-presence device.

36
APPENDIX

//1. INCLUDE LIBRARIES ===


#include <Servo.h> // Include the Servo library

//2. DEFINE PINS ===

// --- Motor Driver (L298N) Pins ---


// Motor A (Left Side)
#define ENA 5 // Enable A (PWM Speed Control)
#define IN1 6 // Input 1
#define IN2 7 // Input 2
// Motor B (Right Side)
#define IN3 8 // Input 3
#define IN4 9 // Input 4
#define ENB 10 // Enable B (PWM Speed Control)

// --- Sensor Pins (Analog) ---


#define LEFT_SENSOR A0
#define CENTER_SENSOR A1
#define RIGHT_SENSOR A2

// --- Actuator Pins ---


#define PUMP_PIN 11 // Digital pin for TIP-122 Transistor
#define SERVO_PIN 3 // PWM pin for Servo Motor

// === 3. GLOBAL VARIABLES ===


int left_val;
int center_val;
int right_val;

// This is the detection threshold. Adjust this value (0-1023)


// based on your sensor's sensitivity and testing environment.
// A lower value means the fire must be closer/stronger.
int threshold = 500;

Servo nozzleServo; // Create a servo object

// === 4. SETUP FUNCTION (Runs once) ===


void setup() {
[Link](9600); // Start serial for debugging

37
// --- Initialize Motor Pins ---
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(ENB, OUTPUT);

// --- Initialize Actuator Pins ---


pinMode(PUMP_PIN, OUTPUT);
[Link](SERVO_PIN);

// --- Initialize Sensor Pins ---


pinMode(LEFT_SENSOR, INPUT);
pinMode(CENTER_SENSOR, INPUT);
pinMode(RIGHT_SENSOR, INPUT);

// --- Set default states ---


digitalWrite(PUMP_PIN, LOW); // Make sure pump is OFF
[Link](90); // Center the servo
stopMotors(); // Make sure motors are OFF

// Set motor speed (0-255). 200 is a good, controllable speed.


analogWrite(ENA, 200);
analogWrite(ENB, 200);

[Link]("Fire Fighting Robot Initialized. Awaiting commands.");


}

// === 5. MAIN LOOP (Runs continuously) ===


void loop() {
// Read analog values from all three sensors
readSensors();

// --- Main Logic Block ---


if (center_val < threshold) {
// Fire is straight ahead OR very close
if (left_val < threshold || right_val < threshold) {
// Fire is very close, stop and extinguish
extinguishFire();
} else {
// Fire is only in the center, move forward

38
moveForward();
}
}
else if (left_val < threshold) {
// Fire is on the left
turnLeft();
}
else if (right_val < threshold) {
// Fire is on the right
turnRight();
}
else {
// No fire detected
stopMotors();
}

delay(50); // Small delay to stabilize loop


}

// === 6. CUSTOM FUNCTIONS ===

void readSensors() {
left_val = analogRead(LEFT_SENSOR);
center_val = analogRead(CENTER_SENSOR);
right_val = analogRead(RIGHT_SENSOR);

// Print values to Serial Monitor for debugging


[Link]("L: ");
[Link](left_val);
[Link](" | C: ");
[Link](center_val);
[Link](" | R: ");
[Link](right_val);
}

void extinguishFire() {
[Link]("Action: EXTINGUISHING FIRE");
stopMotors(); // Stop moving

digitalWrite(PUMP_PIN, HIGH); // Turn on the water pump

// Sweep the servo

39
[Link](60); // Move to 60 degrees
delay(500);
[Link](120); // Move to 120 degrees
delay(500);
[Link](90); // Return to center
}

// --- Motor Control Functions ---

void moveForward() {
[Link]("Action: Moving Forward");
// Left Motor Forward
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
// Right Motor Forward
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}

void turnLeft() {
[Link]("Action: Turning Left");
// Left Motor Backward
digitalWrite(IN1, LOW);
digitalWrite(IN2, HIGH);
// Right Motor Forward
digitalWrite(IN3, HIGH);
digitalWrite(IN4, LOW);
}

void turnRight() {
[Link]("Action: Turning Right");
// Left Motor Forward
digitalWrite(IN1, HIGH);
digitalWrite(IN2, LOW);
// Right Motor Backward
digitalWrite(IN3, LOW);
digitalWrite(IN4, HIGH);
}

void stopMotors() {
[Link]("Action: Stopping");
// Left Motor Stop

40
digitalWrite(IN1, LOW);
digitalWrite(IN2, LOW);
// Right Motor Stop
digitalWrite(IN3, LOW);
digitalWrite(IN4, LOW);
// Turn off pump if it was on
digitalWrite(PUMP_PIN, LOW);
}

41
REFERENCES

1. Arduino Official Documentation - [Link]

2. L298N Motor Driver Datasheet - STMicroelectronics

3. IR Flame Sensor Module Datasheet - Keyestudio / Generic Sensor Guide

4. K. P. S. Rana, R. Prakash, "Design and Implementation of Fire Fighting

Robot", International Journal of Advanced Research in Electrical,

Electronics and Instrumentation Engineering, 2018.

5. A. Sharma, M. Verma, "Autonomous Fire Fighting Robot Using Arduino",

International Journal of Innovative Research in Science, Engineering and

Technology, 2019.

6. TutorialsPoint, Embedded Systems and Robotics Basics -

[Link]

7. Datasheets of TIP122 transistor, Servo motor (SG90), Water pump

module from manufacturer websites.

42

You might also like