0% found this document useful (0 votes)
535 views60 pages

Fire Fighting Robot

Uploaded by

kalaivani
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)
535 views60 pages

Fire Fighting Robot

Uploaded by

kalaivani
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
You are on page 1/ 60

Arduino based fire fighting robot

CHAPTER 1

INTRODUCTION
1.1 MOTIVATION
Cultural property management is entrusted with the responsibility of protecting and
preserving an institution's buildings, collections, operations and occupants. Constant
attention is required to minimize adverse impact due to climate, pollution, theft, vandalism,
insects, mold and fire. Because of the speed and totality of the destructive forces of fire, it
constitutes one of the more serious threats. Vandalized or environmentally damaged
structures can be repaired and stolen objects recovered. Items destroyed by fire, however,
are gone forever. An uncontrolled fire can obliterate an entire room's contents within a few
minutes and completely burn out a building in a couple of hours. Hence it has become very
necessary to control and cease the fire to protect the Life and costlier things. For that we
purposed to design and fabricate the fire-fighting robot.
Autonomous robots can act on their own, independent of any controller. The basic
idea is to program the robot to respond in a certain way to outside stimuli. The very simple
bump-and-go robot is a good illustration of how this works.
This sort of robot has a sensor to detect obstacles. When you turn the robot on, it
zips along in a straight line. When it finally hits an obstacle, the impact is on sensors, i.e,
sansors may get damaged. Using Ultrasonic sensor and programming logic, the robot is
guided to turn right and move forward again, when the robot finds an obstacle in its way.
In this way, the robot changes direction any time it encounters an obstacle. Advanced
robots use more elaborate versions of this same idea. Roboticists create new programs and
sensor systems ,to make robots more smarter and more perceptive. Today, robots can
effectively navigate in a variety of environments.

1.2 PROJECT OVERVIEW

The project is designed to develop a fire fighting robot using Arduino uno . The
robotic vehicle is loaded with water pump which is controlled by servos. An ATMega 328
microcontroller is used for the desired operation. At the transmitting end using commands
are sent to the receiver to control the movement of the robot either to move forward, and

Department of ECE, VBIT 1


Arduino based fire fighting robot

left or right etc. At the receiving end tow motors are interfaced to the microcontroller where
two of them are used for the movement of the vehicle and the one to position the robot.
The ultrasonic sensor adequate range with obstacle detection, while the receiver driver
module used to drive DC motors via motor driver IC for necessary work. A water tank
along with water pump is mounted on the robot body and its operation is carried out from
the microcontroller output through appropriate command from the transmitting end. The
whole operation is controlled by an ATmega 328 microcontroller. A motor driver IC is
interfaced to the microcontroller through which the controller drives the motors,three ir
flame sensors are fixed on robot chassis to sense the fire and to reach the destination to
putoff the fire.

1.3 COMPONENTS OVERVIEW

This system uses the following components.

1.3.1 Microcontroller

Microcontroller can be described as a computer embedded on a rather small circuit


board. To describe the function of a microcontroller more precisely it is a single chip that
can perform various calculations and task and send/receive signals from other devices via
the available pins. Precisely what tasks and communication with the world it does, is what
is governed by what instructions we give to the Microcontroller. It is this job of telling the
chip what to do, is what we refer to as programming on it.

However, the microcontroller by itself, cannot accomplish much, it needs several


external inputs, power, for one, a steady clock signal, for another. Also, the job of
programming it has to be accomplished by an external circuit. So typically, a
microcontroller is used along with a circuit which provides these things to it; this
combination is called a microcontroller board. The Arduino Uno that you have received is
one such microcontroller board. The actual microcontroller at its heart is the chip called
Atmega328. The advantages that Arduino offers over other microcontroller boards are
largely in terms of reliability of the circuit hardware as well as the ease of programming
and using it.

Department of ECE, VBIT 2


Arduino based fire fighting robot

1.3.2 Power Supply

7805 is a voltage regulation IC which is used to supply 5V Direct current to the


microcontroller

1.3.3 Motor Driver IC

L293D is a dual H-bridge motor driver integrated circuit (IC). They are use to control they
the 4 motor used in project. There are 2 motor driver IC used in the project one to control
front motor and other for rear motors.

1.3.4 Computer Interface

Finally, this project uses IDE compiler for interfacing the arduino with a PC. This
interface is used to setup and compile the Arduino.

Department of ECE, VBIT 3


Arduino based fire fighting robot

CHAPTER 2

PROBLEM DEFINITION

As explained in the introduction chapter, the realization of complete potential of


the sensors and the wired medium in information transfer is the major issue that the
following thesis of the following project deals with.

Fig 2.1: Overview of system

From Fig 2.1, there are at least five interfacing circuits, L293d driver module,
Arduino-uno with Microcontroller ,flame sensors,ultrasonic sensors,servo motor and 5v
pump.here arduino uno acts a heart of our project,in the above block diagram we can see
that there are three flame sensors and ultrasonic sensor which acts as input interface to the
microcontroller and sevomotor,pump,driver module acts a ouput interface to the
microcontroller,here the input and output interface can be indicated with the arrow lines

Department of ECE, VBIT 4


Arduino based fire fighting robot

with the respective the microcontroller performs with the respective commands and delay
which is programmed on arduino software.

2.1 CIRCUIT DIAGRAM OF THE SYSTEM

Fig 2.2: Circuit diagram of the system.

As you can see these sensors have an IR Receiver (Photodiode) which is used to detect
the fire. How is this possible? When fire burns it emits a small amount of Infra-red light,
this light will be received by the IR receiver on the sensor module. Then we use an Op-
Amp to check for change in voltage across the IR Receiver, so that if a fire is detected
the output pin will give 0V(LOW) and if the is no fire the output pin will be
5V(HIGH).So, we place three such sensors in three directions of the robot to sense on
which direction the fire is burning. We detect the direction of the fire we can use the
motors to move near the fire by driving our motors through the L293D module. When
near a fire we have to put it out using water. Using a small container we can carry water,

Department of ECE, VBIT 5


Arduino based fire fighting robot

a 5V pump is also placed in the container and the whole container is placed on top of
a servo motor so that we can control the direction in which the water has to be sprayed.

Department of ECE, VBIT 6


Arduino based fire fighting robot

CHAPTER 3

SYSTEM REQUIREMENT SPECIFICATION


3.1 HARDWARE REQUIREMENTS

3.1.1 L293D Driver module

The Motor Driver is a module for motors that allows you to control the working
speed and direction of two motors simultaneously .This Motor Driver is designed and
developed based on L293D IC.L293D is a 16 Pin Motor Driver IC. This is designed to
provide bidirectional drive currents at voltages from 5 V to 36 V.

Figure 3.1: L293D motor driver module


L293D is a dual H-bridge motor driver integrated circuit (IC). Motor drivers act as current
amplifiers since they take a low-current control signal and provide a higher-current signal.
This higher current signal is used to drive the motors.L293D contains two inbuilt H-bridge
driver circuits. In its common mode of operation, two DC motors can be driven
simultaneously, both in forward and reverse direction. The motor operations of two motors
can be controlled by input logic at pins 2 & 7 and 10 & 15. Input logic 00 or 11 will stop

Department of ECE, VBIT 7


Arduino based fire fighting robot

the corresponding motor. Logic 01 and 10 will rotate it in clockwise and anticlockwise
directions, respectively.

Enable pins 1 and 9 (corresponding to the two motors) must be high for motors to start
operating. When an enable input is high, the associated driver gets enabled. As a result, the
outputs become active and work in phase with their inputs. Similarly, when the enable
input is low, that driver is disabled, and their outputs are off and in the high-impedance
state.

3.1.1.1 Features of L293D driver module


Hardware features

 can be used to run Two DC motors with the same IC.


 Speed and Direction control is possible
 Motor voltage Vcc2 (Vs): 4.5V to 36V
 Maximum Peak motor current: 1.2A
 Maximum Continuous Motor Current: 600mA
 Supply Voltage to Vcc1(vss): 4.5V to 7V
 Transition time: 300ns (at 5Vand 24V)
 Automatic Thermal shutdown is available
 Available in 16-pin DIP, TSSOP, SOIC packages

Applications

 Used to drive high current Motors using Digital Circuits


 Can be used to drive Stepper motors
 High current LED’s can be driven
 Relay Driver module (Latching Relay is possible)

Department of ECE, VBIT 8


Arduino based fire fighting robot

3.1.1.2 Pin description

The L293D driver module has 16pins. They are as follows:


ENABLE:

When enable is pulled low, the module is disabled which means the module will
not turn on and it fails to drive motors. When enable is left open or connected to 3.3V, the
module is enabled i.e the module remains on and driving of motors also takes place.
VCC:

Supply voltage 3.3v to 5v


GND:

Ground pin.
INPUT & OUTPUT:

These two pins acts as an input and output interface for communication.

Table pin description table

3.1.2 Flame Sensor Module

A flame sensor module that consists of a flame sensor (IR receiver), resistor, capacitor,
potentiometer, and comparator LM393 in an integrated circuit. It can detect infrared light
with a wavelength ranging from 700nm to 1000nm.The far-infrared flame probe converts

Department of ECE, VBIT 9


Arduino based fire fighting robot

the light detected in the form of infrared light into current changes. Sensitivity is adjusted
through the onboard variable resistor with a detection angle of 60 degrees.

Working voltage is between 3.3v and 5.2v DC, with a digital output to indicate the presence
of a signal. Sensing is conditioned by an LM393 comparator .

Figure 3.2: flame sensor module

3.1.2.1 Photo diode

A photodiode is one type of light detector, used to convert the light into current or voltage
based on the mode of operation of the device. It comprises of optical filters, built-in lenses
and also surface areas. These diodes have a slow response time when the surface area of
the photodiode increases. Photodiodes are alike to regular semiconductor diodes, but that
they may be either visible to let light reach the delicate part of the device. Several diodes
intended foruse exactly as a photodiode will also use a PIN junction somewhat than the
usual PN junction.

some photodiodes will look like a light emitting diode. They have two terminals coming
from the end. The smaller end of the diode is the cathode terminal, while the longer end of

Department of ECE, VBIT 10


Arduino based fire fighting robot

the diode is the anode terminal. See the following schematic diagram for the anode and
cathode side. Under forward bias condition, conventional current will flow from the anode
to the cathode, following the arrow in the diode symbol. Photocurrent flows in the reverse
direction.

Fig Photo diode symbol


3.1.2.2 Applications of Photodiode
 The applications of photodiodes involve in similar applications of
photodetectors like charge-coupled devices, photoconductors, and
photomultiplier tubes.
 These diodes are used in consumer electronics devices like smoke detectors,
compact disc players, and televisions and remote controls in VCRs.
 In other consumer devices like clock radios, camera light meters, and street
lights, photoconductors are more frequently used rather than photodiodes.
 Photodiodes are frequently used for exact measurement of the intensity of light
in science & industry. Generally, they have an enhanced, more linear response
than photoconductors.
 Photodiodes are also widely used in numerous medical applications like
instruments to analyze samples, detectors for computed tomography and also
used in blood gas monitors.
 These diodes are much faster & more complex than normal PN junction
diodes and hence are frequently used for lighting regulation and in optical
communications.

Department of ECE, VBIT 11


Arduino based fire fighting robot

3.1.2.3 LM393 Comparator


For sensors, there are normally two ways as output, the analog value or digital value output.

 Analog value: Most sensors only provide the analog value, so it outputs a
voltage value to indicate the sensing parameters. Arduino read this value on A0
to A9, and from 0 till 1023. In AVR, the analog voltage varies from 0V till 5V.
We sign AO (Analog Output) as a pin name on many sensor boards
 Digital Value: Sometimes we only want the sensors only give feedback when
the sensing value read a threshold that we want, so when it reached the feedback
is 1, and 0 vice verse.
Here the LM393 IC do the voltage comparing here, a reference voltage (UR) is set by the
adjustable potentiometer, when the analog output value over this value, the LM393 will
output a digital value to indicate this sensor is triggered by reaching this setup threshold

Fig circuit diagram of LM393 comparator


3.1.3 Ultrasonic Sensor

Department of ECE, VBIT 12


Arduino based fire fighting robot

An Ultrasonic sensor is a device that can measure the distance to an object by using sound
waves. It measures distance by sending out a sound wave at a specific frequency and
listening for that sound wave to bounce back. By recording the elapsed time between the
sound wave being generated and the sound wave bouncing back, it is possible to calculate
the distance between the sonar sensor and the object.

Fig ultrasonic sensor description

It is important to understand that some objects might not be detected by ultrasonic sensors.
This is because some objects are shaped or positioned in such a way that the sound wave
bounces off the object, but are deflected away from the Ultrasonic sensor. It is also possible
for the object to be too small to reflect enough of the sound wave back to the sensor to be
detected. Other objects can absorb the sound wave all together (cloth, carpeting, etc), which
means that there is no way for the sensor to detect them accurately. These are important
factors to consider when designing and programming a robot using an ultrasonic sensor.
The distance can be calculated with the following formula:

Distance L = 1/2 × T × C

Department of ECE, VBIT 13


Arduino based fire fighting robot

Fig ultrasonic sensor

3.1.4 DC Motor:

Motors convert electrical energy into mechanical energy.A DC motor is


an electric motor that runs on direct current (DC) electricity.

Fig dc motor

In any electric motor, operation is based on simple electromagnetism. A current-carrying

Department of ECE, VBIT 14


Arduino based fire fighting robot

conductor generates a magnetic field; when this is then placed in an external magnetic
field, it will experience a force proportional to the current in the conductor, and to the
strength of the external magnetic field. As you are well aware of from playing with
magnets as a kid, opposite (North and South) polarities attract, while like polarities
(North and North, South and South) repel. The internal configuration of a DC motor is
designed to harness the magnetic interaction between a current-carrying conductor and an
external magnetic field to generate rotational motion.

Direct current (DC) motors are widely used to generate motion in a variety of
products. Permanent magnet DC (direct current) motors are enjoying increasing
popularity in applications requiring compact size, high torque, high efficiency, and low
power consumption.

In a brushed DC motor, the brushes make mechanical contact with a set of


electrical contacts provided on a commutator secured to an armature, forming an
electrical circuit between the DC electrical source and coil windings on the armature. As
the armature rotates on an axis, the stationary brushes come into contact with different
sections of the rotating commutator.

Fig internal architecture of dc motor

Permanent magnet DC motors utilize two or more brushes contacting a


commutator which provides the direct current flow to the windings of the rotor, which in
turn provide the desired magnetic repulsion/attraction with the permanent magnets
located around the periphery of the motor.

Department of ECE, VBIT 15


Arduino based fire fighting robot

The brushes are conventionally located in brush boxes and utilize a U-shaped
spring which biases the brush into contact with the commutator. Permanent magnet
brushless dc motors are widely used in a variety of applications due to their simplicity of
design, high efficiency, and low noise. These motors operate by electronic commutation
of stator windings rather than the conventional mechanical commutation accomplished by
the pressing engagement of brushes against a rotating commutator.

A brushless DC motor basically consists of a shaft, a rotor assembly equipped


with one or more permanent magnets arranged on the shaft, and a stator assembly which
incorporates a stator component and phase windings. Rotating magnetic fields are formed
by the currents applied to the coils.

The rotator is formed of at least one permanent magnet surrounded by the stator,
wherein the rotator rotates within the stator. Two bearings are mounted at an axial
distance to each other on the shaft to support the rotor assembly and stator assembly
relative to each other. To achieve electronic commutation, brushless dc motor designs
usually include an electronic controller for controlling the excitation of the stator
windings.

3.1.5 Water Pump

The water pump is operated at 5v which can be interfaced with Arduino

Fig 5v water pump

Department of ECE, VBIT 16


Arduino based fire fighting robot

3.1.6 Servo Motor

A servo is a small DC motor with the following components added: some gear
reduction, a position sensor on the motor shaft, and an electronic circuit that controls the
motor's operation. In other words, a servo is to a DC motor what the Arduino is the
ATmega microcontroller---components and housing that make the motor easy to use.
This will become abundantly clear when we work with unadorned DC motors next week.

The gear reduction provided in a servo is large; the basic hobby servo has a 180:1
gear ratio. This means that the DC motor shaft must make 180 revolutions to produce 1
revolution of the servo shaft. This large gear ratio reduces the speed of the servo and
proportionately increases its torque. What does this imply about small DC motors? Servo
motors are typically used for angular positioning, such as in radio control airplanes. They
have a movement range of 0 up to 180 degrees, but some extend up to 210 degrees.
Typically, a potentiometer measures the position of the output shaft at all times so the
controller can accurately place and maintain its position.

Fig servo motor

PPM uses 1 to 2ms out of a 20ms timeperiod to encode its information. The servo expects
to see a pulse every 20milliseconds (.02 seconds). The length of the pulse will determine
how far the motor turns. A 1.5 millisecond pulse will make the motor turn to the 90 degree
position(often called the neutral position). If the pulse is shorter than 1.5 ms, then the motor

Department of ECE, VBIT 17


Arduino based fire fighting robot

will turn the shaft to closer to 0degrees. If the pulse is longer than 1.5ms,the shaft turns
closer to 180 degrees.The amount of power applied to the motor is proportional to the
distance it needs to travel. So, if the shaft needs to turn a large distance, the motor will run
at full speed. If it needs to turn only a small amount, the motor will run at a slower speed.

Fig rotating mechanism of servo motor

3.2 MICROCONTROLLER ATMEGA 328

Department of ECE, VBIT 18


Arduino based fire fighting robot

Figure 3.3: Arduino UNO board

The Atmel 8-bit AVR RISC-based microcontroller combines 32 KB ISP flash


memory with read-while-write capabilities, 1 KB EEPROM, 2 KB SRAM, 23 general
purpose I/O lines, 32 general purpose working registers, three flexible timer/counters with
compare modes, internal and external interrupts, serial programmable USART, a byte-
oriented 2-wire serial interface, SPI serial port, 6-channel 10-bit A/D converter (8-channels
in TQFP and QFN/MLF packages), programmable watchdog timer with internal oscillator,
and five software selectable power saving modes. The device operates between 1.8-5.5
volts. The device achieves throughputs approaching 1 MIPS.

3.2.1 Applications

Today the ATmega328 is commonly used in many projects and autonomous


systems where a simple, low-powered, low-cost micro-controller is needed. Perhaps the
most common implementation of this chip is on the popular Arduino development
platform, namely the Arduino Uno and Arduino Nano models.

3.2.2 Features

 28-pin AVR Microcontroller

Department of ECE, VBIT 19


Arduino based fire fighting robot

 Flash Program Memory: 32 kbytes


 EEPROM Data Memory: 1 kbytes
 SRAM Data Memory: 2 kbytes
 I/O Pins: 23
 Timers: Two 8-bit / One 16-bit
 A/D Converter: 10-bit Six Channel
 PWM: Six Channels
 RTC: Yes with Separate Oscillator
 MSSP: SPI and I²C Master and Slave Support
 USART: Yes
 External Oscillator: up to 20MHz

The Atmega328 is a very popular microcontroller chip produced by Atmel. It is an


8-bit microcontroller that has 32K of flash memory, 1K of EEPROM, and 2K of internal
SRAM.

The Atmega328 is one of the microcontroller chips that are used with the popular
Arduino Duemilanove boards. The Arduino Duemilanove board comes with either 1 of 2
microcontroller chips, the Atmega168 or the Atmega328. Of these 2, the Atmega328 is the
upgraded, more advanced chip. Unlike the Atmega168 which has 16K of flash program
memory and 512 bytes of internal SRAM, the Atmega328 has 32K of flash program
memory and 2K of Internal SRAM.

The Atmega328 has 28 pins, It has 14 digital I/O pins, of which 6 can be used as
PWM outputs and 6 analog input pins. These I/O pins account for 20 of the pins.

Department of ECE, VBIT 20


Arduino based fire fighting robot

3.3 PIN DIAGRAM OF ATMEGA328

Figure 3.4: Pin diagram of Atmega328

Department of ECE, VBIT 21


Arduino based fire fighting robot

Table 3.3: Description of each pins of ATmega328

As stated before, 20 of the pins function as I/O ports. This means they can function
as an input to the circuit or as output. Whether they are input or output is set in the software.
14 of the pins are digital pins, of which 6 can function to give PWM output. 6 of the pins
are for analog input/output. Two of the pins are for the crystal oscillator, this is to provide
a clock pulse for the Atmega chip. A clock pulse is needed for synchronization so that

Department of ECE, VBIT 22


Arduino based fire fighting robot

communication can occur in synchrony between the Atmega chip and a device that it is
connected to.

The Atmega328 chip has an analog-to-digital converter (ADC) inside of it. This
must be or else the Atmega328 wouldn't be capable of interpreting analog signals. Because
there is an ADC, the chip can interpret analog input, which is why the chip has 6 pins for
analog input. The ADC has 3 pins set aside for it to function- AVCC, AREF, and GND.
AVCC is the power supply, positive voltage, that for the ADC. The ADC needs its own
power supply in order to work. GND is the power supply ground. AREF is the reference
voltage that the ADC uses to convert an analog signal to its corresponding digital value.
Analog voltages higher than the reference voltage will be assigned to a digital value of 1,
while analog voltages below the reference voltage will be assigned the digital value of 0.
Since the ADC for the Atmega328 is a 10-bit ADC, meaning it produces a 10-bit digital
value, it converts an analog signal to its digital value, with the AREF value being a
reference for which digital values are high or low. Thus, a portrait of an analog signal is
shown by this digital value; thus, it is its digital correspondent value. The last pin is the
RESET pin. This allows a program to be rerun and start over. And this sums up the pin out
of an Atmega328 chip.

3.4 ARCHITECTURE

Figure 3.5: Architecture of AVR

Department of ECE, VBIT 23


Arduino based fire fighting robot

3.5 FEATURES OF AVR.

• High-performance, Low-power AVR® 8-bit Microcontroller


• Advanced RISC Architecture
– 131 Powerful Instructions – Most Single-clock Cycle Execution
– 32 x 8 General Purpose Working Registers
– Fully Static Operation
– Up to 16 MIPS Throughput at 16 MHz
– On-chip 2-cycle Multiplier
• Nonvolatile Program and Data Memories
– 32K Bytes of In-System Self-Programmable Flash
• Endurance: 10,000 Write/Erase Cycles
– Optional Boot Code Section with Independent Lock Bits
• In-System Programming by On-chip Boot Program
• True Read-While-Write Operation
– 1024 Bytes EEPROM
• Endurance: 100,000 Write/Erase Cycles
– 2K Byte Internal SRAM
– Programming Lock for Software Security
• JTAG (IEEE std. 1149.1 Compliant) Interface
– Boundary-scan Capabilities According to the JTAG Standard
– Extensive On-chip Debug Support
– Programming of Flash, EEPROM, Fuses, and Lock Bits through the JTAG Interface
• Peripheral Features
– Two 8-bit Timer/Counters with Separate Pre scalers and Compare Modes
– One 16-bit Timer/Counter with Separate Pre scaler, Compare Mode, and Capture
Mode
– Real Time Counter with Separate Oscillator
– Four PWM Channels
– 8-channel, 10-bit ADC
• 8 Single-ended Channels
• 7 Differential Channels in TQFP Package Only

Department of ECE, VBIT 24


Arduino based fire fighting robot

• 2 Differential Channels with Programmable Gain at 1x, 10x, or 200x


– Byte-oriented Two-wire Serial Interface
– Programmable Serial USART
– Master/Slave SPI Serial Interface
– Programmable Watchdog Timer with Separate On-chip Oscillator
– On-chip Analog Comparator
• Special Microcontroller Features
– Power-on Reset and Programmable Brown-out Detection
– Internal Calibrated RC Oscillator
– External and Internal Interrupt Sources
– Six Sleep Modes: Idle, ADC Noise Reduction, Power-save, Power-down, Standby
and Extended Standby
• I/O and Packages
– 32 Programmable I/O Lines
– 40-pin PDIP, 44-lead TQFP, and 44-pad QFN/MLF
• Operating Voltages
– 2.7 - 5.5V for ATmega32L
– 4.5 - 5.5V for ATmega32
• Speed Grades
– 0 - 8 MHz for ATmega32L
– 0 - 16 MHz for ATmega32
• Power Consumption at 1 MHz, 3V, 25°C for ATmega32L
– Active: 1.1 mA
– Idle Mode: 0.35 mA
– Power-down Mode: < 1 μA

Department of ECE, VBIT 25


Arduino based fire fighting robot

3.6 DIFFERENT FLAVOURS OF ARDUINO WITH THEIR


CONFIGURATION

Table 3.4: Different Flavors of ARDUINO with their Configuration

Department of ECE, VBIT 26


Arduino based fire fighting robot

3.7 BASIC TERMINOLOGIES IN ARDUINO

3.7.1 Analog to Digital Converter (ADC)

 The process of Analog to digital conversion is shown in figure.


 The Arduino has 10 bits of Resolution when reading analog signals.
 210=1024 increments.
 Influence also by how fast you sample.

3.7.2 Pulse Width Modulation (PWM)

 The Arduino has 8bit of resolution, when outputting a signal using PWM.
 The range of output voltage is from 0 to 5 Volts.
 28=255 Increments
 Average of on/off(digital signals to make an average voltage),Duty cycle in 100%
of 5Volts.

3. 8 LANGUAGE REFERENCES:

The Microcontroller on the board is programmed using the Arduino programming


language (based on wiring) and the arduino development environment (based on
processing).

3.8.1 Arduino programming language (APL) (based on wiring)

The Arduino programming language is an implementation of wiring, a similar


physical computing platform, which is based on the Processing multimedia programming
environment.

3.8.2 Wiring

Wiring is an open-source programming framework for microcontrollers. Wiring


allows writing cross-platform software to control devices attached to a wide range of

Department of ECE, VBIT 27


Arduino based fire fighting robot

microcontroller boards to create all kinds of creative coding, interactive objects, spaces or
physical experiences. The framework is thoughtfully created with designers and artists in
mind to encourage a community where beginners through experts from around the world
share ideas, knowledge and their collective experience. There are thousands of students,
artists, designers, researchers, and hobbyists who use Wiring for learning, prototyping, and
finished professional work production.

3.9 ARDUINO DEVELOPMENT ENVRONMENT

3.9.1 Processing

Processing is an open source programming language and environment for people


who want to create images, animations, and interactions. Initially developed to serve as a
software sketchbook and to teach fundamentals of computer programming within a visual
context, Processing also has evolved into a tool for generating finished professional work.
Today, there are tens of thousands of students, artists, designers, researchers, and hobbyists
who use Processing for learning, prototyping, and production.

3.10 SOFTWARE REQUIREMENTS

3.10.1 Embedded C

Embedded C is a set of language extensions for the C Programming language by


the C Standards committee to address commonality issues that exist between C extensions
for different embedded systems. Historically, embedded C programming requires
nonstandard extensions to the C language in order to support exotic features such as fixed-
point arithmetic, multiple distinct memory banks, and basic I/O operations.

3.10.2 Difference between C and Embedded C

Though C and embedded C appear different and are used in different contexts, they
have more similarities than the differences. Most of the constructs are same; the difference
lies in their applications.

Department of ECE, VBIT 28


Arduino based fire fighting robot

C is used for desktop computers, while embedded C is for microcontroller based


applications. C takes more resources of a desktop PC like memory, OS, etc. while
programming on desktop systems what embedded C cannot. Embedded C has to use the
limited resources (RAM, ROM, I/O’s) on an embedded processor. Thus, program code
must fit into the available program memory. If code exceeds the limit, the system is likely
to crash.

Compilers for C (ANSI C) typically generate OS dependent executable files.


Embedded C requires compilers to create files to be downloaded to the
microcontrollers/microprocessors where it needs to run. Embedded compilers give access
to all resources which is not provided in compilers for desktop computer applications.

Embedded systems often have the real-time constraints, which is usually not there
with desktop computer applications.

Embedded systems often do not have a console, which is available in case of


desktop applications.

The C programming language is perhaps the most popular programming language


for programming embedded systems. C continues to be a very popular language for micro-
controller developers/programmers due to the code efficiency and reduced overhead and
development time. C offers low-level control and is considered more readable than
assembly language which is a little difficult to understand. Assembly language requires
more code writing, whereas C is easy to understand and requires less coding. Plus, using
C increases portability, since C code can be compiled for different types of processors. We
can program microcontrollers using Atmel Atmega328, AVR or PIC.

Here by developing the programs as per the electronic hardware using Atmel
Atmega328 micro controller. For the operations like: blink led, increment decrement
counters, token displays etc.

Most C programmers are spoiled because they program in environments where not
only there is a standard library implementation, but there are frequently a number of other

Department of ECE, VBIT 29


Arduino based fire fighting robot

libraries available for use. The cold fact is, that in embedded systems, there rarely are many
of the libraries that programmers have grown used to, but occasionally an embedded
system might not have a complete standard library, if there is a standard library at all. Few
embedded systems have capability for dynamic linking, so if standard library functions are
to be available at all, they often need to be directly linked into the executable. Oftentimes,
because of space concerns, it is not possible to link in an entire library file, and
programmers are often forced to "brew their own" standard c library implementations if
they want to use them at all. While some libraries are bulky and not well suited for use on
microcontrollers, many development systems still include the standard libraries which are
the most common for C programmers.

C remains a very popular language for micro-controller developers due to the code
efficiency and reduced overhead and development time. C offers low-level control and is
considered more readable than assembly. Many free C compilers are available for a wide
variety of development platforms. The compilers are part of an IDEs with ICD support,
breakpoints, single-stepping and an assembly window. The performance of C compilers
has improved considerably in recent years, and they are claimed to be more or less as good
as assembly, depending on who you ask. Most tools now offer options for customizing the
compiler optimization. Additionally, using C increases portability, since C code can be
compiled for different types of processors.

3.10.3 Software

The software used by the arduino is Arduino IDE. The Arduino IDE is a cross-
platform application written in Java, and is derived from the IDE for the Processing
programming language and the Wiring project. It is designed to introduce programming
to artists and other newcomers unfamiliar with software development. It includes a code
editor with features such as syntax highlighting, brace matching, and automatic
indentation, and is also capable of compiling and uploading programs to the board with a
single click. There is typically no need to edit make files or run programs on a command-
line interface. Although building on command-line is possible if required with some
third-party tools such as Ino.

Department of ECE, VBIT 30


Arduino based fire fighting robot

The Arduino IDE comes with a C/C++ library called "Wiring" (from the project of
the same name), which makes many common input/output operations much easier. Arduino
programs are written in C/C++, although users only need define two functions to make a
runnable program:

 setup() – a function run once at the start of a program that can initialize settings
 loop() – a function called repeatedly until the board powers off

A typical first program for a microcontroller simply blinks a LED on and off. In
the Arduino environment, the user might write a program like this:
#define LED_PIN 13
void setup (){
pinMode(LED_PIN, OUTPUT);// enable pin 13 for digital output
}
void loop (){
digitalWrite(LED_PIN, HIGH);// turn on the LED
delay(1000);// wait one second (1000 milliseconds)

Department of ECE, VBIT 31


Arduino based fire fighting robot

Figure 3.6: A Screenshot of Arduino IDE

For the above code to work correctly, the positive side of the LED must be
connected to pin 13 and the negative side of the LED must be connected to ground. The
above code would not be seen by a standard C++ compiler as a valid program, so when the
user clicks the "Upload to I/O board" button in the IDE, a copy of the code is written to a
temporary file with an extra include header at the top and a very simple main() function at
the bottom, to make it a valid C++ program.

The Arduino IDE uses the GNU tool chain and AVR Libc to compile programs,
and uses AVR dude to upload programs to the board.

Department of ECE, VBIT 32


Arduino based fire fighting robot

For educational purposes there is third party graphical development environment


called Mini blog available under a different open source license.

PROGRAM COMPILING

Figure 3.7: Program compiling using arduino IDE.

Department of ECE, VBIT 33


Arduino based fire fighting robot

SELECTING BOARD

Figure 3.8: Selecting the board from Tools menu

SELECTING PORT

Figure 3.9: Selecting the port

Department of ECE, VBIT 34


Arduino based fire fighting robot

UPLOADING PROGRAM

Figure 3.10: Uploading program to the arduino.

3.10.4 Language Reference

Arduino programs can be divided in three main parts: structure, values (variables
and constants), and functions.

Available data types in ARDUINO IDE are

 void

 boolean

 char ( 0 – 255)

 byte - 8 bit data ( 0 – 255)

 int - 16-bit data (32,767 - -32,768)

Department of ECE, VBIT 35


Arduino based fire fighting robot

 long – 32 bit data (2,147,483,647 to -2,147,483,648)

 float

 double

 string - char array

 String - object

 array

3.11 AT COMMANDS

AT commands are used to control MODEMs. AT is the abbreviation for Attention.


These commands come from Hayes commands that were used by the Hayes smart
modems. The Hayes commands started with AT to indicate the attention from the
MODEM. The dial up and wireless MODEMs (devices that involve machine to machine
communication) need AT commands to interact with a computer. These include the Hayes
command set as a subset, along with other extended AT commands.

AT commands with a mobile phone can be used to access following information


and services:

1. Information and configuration pertaining to mobile device or Bluetooth module.


2. SMS services.
3. MMS services.
4. Fax services.
5. Data and Voice link over mobile network.

The Hayes subset commands are called the basic commands and the commands
specific to a Bluetooth network are called extended AT commands.

Department of ECE, VBIT 36


Arduino based fire fighting robot

3.12 TYPES OF AT COMMANDS:

There are four types of AT commands:

Fig 3.11: AT commands classification

3.12.1 Explanation of commonly used AT commands

1) AT - This command is used to check communication between the module and the
computer.
For example, AT OK

The command returns a result code OK if the computer (serial port) and module are
connected properly. If any of module or SIM is not working, it would return a result code
ERROR.

2) +CMGF - This command are used to set the SMS mode. Either text or PDU mode can
be selected by assigning 1 or 0 in the command.
SYNTAX: AT+CMGF=<mode>
0: for PDU mode

Department of ECE, VBIT 37


Arduino based fire fighting robot

1: for text mode

The text mode of SMS is easier to operate but it allows limited features of SMS.
The PDU (protocol data unit) allows more access to SMS services but the operator
requires bit level knowledge of TPDUs. The headers and body of SMS are accessed in hex
format in PDU mode so it allows availing more features.
For example,
AT+CMGF=1
OK

3) +CMGW - This command is used to store message in the SIM.

SYNTAX: AT+CMGW=” Phone number”>Message to be stored Ctrl+z

As one types AT+CMGW and phone number, „>‟ sign appears on next line where
one can type the message. Multiple line messages can be typed in this case. This is why
the message is terminated by providing a „Ctrl+z‟ combination. As Ctrl+z is pressed, the
following information response is displayed on the screen.+CMGW: Number on which
message has been stored

4) +CMGS - This command is used to send a SMS message to a phone number.

SYNTAX: AT+CMGS= serial number of message to be send.

As the command AT+CMGS and serial number of message are entered, SMS is
sent to the particular SIM.
For example,
AT+CMGS=1
OK

5) ATD - This command is used to dial or call a number.

Department of ECE, VBIT 38


Arduino based fire fighting robot

SYNTAX: ATD<Phone number> (Enter)


For example,
ATD123456789

6) ATA - This command is used to answer a call. An incoming call is indicated by a


message „RING‟ which is repeated for every ring of the call. When the call ends „NO
CARRIER‟ is displayed on the screen.

SYNTAX: ATA (Enter)


As ATA followed by enter key is pressed, incoming call is answered. For example,
RING
RING
ATA

7) ATH - This command is used to disconnect remote user link with the GSM module.

SYNTAX: ATH (Enter)

3.13 LIST OF AT COMMANDS

The AT commands for both, bluetooth module and the mobile phone, are listed
below. Some of these commands may not be supported by all the bluetooth modules
available. Also there might be some commands which won’t be supported by some mobile
handsets.

TABLE 3.5: AT Commands

Command Description
AT Checking communication between
the module and computer.

Department of ECE, VBIT 39


Arduino based fire fighting robot

CALL CONTROL
Command Description
ATA Answer command
ATD Dial command
ATH Hang up call
ATL Monitor speaker mode
ATM Monitor speaker mode
ATO Go on-line
ATP Set pulse dial as default
ATT Set tone dial as default
AT+CSTA Select type of address
AT+CRC Cellular result codes

DATA CARD CONTROL


Command Description
ATI Identification
ATS Select an S-register
ATZ Recall stored profile
AT&F Restore factory settings
AT&V View active configuration
AT&W Store parameters in given profile
AT&Y Select set as power up option
AT +CLCK Facility lock command

Department of ECE, VBIT 40


Arduino based fire fighting robot

AT +COLP Connected line identification


presentation
AT +GCAP Request complete capabilities list
AT+GMI Request manufacturer
identification
AT+GMM Request model identification
AT+GMR Request revision identification
AT+GSN Request product serial number
identification (IMEI)

PHONE CONTROL
Command Description
AT+CBC Battery Charge
AT+CGMI Request manufacturer
identification
AT+CGMM Request model identification
AT+CGMR Request revision identification
AT+CGSN Request product serial number
identification
AT+CMEE Report mobile equipment error
AT+CPAS Phone activity status
AT+CPBF Find phone book entries
AT+CPBR Read phone book entries
AT+CPBS Select phone book memory storage
AT+CPBW Write phone book entry
AT+CSCS Select TE character set

Department of ECE, VBIT 41


Arduino based fire fighting robot

AT+CSQ Signal quality

COMPUTER DATA INTERFACE

Command Description
ATE Command Echo
ATQ Result code suppression
ATV Define response format
ATX Response range selection
AT&C Define DCD usage
AT&D Define DTR usage
AT&K Select flow control
AT&Q Define communications mode
option
AT&S Define DSR option
AT+ICF DTE-DCE character framing
AT+IFC DTE-DCE Local flow control
AT+IPR Fixed DTE rate

SERVICE
Command Description
AT+CLIP Calling line identification
presentation
AT+CR Service reporting control
ATV+DR Data compression reporting

Department of ECE, VBIT 42


Arduino based fire fighting robot

NETWORK COMMUNICATION PARAMETER

Command Description
ATB Communications standard option
AT+CBST Select bearer service type
AT+CEER Extended error report
AT+CRLP Radio link protocol
AT+DS Data compression

MISCEELANEOUS
Command Description
AT/ Re-execute command line
AT? Command help
AT*C Start SMS interpreter
AT*T Enter
AT*V Activate V.25bis mode
AT*NOKIA TEST Test command
AT+CESP Enter SMS block mode protocol

SMS TEXT MODE:


Command Description
AT+CSMS Select message service
AT+CPMS Preferred message storage
AT+CMGF Message format
AT+CSCA Service center address

Department of ECE, VBIT 43


Arduino based fire fighting robot

AT+CSMP Set text mode parameters


AT+CSDH Show text mode parameters
AT+CSCB Select cell broadcast message types
AT+CSAS Save settings
AT+CRES Restore settings
AT+CNMI New message indications to TE
AT+CMGL List messages
AT+CMGR Read message
AT+CMGS Send message
AT+CMSS Send message from storage
AT+CMGW Write message to memory
AT+CMGD Delete message

SMS PDU MODE


Command Description
AT+CMGL List messages
AT+CMGR Read message
AT+CMGS Send message
AT+CMGW Write message to memory

Department of ECE, VBIT 44


Arduino based fire fighting robot

CHAPTER 4

SYSTEM MODELLING AND DESIGN

4.1 FUNCTIONAL DESCRIPTION

Fig 4.1: Functional description diagram

The constituent parts involved in the process are

 sensors
 Arduino with Atmel Atmega328 microcontroller
 L293 driver module
 Servo with pump

First block portrays to be sensors which receives, verifies and forwards the message
to the Microcontroller. Micro is the second block. Micro processes the message and sends
to the driver module. Driver module behaving as the third constituent part and servo pump
acts as fourth part which extinguishes the fire

Department of ECE, VBIT 45


Arduino based fire fighting robot

4.2 DATA FLOW DIAGRAM

Fig 4.4: Flow chart


The flow starts by initializing the ports of components. First the power supply
should be on to the circuit and three sensors are there one on middle and remaing two on
right and left side of chassis whenever the fire is occurred the respective value is read by
the sensors when fire is occurred the voltage becomes zero and chassis is moved to the
respective and put off fire whenever there is no fire then there is no input is occurred
occurred voltage is more than 0 volts and the initial condition is move to other direction

Department of ECE, VBIT 46


Arduino based fire fighting robot

CHAPTER 5: IMPLEMENTATION AND TESTING

5.1 MICROCONTROLLER – FLAME SENSOR INTERFACING

Fig 5.1: Microcontroller –flame sensor interfacing

Fig 5.1 The flame sensor is used to detect the fire or other light sources which are in the
range of wavelength from 760nm to 1100nm. The module consists of an IR sensor,
potentiometer, OP-Amp circuitry and a led indicator. When a flame will be detected, the
module will turn on its red led. This module is sensitive to flame but it can also detect
ordinary light. The detection point is 60 degrees. The sensitivity of this sensor is adjustable
and it also has a stable performance.
It has both outputs, analog and digital. The analog output gives us a real time voltage
output signal on thermal resistance while the digital output allows us to set a threshold via
a potentiometer. In our tutorial we are going to use both of these outputs one by one and
see how the sensor works.We can use the flame sensor to make an alarm when detecting
the fire, for safety purpose in many projects and in many more ways.

Department of ECE, VBIT 47


Arduino based fire fighting robot

5.2 MICROCONTROLLER – ULTRASONIC SENSOR INTERFACING

The HC-SR04 Ultrasonic Module has 4 pins, Ground, VCC, Trig and Echo. The Ground
and the VCC pins of the module needs to be connected to the Ground and the 5 volts pins
on the Arduino Board respectively and the trig and echo pins to any Digital I/O pin on the
Arduino Board.In order to generate the ultrasound you need to set the Trig on a High State
for 10 µs. That will send out an 8 cycle sonic burst which will travel at the speed sound
and it will be received in the Echo pin. The Echo pin will output the time in microseconds
the sound wave traveled.

Fig Arduino ultrasonic interfacing

For example, if the object is 10 cm away from the sensor, and the speed of the
sound is 340 m/s or 0.034 cm/µs the sound wave will need to travel about 294 u seconds.
But what you will get from the Echo pin will be double that number because the sound
wave needs to travel forward and bounce backward. So in order to get the distance in cm
we need to multiply the received travel time value from the echo pin by 0.034 and divide
it by 2.

Department of ECE, VBIT 48


Arduino based fire fighting robot

Fig ultrasonic measurement

5.3 PROGRAMMING OVERVIEW

About Arduino Uno R3 Programming To programing Arduino Uno, you need the open
source Arduino IDE software that the card manufacturer company wrote. The Arduino
IDE Program is a software program written in Java language, used to program Arduino
cards and to download Arduino cards to Arduino cards.download the program that I
downloaded from the firm's site (https://www.arduino.cc/) with this program. It has an
editor that uses the Processing / Wiring language, the commands that resemble the C
language in some places, and the supporting utilities for the projects (Library - library).
Along with this, another company's editor (IDE) has been developed since Arduino
includes open source software. A bootloader (boot loader) has already been installed on
ATmega328 on Arduino Uno. With this bootloader we can develop software without the
need for an external programmer to program Arduino. The programming work can easily
be performed by making the necessary settings and definitions in the IDE program

5.4 INITIALIZATION AND WORKING OF MODULE:

Department of ECE, VBIT 49


Arduino based fire fighting robot

The initial stage of the project is the part of Finding fire, fire sensor LM393 The fire sensor
detects fire at a certain distance. It does not receive data from areas outside of the determined
area. It was decided to use two Reducing motors in order to realize the motion system. Both
of these Reducing engines can move forward and backward. According to the obstacle state,
if the motor is to be turned, one of the motors is given a reverse current by the processor and
the axial rotation is provided and the obstacle less driving is provided. Thus, every obstacle
was easily overcome in the environment where the system is located.

5.5 RESULTS

Snapshots

1. Welcome Note

Department of ECE, VBIT 50


Arduino based fire fighting robot

Figure 6.1a: Snapshot of the System

2. Displays the Received Message.

Department of ECE, VBIT 51


Arduino based fire fighting robot

Figure 6.1b: Snapshot of the System

Department of ECE, VBIT 52


Arduino based fire fighting robot

Figure 6.1c: Snapshots of the System

Department of ECE, VBIT 53


Arduino based fire fighting robot

CHAPTER 6: ADVANTAGES AND APPLICATIONS

7.1 ADVANTAGES

 Prevention from dangerous incidents.


 Minimization of o ecological consequences
 financial loss can be prevented.
 a threat to a human life can be minimized.
 No supervision is required to control robot

7.2 DISADVANTAGES

It is applicable only for shorter distances

Doesn’t predict nor interfere with operator’s thoughts.

Cannot force directly the operator to work.


7.3 APPLICATIONS

 Can be used in extinguishing fire where probability of explosion is high. For eg.
Hotel kitchens, LPG/CNG gas stores, etc.
 Can be used in Server rooms for immediate action in case of fire
 Can be used in extinguishing fire where probability of explosion is high. For eg.
Hotel kitchens, LPG/CNG gas stores, etc.
 Every working environment requiring permanent operator's attention, At power
plant control rooms
 Can be used in serach and rescue operation
 Can Used in domestic cold storage places

Department of ECE, VBIT 54


Arduino based fire fighting robot

CONCLUSION

The prototype of the fire fighter robot was efficiently designed. This prototype has
facilities to be integrated with many sensors making it move forward. The toolkit detects
the infrared light emitted by the fire with photo diode and sends signal to controller. We
intend to extend this work to provide a keypad programmed to allow manipulation of robot
to move desired direction with help of motor driver module and extinguish the flames using
water tank which is rotated at 180 degress with help of servo in order for faster result. This
future work will also explore to the use of a long distance sensor with suitable hardware to
get more better and faster results addition to the characters.

Department of ECE, VBIT 55


Arduino based fire fighting robot

FUTURE SCOPE
The project has been motivated by the desire to design a system that can detect
fires and take appropriate action, without any human intervention. The development of
sensor networks and the maturity of robotics suggests that we can use mobile agents for
tasks that involve perception of an external stimulus and reacting to the stimulus, even
when the reaction involves a significant amount of mechanical actions. This provides us
the opportunity to pass on to robots tasks that traditionally humans had to do but were
inherently life- threatening. Fire-fighting is an obvious candidate for such automation.
Given the number of lives lost regularly in fire- fighting, the system we envision is crying
for adoption. Our experience suggests that designing a fire-fighting system with sensors
and robots is within the reach of the current sensor network and mobile agent technologies.
Furthermore, we believe that the techniques developed in this work will carry over to other
areas involving sensing and reacting to stimulus, where we desire to replace the human
with an automated mobile agent.
However, there has been research on many of these pieces in different contexts,
e.g. coordination among mobile agents, techniques for detecting and avoiding obsta cles,
on-thefly communication between humans and mobile agents, etc. It will be both
interesting and challenging to put all this together into a practical, autonomous fire-fighting
service.

Department of ECE, VBIT 56


Arduino based fire fighting robot

REFERENCES

1. P. D. Minns, C Programming For the PC the MAC and the Arduino Microcontroller
System. Author House, 2013

2. M. Banzi, Getting started with arduino. " O'Reilly Media, Inc.", 2009

3. A. M. Gibb, New media art, design, and the Arduino microcontroller: A malleable tool.
PhD thesis, Pratt Institute, 2010

4. M. Margolis, Arduino cookbook. " O'Reilly Media, Inc.", 2011

5. D. Mellis, M. Banzi, D. Cuartielles, and T. Igoe, "Arduino: An open electronic


prototyping platform, " in Proc. CHI, vol. 2007, 2007

6. C. K. Joo, Y. C. Kim, M. H. Choi, and Y. J. Ryoo, Self localization for intelligent mobile
robot using multiple infrared range scanning system, In Control, Automation and
Systems ICCAS'07, Seoul, Korea, 2007, 606-609.

7. http://electronicsforu.com/electronics-projects/hardware-diy/arduino-ir-firefighter robot

8. http://maker.robotistan.com/arduino-dersleri

9. J. Xu, W. Coombe, N. Boyson, A. Ohira, X. Gu, 143.472 Industrial Systems Design and
Integration Fire Fighting Robot, 2006

Department of ECE, VBIT 57


Arduino based fire fighting robot

APPENDIX - A

const int pingTrigPin = 12;


const int pingEchoPin = 13;
#include <Servo.h>
Servo myservo;
int pos = 0;

void setup() {
pinMode(1, INPUT);
pinMode(2, INPUT);
pinMode(3, INPUT);

pinMode(6, OUTPUT);
pinMode(7, OUTPUT);
pinMode(8, OUTPUT);
pinMode(9, OUTPUT);
pinMode(10, OUTPUT);

myservo.attach(11);
myservo.write(90);

void put_off_fire()
{
digitalWrite(10,HIGH);
delay(500);

for (pos = 1; pos <= 90; pos += 1) {


myservo.write(pos);
delay(10);
}
for (pos = 90; pos >= 2; pos -= 1) {
myservo.write(pos);
delay(10);
}

digitalWrite(10,LOW);
myservo.write(90);

}
long microsecondsToCentimeters(long microseconds)
{
return microseconds / 29 / 2;

Department of ECE, VBIT 58


Arduino based fire fighting robot

}
void loop()
{

long duration, cm;


pinMode(pingTrigPin, OUTPUT);
digitalWrite(pingTrigPin, LOW);
delayMicroseconds(2);
digitalWrite(pingTrigPin, HIGH);
delayMicroseconds(5);
digitalWrite(pingTrigPin, LOW);
pinMode(pingEchoPin, INPUT);
duration = pulseIn(pingEchoPin, HIGH);
cm = microsecondsToCentimeters(duration);
// int d= map(cm, 1, 100, 20, 2000);

if((cm>=20)&(cm<50))
{
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
delay(500);
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, HIGH);
digitalWrite(9, LOW);
}

if(digitalRead(1) ==1)
{

digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
put_off_fire();
}

if(digitalRead(2) ==1) //RIGHT


{
digitalWrite(6, LOW);
digitalWrite(7, HIGH);
digitalWrite(8, HIGH);

Department of ECE, VBIT 59


Arduino based fire fighting robot

digitalWrite(9, LOW);
delay(500);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}

if(digitalRead(3) ==1) //LEFT


{
digitalWrite(6, HIGH);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, HIGH);
delay(500);
digitalWrite(6, LOW);
digitalWrite(7, LOW);
digitalWrite(8, LOW);
digitalWrite(9, LOW);
}
}

Department of ECE, VBIT 60

You might also like