Shubham Internship Report Final 1
Shubham Internship Report Final 1
ARDUINO UNO
TCIL - CHANDIGARH
Submitted by:
Name: Shubham Negi Roll No. 22010104060
TCIL - CHANDIGARH
Submitted by:
Name: Shubham Negi Roll No. 22010104060
Certificate........................................................................................................................i
Declaration......................................................................................................................ii
Acknowledement...........................................................................................................iii
About Institute.............................................................................................................vii
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.
Examined by:
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.
iii
TRAINING EVALUATION SHEET
iv
TRAINING ASSESSMENT REPORT
v
vi
ABOUT THE INSTITUTE
vii
LIST OF FIGURES
viii
LIST OF TABLES
ix
CHAPTER-1
INTRODUCTION
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.
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.
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.
• 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.
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.
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.
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.
To interact with the physical world, the following fundamental functions were used:
• 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.
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.
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.
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.
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.
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.
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.
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.
• Fire Detection: To utilize three flame sensors (left, right, center) to effectively
detect the presence and direction of a fire.
7
CHAPTER-2
• 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.
• 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.
• 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.
9
CHAPTER-3
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.
• Input: The Arduino receives data from the three IR Flame Sensors. This
data indicates the presence and direction of a fire.
• 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.
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.
11
Components on the Arduino UNO Board
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.
• Input devices like sensors, switches, or Bluetooth modules provide data to the
Arduino through digital/analog pins.
• 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.
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.
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
Working Principle
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.
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.
BO MOTORS
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).
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.
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.
20
• 5-9V Water Pump: A simple DC pump that draws water from the onboard tank
and ejects it through the nozzle.
21
• Code Editor: For writing the program logic (the "sketch").
• Library Manager: For including pre-written code for hardware like the Servo
motor (Servo.h).
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.
23
3.4 System Implementation
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.
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.
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).
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.
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.
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.
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
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.
29
The specifications of the key components were finalized as follows, forming a complete
and functional system:
4x BO (Battery
Provide 4-wheel drive (4WD) for the
Motors Operated) DC
robot's chassis.
Motors
5-9V Mini
The primary actuator for
Pump Submersible Water
extinguishing the fire.
Pump
30
4.2 Testing Methodology and 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.
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
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
Specific
Sector Benefit & Use Case
Application
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
5.1 CONCLUSION
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
37
// --- Initialize Motor Pins ---
pinMode(ENA, OUTPUT);
pinMode(IN1, OUTPUT);
pinMode(IN2, OUTPUT);
pinMode(IN3, OUTPUT);
pinMode(IN4, OUTPUT);
pinMode(ENB, OUTPUT);
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();
}
void readSensors() {
left_val = analogRead(LEFT_SENSOR);
center_val = analogRead(CENTER_SENSOR);
right_val = analogRead(RIGHT_SENSOR);
void extinguishFire() {
[Link]("Action: EXTINGUISHING FIRE");
stopMotors(); // Stop moving
39
[Link](60); // Move to 60 degrees
delay(500);
[Link](120); // Move to 120 degrees
delay(500);
[Link](90); // Return to center
}
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
Technology, 2019.
[Link]
42