You are on page 1of 52

FIRE EXTINGUISHING ROBOT

MINI PROJECT REPORT

Submitted in partial fullfillment of the requirements for the award of the


Bachelor of Technology Degree in Electrical and Electronics Engineering
of the Cochin University of Science and Technology

Submitted By
ARUN THANKAPPAN
MOHAMMED FAIZ M
MUHAMMED SUFIYAN K
NISHAD A
(6th Semester, B.Tech.)

DEPT. OF ELECTRICAL & ELECTRONICS ENGINEERING


COLLEGE OF ENGINEERING
KIDANGOOR
2016

DEPT. OF ELECTRICAL & ELECTRONICS ENGINEERING


COLLEGE OF ENGINEERING
KIDANGOOR
2016

CERTIFICATE
This is to certify that this mini project report entitled FIRE EXTINGUISHING
ROBOT is a bonafide record of the mini project work done by ARUN THANKAPPAN, MOHAMMED FAIZ M, MUHAMMED SUFIYAN K, NISHAD A under
our guidance towards the partial fulfillment of the requirements for the award of B.tech
degree in Electrical and Electronics Engineering of the Cochin University of Science and
Technology during the year 2015 - 2016.

Guided By

Project Coordinator

Mrs.JASMI M S

Mr. ANITH KRISHNAN

Assistant Professor

Assistant Professor

Dept. of Electrical & Electronics

Dept. of Electrical & Electronics

College of Engineering Kidangoor

College of Engineering Kidangoor

Project Coordinator

Head of the Department

Mrs.SONIMA M S
Assistant Professor

Mrs.BINIMOL V.K
Assistant Professor

Dept. of Electrical & Electronics

Dept. of Electrical & Electronics

College of Engineering Kidangoor

College of Engineering Kidangoor

ACKNOWLEDGEMENT

We express our sincere and wholehearted appreciation towards our guide Asst.Prof. Mrs.
Jasmi M S for her advice and guidance. We are using this occasion to thank our project
coordinators Asst.Prof. Mr. Anith Krishnan and Asst.Prof. Mrs. Sonima M S for their
advice and co-operation in the project works. We also would like to thank the Principal
Dr. Viswanadhan and HOD

Mrs. Binimol V K for providing us the facilities required

for our project. Finally we thank all our friends and family for providing us strength and
endurance.
ARUN THANKAPPAN
MOHAMMED FAIZ M
MUHAMMED SUFIYAN K
NISHAD A

Abstract
The aim here is to build a robot that can detect and extinguish fire in a flat surface.
This fire extinguishing rolling robot is a prototype of the actual one. Sensors used here
are simple infrared (IR) photodiodes that detect IR rays coming out of the fire. The robot
moves with the help of two motors, whose sense of rotation is controlled by the controller,
depending on the feedback from the sensor. The basic function of the algorithm is to orient
the front sensor in front of the fire so that the nozzle of the pump comes directly above
the fire source. When this is achieved, the dc water pump is used to extinguish the fire
by spraying water from the bottle, which stores water. The robot can be made to work
in manual as well as in autonomous mode. The robot is controlled by the operator with
the help of a wireless remote that uses an RF module for communicating with the robot.
Switches, push buttons and joysticks are provided on the remote that controls various tasks
such as autonomous mode selection, reset and starting the pump.

Contents
1 Introduction

Block Diagrams
2.1

Receiver Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.2

Transmitter Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

3 WORKING

3.1

Stage 1: Fire detection (autonomous mode): . . . . . . . . . . . . . . . . .

3.2

Stage 2: Extinguishing fire . . . . . . . . . . . . . . . . . . . . . . . . . . .

3.3

Stage 3: RF communication and manual control (manual mode). . . . . . .

4 MAIN COMPONENTS

4.1

Atmega16 microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.2

ATmega8 microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

4.3

L293D motor driver . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

12

4.4

433Mhz RF Module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13

4.5

12V DC geared motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

14

4.6

12V water pump motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

5 CIRCUIT DIAGRAM
5.1

Sensor Module

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

Receiver Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

5.1.1
5.2

17

CONTENTS

5.2.1
5.3

5.4

ii

Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

Transmitter Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

5.3.1

Design . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

22

6 ALGORITHM AND PROGRAM


6.1

6.2

23

Transmitter Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

6.1.1

Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

23

6.1.2

Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

24

Receiver Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

6.2.1

Algorithm . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

28

6.2.2

Program . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

29

7 APPLICATIONS

40

8 CONCLUSIONS AND FUTURE SCOPE

41

9 BILL OF MATERIALS

42

A DATA SHEETS

45

A.1 ATmega 16 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45

A.2 ATmega 8 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45

A.3 L293D . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45

A.4 433 Mhz RF module . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45

A.5 IR Photodiode . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

45

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

List of Figures
2.1

Main Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

2.2

Remote Section . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

4.1

Atmega16 Pin-out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

10

4.2

ATmega8 Pin-out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

11

4.3

L293D motor driver IC Pin out . . . . . . . . . . . . . . . . . . . . . . . .

12

4.4

RF module Pin-out . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

13

4.5

DC geared motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

15

4.6

water pump motor . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

16

5.1

Sensor circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

18

5.2

Receiver circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

19

5.3

Transmitter circuit . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .

20

iii

Chapter 1
Introduction
The aim here is to build a robot that can detect and extinguish fire in a flat surface. This
fire extinguishing rolling robot is a prototype of the actual one.
Sensors used here are simple infrared (IR) photodiodes that detect IR rays coming out
of the fire. The sensor board mounted on top of the robots chassis is circular in shape so
that it gives the robot all-round detection view of 360. Sensors are equally spaced at 45
each. These act as the eyes of the robot. The robot moves with the help of two motors,
whose sense of rotation is controlled by the controller, depending on the feedback from the
sensor. The basic function of the algorithm is to orient the front sensor in front of the fire
so that the nozzle of the pump comes directly above the fire source. When this is achieved,
the dc water pump is used to extinguish the fire by spraying water from the bottle, which
stores water. The robot can be made to work in manual as well as in autonomous mode.
The robot is controlled by the operator with the help of a wireless remote that uses an
RF module for communicating with the robot. Switches, push buttons and joysticks are
provided on the remote that controls various tasks such as autonomous mode selection,
reset and starting the pump.

Chapter 2
Block Diagrams
2.1

Receiver Section

Figure 2.1: Main Section

CHAPTER 2.

BLOCK DIAGRAMS

Block diagram description


SENSOR MODULE:
Sensors used here are simple infrared (IR) photodiodes that detect IR rays coming out of
the fire. The sensor board mounted on top of the robots chassis is circular in shape so that
it gives the robot all-round detection view of 360 degree. Sensors are equally spaced at 45
degree each. These act as the eyes of the robot.
MOTOR DRIVER ICs:
Two L293D ICs are used here. L293D is a 16-pin IC which can control a set of two
DC motors simultaneously in any direction. It works on the concept of H-bridge. In a
single L293D chip there two h-Bridge circuit inside the IC which can rotate two dc motor
independently.
ATMEGA16 MICROCONTROLLER:
It is the main working unit of the robot. Constant feedback from the sensor is fed to the
Atmega 16.It is an 8-bit high performance microcontroller of Atmels Mega AVR family
with low power consumption.
RF RECEIVER:
Signals from transmitter section is given to microcontroller via RF transmitter. It receives
signals from transitter and fed to Atmega 16.
MOTORS:
Two 12V DC geared motor is used for the movement of motor. A 12V DC water pump is
used to extinguish the fire by spraying water.

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 2.

2.2

BLOCK DIAGRAMS

Transmitter Section

Figure 2.2: Remote Section


Block diagram description
REMOTE:
The robot is controlled by the operator with the help of a wireless remote that uses an
RF module for communicating with the robot. Switches, push buttons and joysticks are
provided on the remote that controls various tasks such as autonomous mode selection,
reset and starting the pump.
ATMEGA8 MICROCONTROLLER:
The output from remote is fed to Atmega 8 Microcontroller. Corresponding changes are
given to RF transmitter.
RF TRANSMITTER:
RF Transmitter transmits corresponding signals to RF receiver.

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

Chapter 3
WORKING
This fire extinguishing robot is a prototype of the actual one. Sensors used here are simple
infrared (IR) photodiodes that detect IR rays coming out of the fire. The sensor board
mounted on top of the robots chassis is circular in shape so that it gives the robot all-round
detection view of 360 degree. Sensors are equally spaced at 45 degree each. These act as
the eyes of the robot. In the actual robot, use of fire sensors or IR cameras is recommended.
But these are too expensive and hence IR photodiodes have been used as a substitute in
the prototype.
The pump used here symbolizes the fire extinguishing mechanism, and is used as a
substitute in the prototype. Also, the body used is not fire-proof. The actual robot must
use fire-proof material for proper and better functioning for efficient results.
IR WAVES: Wavelengths longer than visible and up to 1mm are termed as IR waves.
IR radiation can be felt as radiant heat, for example, when you stand in front of a fire.
The light emitted by a burning source comprises IR waves, so by using IR photodiodes as
sensors we can detect a fire. This principle has been used in the designing of the sensor
board.
DC WATER PUMP: A 12V DC water pump is used for the purpose of extinguishing
fire. It pumps out water stored in a bottle. Any other suitable water pump can also be
used.

CHAPTER 3. WORKING

RF MODULE: A pair of 433MHz RF transmitter-receiver module is used. It allows


transmission and reception of serial data without physical connection. The frequency of
an RF signal is inversely proportional to the wavelength of the field.
The robot can be made to work in manual as well as in autonomous mode. The fire
extinguishing robot works in three stages.

3.1

Stage 1: Fire detection (autonomous mode):

IR photodiodes are connected in reverse bias as shown in the circuit diagram of the sensor
module. Anodes are commonly connected to the ground and cathodes are connected to the
5V via resistors of 1M each. Voltage across the photodiode is given as input to ADC pins
(PA0 through PA7) of ATmega16. When IR waves fall on the IR photodiode, its resistance
decreases from 650k to 150k, reducing the voltage across the photodiode, thus changing
the input voltage at the ADC pin. By proper quantisation, the presence and absence of
the flame can be distinguished.
Similarly, eight IR photodiodes mounted in a circular fashion on the sensor board help
detect the fire; the corresponding LED glows if fire is detected. The cone of detection of
the IR photodiode is large, thus decreasing the resolution of the system. This problem can
be solved by properly shielding IR photodiodes.
Code to detect the presence of fire using the ADC is as follows:
{
unsigned char v;
v= read_adc(0);
if(v>=0 && v <=128) //Stores the digital
value of the analog voltage at ADC 0
fire_detected ( );
if(v>128 && v<=255)
fire_not_detected( );}

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 3. WORKING

3.2

Stage 2: Extinguishing fire

Constant feedback from sensors is fed to the main module, and hence position of the
fire with respect to the robot is determined. The main module includes an ATmega16
microcontroller, two L293D motor driver ICs to drive motors, a water pump and RF
receiver RX1. The basic function of the algorithm is to orient the front sensor in front of
the fire so that the nozzle of the pump comes directly above the fire source. When this is
achieved, the pump starts and extinguishes the fire. The robot moves with the help of two
motors, whose sense of rotation is controlled by the controller, depending on the feedback
from the sensor.

3.3

Stage 3: RF communication and manual control


(manual mode).

The robot is controlled by the operator with the help of a wireless remote that uses an
RF module for communicating with the robot. Switches, push buttons and joysticks are
provided on the remote that controls various tasks such as autonomous mode selection,
reset and starting the pump. For each command, the remote sends a specific character
that is received by the robot and the corresponding operation is performed.
Specimen code for autonomous mode is given as below:
For remote (transmitter):
if(check_bit(&PIND,4)==0)
{
i=h;

//auto mode

printf("%c",i);
}
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 3. WORKING

For robot (receiver):


while(1)
{
scanf("%c",&ii);
_delay_ms(10);
switch(ii)
{
case h:

//auto mode

autonomous();
break;

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

Chapter 4
MAIN COMPONENTS
1. Atmega16 microcontroller
2. ATmega8 microcontroller
3. L293D motor driver
4. Photodiode (IR receiver)
5. 433Mhz RF module
6. 12V DC geared motor
7. 12V water pump motor

4.1

Atmega16 microcontroller

ATmega16 is an 8-bit high performance microcontroller of Atmels Mega AVR family


with low power consumption.
ATmega16 is a 40 pin microcontroller.
It has 16KB of programmable memory and 512Byte of EEPROM.

CHAPTER 4. MAIN COMPONENTS

10

There are 32 I/O (input/output) lines which are divided into four 8-bit ports designated as PORTA, PORTB, PORTC and PORTD
ATmega16 has various in-built peripherals like USART, ADC, Analog Comparator
etc.

Figure 4.1: Atmega16 Pin-out

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 4. MAIN COMPONENTS

4.2

11

ATmega8 microcontroller

ATmega8 is an 8-bit high performance microcontroller of Atmels Mega AVR family


with low power consumption.
ATmega8 is a 28 pin microcontroller.
It has 8KB of programmable memory and 512Byte of EEPROM.
23 I/O line can be obtained from three ports; namely Port B, Port C and Port D.
ATmega8 has various in-built peripherals like USART, ADC, Analog Comparator
etc.

Figure 4.2: ATmega8 Pin-out

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 4. MAIN COMPONENTS

4.3

12

L293D motor driver

L293D is a 16-pin IC which can control a set of two DC motors simultaneously in


any direction.
It works on the concept of H-bridge.
In a single L293D chip there two H-Bridge circuit inside the IC which can rotate two
DC motor independently
To simplify use as two bridges each pair of channels is equipped with an enable input.
A separate supply input is provided for the logic, allowing operation at a lower voltage
and internal clamp diodes are included.
This device is suitable for use in switching applications at frequencies up to 5 kHz.

Figure 4.3: L293D motor driver IC Pin out


FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 4. MAIN COMPONENTS

4.4

13

433Mhz RF Module

The RF module, as the name suggests, operates at Radio Frequency. The corresponding
frequency range varies between 30 kHz and 300 GHz. In this RF system, the digital data
is represented as variations in the amplitude of carrier wave. This kind of modulation is
known as Amplitude Shift Keying (ASK). The RF module we will use comprises of an RF
Transmitter and an RF Receiver. The transmitter/receiver (Tx/Rx) pair operates at a
frequency of 433 MHz and it has 4 output pins i.e. it can operate 4 peripherals remotely.
Transmitter Section
RF transmitters are electronic devices that creates continuously varying electric current,
encode sine waves, and broadcast radio waves
Receiver Section
RF receivers are electronics devices that separate radio signals from one another and convert specific signals into audio, video, or data formats.

Figure 4.4: RF module Pin-out


FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 4. MAIN COMPONENTS

4.5

14

12V DC geared motor

Geared DC motors can be defined as an extension of DC motor. A geared DC Motor has a


gear assembly attached to the motor. The speed of motor is counted in terms of rotations
of the shaft per minute and is termed as RPM .The gear assembly helps in increasing the
torque and reducing the speed. Using the correct combination of gears in a gear motor, its
speed can be reduced to any desirable figure. This concept where gears reduce the speed
of the vehicle but increase its torque is known as gear reduction.
The robot moves with the help of two motors, whose sense of rotation is controlled by
the controller, depending on the feedback from the sensor.be
Specifications
Voltage - 6V to 18V
RPM - 100 (at 12V)
Nominal Voltage - 12V
No- Load Current - 100mA
Full Load Current - 1900mA
Full Load Torque - 22 Kgcm (max)

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 4. MAIN COMPONENTS

15

Figure 4.5: DC geared motor

4.6

12V water pump motor

A dc water pump is used to extinguish the fire by spraying water from the bottle, which
stores water.
Specifications
Weight: 150g
Dimension of inlet and outlet: 15mm O.D. / 5mm O.D.
Working voltage range: 12V DC-18V DC
Rated voltage: 12V DC
Working current: 0.1A-0.5A
Lift: 130cm (at 12V DC)

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 4. MAIN COMPONENTS

16

Figure 4.6: water pump motor

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

17

CHAPTER 5. CIRCUIT DIAGRAM

18

Chapter 5
CIRCUIT DIAGRAM
5.1

Sensor Module

2016
College of Engineering, Kidangoor
Figure 5.1: Sensor circuit

FIRE EXTINGUISHING ROBOT

CHAPTER 5. CIRCUIT DIAGRAM

5.1.1

19

Design

1. Eight Sensors are used because it improves the resolution and area of detection.
2. Resistance with IR photodiode:
That circuit is actually a voltage divider circuit. When fire is not detected:
V2=(V1 R2)/(R1+R2) Where R2- resistance of photodiode.
V2=1.96V, V1= 5V, R2=650k ohm
On solving R1=1008163.265 ohm So taking 1M ohm resistor (std.)
3. Resistance with LEDs:
It is used to protect the LED from high voltage. It can be any value in between
100-1000 ohm. So taken 680 ohm.

5.2

Receiver Section

Figure 5.2: Receiver circuit

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 5. CIRCUIT DIAGRAM

5.2.1

20

Design

1. R2 is the pull up resistor and C3 is capacitor used to avoid unwanted reset of the
controller. Their value is selected from datasheet of Atmega 16.
2. C1 is the electrolytic capacitor used to avoid unwanted noise from the supply voltage.
Commonly using capacitor for Atmega microcontrollers is 10uF,25v.
3. To provide external clock pulse of 8MHz an 8MHz crystal oscillator is used. To
provide port capacitance two 22pF capacitor is used (from data sheet)
4. The motors used here is two 12V DC Johnson geared motor of 2Nm torque each.
This motor is selected to carry weight upto 10Kgms

5.3

Transmitter Section

Figure 5.3: Transmitter circuit

5.3.1

Design

1. R4 is the pull up resistor and C8 is capacitor used to avoid unwanted reset of the
controller. Their value is selected from datasheet of Atmega 16.
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 5. CIRCUIT DIAGRAM

21

2. C6 is the electrolytic capacitor used to avoid unwanted noise from the supply voltage.
Commonly using capacitor for Atmega microcontrollers is 10uF,25v.
3. To provide external clock pulse of 8MHz an 8MHz crystal oscillator is used. To
provide port capacitance two 22pF capacitor is used (from data sheet)
4. A four way dip switch is used in the circuit is to select different modes of operations.Since there are 5 modes we opted 4 way dip switch.
MODE SELECTION AND TEST POINTS

Manual Mode: If PD3, PD4, PD5, PD6 are high.


Reset Mode: If PD3 is low.
Autonomous mode: If PD4 is low.
Water pump on mode: If PD5 is low.
LED test mode: If PD6 is low.

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 5. CIRCUIT DIAGRAM

5.4

22

Limitations

Usage is limited to plane surface and the body is not fire proof
IR photodiodes also react to sunrays, since these too contain IR waves, thus allowing
the robot to make false judgments. However, the effect of sunlight and other factors
is not significant if we use better sensors (which are far more costly).

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

Chapter 6
ALGORITHM AND PROGRAM
6.1
6.1.1

Transmitter Section
Algorithm

1.Start
2.Initialise ports and adc pins
3.Define POT1=read adc(0) and POT2=read adc(1)
4.Check whether PD4=0, do i=h (autonomous mode), else go to next step.
5.Check whether PD3=0, do i=r (reset mode), else go to next step.
6.Check whether PD5=0, do i=g (pump on mode), else go to next step.
7.Check whether PD4=0, do i=j (led test mode), else go to next step.
8.Check the condition ((POT1>200 && POT2<50)||(POT1<50 && POT2>200)):
8.1. Check whether (POT1>200 && POT2<50), do i=a (bot forward), else
go to step 8.2.
8.2. Check whether (POT1<50 && POT2>200), do i=b (bot reverse),
else go to step 9.
9.Check the condition ((POT1<50 && POT2<50)||(POT1>200 && POT2>200)):
9.1. Check whether (POT1<50 && POT2<50), do i=e (bot diff right),
else go to step 9.2
23

CHAPTER 6. ALGORITHM AND PROGRAM

24

9.2. Check whether (POT1<50 && POT2>200), do i=b (bot diff left),
else go to step 10.
10.Do i=c (current condition).
11.Stop.

6.1.2

Program

#include<avr/io.h>
#include<stdio.h>
#include<usart.h>
#include<initialise_16.h>
#include<avr/interrupt.h>
#include<util/delay.h>
#include<bitwise.h>

/*************GLOBAL VARIABLES********/

#define ADC_VREF_TYPE 0x60

unsigned char read_adc(unsigned char adc_input)


{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
// Delay needed for the stabilization of the ADC input voltage
_delay_us(10);
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

25

ADCSRA|=0x10;
return ADCH;
}

int main(void)
{
init_port();
init_adc();
init_usart();
//init_timer0();
//init_timer2();
//init_timer1();
//init_analog_com();
//init_timer_counter_interrupt();
sei();

unsigned char i,POT1,POT2;

while(1)//tx
{
POT1=read_adc(0);
POT2=read_adc(1);

if(check_bit(&PIND,4)==0)
{
i=h; //auto
printf("%c",i);
}

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

else

26

if(check_bit(&PIND,3)==0)

{
i=r; //reset
printf("%c",i);
}
else if(check_bit(&PIND,5)==0)
{
i=g; //pump_on
printf("%c",i);
}
else if(check_bit(&PIND,6)==0)
{
i=j; //led testing
printf("%c",i);
}
else if((POT1>200 && POT2<50)||(POT1<50 && POT2>200))
{
if(POT1>200 && POT2<50)
i=a;//bot forward

if(POT1<50 && POT2>200)


i=b;//bot reverse
}
else if((POT1<50 && POT2<50)||(POT1>200 && POT2>200))
{
if(POT1<50 && POT2<50)
i=e;//bot diff right

if(POT1>200 && POT2>200)


FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

27

i=d;//bot diff left


}
else
i=c;
_delay_ms(10);
printf("%c",i);
}//wh
return 0;
}

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

6.2

28

Receiver Section

6.2.1

Algorithm

1. Start
2. Define PDI to PD8 as read_adc(0) to read_adc(7) respectively.
3. Define motors
4. Assign ports and pins for enable and input of motors.
5. Assign following functions (movement):
5.1 Bot forward- move left motor and right motor in forward direction.
5.2 Bot reverse- move left motor and right motor in reverse direction.
5.3 Bot brake- left motor and right motor in braked condition.
5.4 Bot diff right- move left motor forward and right motor backward,
5.5 Bot diff left- move left motor backward and right motor forward.
5.6 Pump on- move pump forward.
5.7 Pump off- pump in braked condition.
6. Autonomous mode:
6.1 Check whether (PD1>128&&PD2>128&&PD3>128&&PD4>128&&PD5>128&&PD6>128
&&PD7>128&&PD8>128) move to step no 16. Else move to next step.
6.2 Check whether (PD3<128), make corresponding LED bright, move the
bot forward and turn on water pump. Else move to next step.
6.3 Check whether (PD2<128), make corresponding LED bright, move the
bot forward and turn on water pump. Else move to next step.
6.4 Check whether (PD1<128), make corresponding LED bright, move the
bot diff right and move to step 6.3. Else move to next step.
6.5 Check whether (PD8<128), make corresponding LED bright, move the
bot diff right and move to step 6.3. Else move to next step.
6.6 Check whether (PD4<128), make corresponding LED bright, move the
bot diff left and move to step 6.2. Else move to next step.

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

29

6.7 Check whether (PD5<128), make corresponding LED bright, move the
bot diff left and move to step 6.2. Else move to next step.
6.8 Check whether (PD6<128), make corresponding LED bright, move the
bot diff left and move to step 6.2. Else move to next step.
6.9 Check whether (PD7<128), make corresponding LED bright, move the
bot diff right and move to step 6.3. Else move step 6.1.
7. Declared a character i.
8. If i=a move the bot forward. Else move to step 16.
9. If i=b, move the bot reverse. Else move to step 16.
10. If i=d, move the bot diff left. Else move to step 16.
11. If i=e, move the bot diff right. Else move to step 16.
12. If i=h, autonomous mode. Else move to step 16.
13. If i=g, pump on mode. Else move to step 16.
14. If i=j, led testing mode. Else move to step 16.
15. If i=r, reset mode (make LEDs in even ports bright). Else move to
step 16.
16. Bot is in braked and pump is off.
17. Stop.

6.2.2

Program

#include<avr/io.h>
#include<stdio.h>
#include<usart.h>
#include<initialise_16.h>
#include<avr/interrupt.h>
#include<util/delay.h>
#include<bitwise.h>

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

30

#define PD1 read_adc(0)


#define PD2 read_adc(1)
#define PD3 read_adc(2)
#define PD4 read_adc(3)
#define PD5 read_adc(4)
#define PD6 read_adc(5)
#define PD7 read_adc(6)
#define PD8 read_adc(7)

#define L_OCR OCR1AL


#define R_OCR OCR1BL

/*************GLOBAL VARIABLES********/

enum motor_type {ml,


enum led
//VALUES===>>>0

pump,

mr};

{led1,led2,led3,led4,led5,led6,led7,led8};
1

unsigned char *motor_port_a[]= {&PORTC, &PORTC , &PORTD};


unsigned char motor_pin_a[]= {

2,

5,

6};

unsigned char *motor_port_en[]= {&PORTC, &PORTC ,


unsigned char motor_pin_en[]= {

1,

7,

4};

unsigned char *motor_port_b[]={&PORTC, &PORTC ,


unsigned char motor_pin_b[]= {3,

6,

&PORTD};

&PORTD};

5};

unsigned char rotate_a[]={0,1,0,1};


unsigned char rotate_b[]={1,0,1,0};

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

31

unsigned char *led_port[]={&PORTB,&PORTB,&PORTB,&PORTB,&PORTB,&PORTB,


&PORTB,&PORTB};
unsigned char led_pin[]={0,1,2,3,4,5,6,7};
unsigned char sens[8],sensor,n=0,x=0,i;

/**********FUNCTIONS***********/

void move_motor(char motor,char dir)


{
change_bit(motor_port_a[motor],motor_pin_a[motor],rotate_a[dir]);
change_bit(motor_port_b[motor],motor_pin_b[motor],rotate_b[dir]);
}
unsigned char read_adc(unsigned char adc_input)
{
ADMUX=adc_input | (ADC_VREF_TYPE & 0xff);
// Delay needed for the stabilization of the ADC input voltage
_delay_us(10);
// Start the AD conversion
ADCSRA|=0x40;
// Wait for the AD conversion to complete
while ((ADCSRA & 0x10)==0);
ADCSRA|=0x10;
return ADCH;
}
void bot_forward(void)
{
move_motor(ml,forward);
move_motor(mr,forward);
}
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

32

void bot_reverse(void)
{
move_motor(ml,reverse);
move_motor(mr,reverse);
}
void bot_brake(void)
{
move_motor(ml,brake);
move_motor(mr,brake);
}
void bot_diff_right(void)
{
move_motor(ml,forward);
move_motor(mr,reverse);
}
void bot_diff_left(void)
{
move_motor(ml,reverse);
move_motor(mr,forward);
}
void pump_on()
{
move_motor(pump,forward);
}
void pump_off()
{
move_motor(pump,brake);
}
void autonomous()
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

33

{
bot_brake();
PORTB=0xFF;
L_OCR=100;
R_OCR=100;

while
(PD1>128&&PD2>128&&PD3>128&&PD4>128&&PD5>128&&PD6>128&&PD7>128&&PD8>128)
{ scanf("%c",&i);
if(i==r)
main();
}
PORTB=0x00;
while(1)
{
scanf("%c",&i);
if(i==r)
main();
if(PD3<128)
{
PORTB=0x00;
change_bit(&PORTB,2,1);
bot_forward();
_delay_ms(200);
bot_brake();
pump_on();
_delay_ms(2000);
pump_off();
}
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

34

else if(PD2<128)
{
PORTB=0x00;
change_bit(&PORTB,1,1);
bot_forward();
_delay_ms(200);
bot_brake();
pump_on();
_delay_ms(2000);
pump_off();
}
else if(PD1<128)
{
PORTB=0x00;
change_bit(&PORTB,0,1);
bot_diff_right();
while(PD2<128);
change_bit(&PORTB,1,1);
bot_brake();
pump_on();
_delay_ms(2000);
pump_off();
}
else if(PD8<128)
{ PORTB=0x00;
change_bit(&PORTB,7,1);
bot_diff_right();
while(PD2<128);
change_bit(&PORTB,1,1);
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

35

bot_brake();
pump_on();
_delay_ms(2000);
pump_off();
}

else if(PD4<128)
{
PORTB=0x00;
change_bit(&PORTB,3,1);
bot_diff_left();
while(PD3<128);
change_bit(&PORTB,2,1);
bot_brake();
pump_on();
_delay_ms(2000);
pump_off();
}
else if(PD5<128)
{
PORTB=0x00;
change_bit(&PORTB,4,1);
bot_diff_left();
while(PD3<128);
change_bit(&PORTB,2,1);
bot_brake();
pump_on();
_delay_ms(2000);
pump_off();
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

36

}
else if(PD6<128)
{PORTB=0x00;
change_bit(&PORTB,5,1);
bot_diff_left();
while(PD3<128);
change_bit(&PORTB,2,1);
bot_brake();
pump_on();
_delay_ms(2000);
pump_off();
}
else if(PD7<128)
{PORTB=0x00;
change_bit(&PORTB,6,1);
bot_diff_right();
while(PD2<128);
change_bit(&PORTB,1,1);
bot_brake();
pump_on();
_delay_ms(2000);
pump_off();
}
}//wh ends
}
int main(void)////////////rx
{
unsigned char ii=0;
init_port();
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

37

init_usart();
init_adc();
sei();

char i;
while(1)
{

scanf("%c",&ii);
_delay_ms(10);
switch(ii)
{
PORTB=0;
case a:
PORTB=0x00;
bot_forward();
change_bit(&PORTB,1,1);
change_bit(&PORTB,2,1);
break;

case b:
PORTB=0x00;
bot_reverse();
change_bit(&PORTB,5,1);
change_bit(&PORTB,6,1);
break;

case d:
PORTB=0x00;
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

38

bot_diff_left();
change_bit(&PORTB,4,1);
break;

case e:
PORTB=0x00;
bot_diff_right();//left forward
change_bit(&PORTB,0,1);
break;

case h://auto mode


autonomous();
break;

case g:
pump_on();
break;

case j://led testing


ii=0;
unsigned char i;
while(1)
{ scanf("%c",&i);
if(i==r)
main();

change_bit(&PORTB,ii%8,1);
_delay_ms(100);
change_bit(&PORTB,ii%8,0);
FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

CHAPTER 6. ALGORITHM AND PROGRAM

39

_delay_ms(100);
ii++;
}
break;
case r:

//reset

main();
break;
default:
bot_brake();
pump_off();
PORTB=0xaa;
break;
}//sw
}//wh
return 0;
}

FIRE EXTINGUISHING ROBOT

2016

College of Engineering, Kidangoor

Chapter 7
APPLICATIONS
By replacing IR photo sensors with the thermal image-processing camera, the pump
with a fire extinguishing mechanism and by making the body of the robot fire-proof,
it can be used for fire extinguishing purposes. It can also be used in assisting fire
fighters, thus helping them reach inaccessible places to save more lives.
Increasing the number of sensors will improve the resolution and accuracy of the
system further.
In autonomous mode, it can detect a fire, if any, and extinguish it without any
assistance.
The RF module makes it possible for the operator to control the robot manually
from a distance, thus allowing surveillance facility.

40

Chapter 8
CONCLUSIONS AND FUTURE
SCOPE
This project presents a fire extinguishing robot:
Which sense IR rays coming out of fire using simple IR photodiodes.
The robot will work in both manual and autonomous mode.
It is designed with Atmega16 microprocessor as main module.
Future Scope
Use more sensors such as smoke detectors and thermal image processing for feedback
and to improve the accuracy and reliability of the system further.
Replace IR photo sensors with more dependable ones, which have filters, because IR
sensors even take sunlight as a source of IR waves, leading to errors and false alarms.

41

42

CHAPTER 9. BILL OF MATERIALS

43

Chapter 9
BILL OF MATERIALS
Sl No

Components

12V DC geared motor

599

1198

Atmega 16

175

175

Atmega 8

90

90

RF Module

300

300

LM7805 Regulator

10

20

8 MHz Crystal Oscillator

16

L293D

60

120

16 pin IC base

28 pin IC base

10

40 pin IC base

11

Dotted Board

20

40

12

Jumper

30

120

13

Connentor

20

14

IR photodiode

10

80

15

Sheet Metal

66.66

4.8kg

320

16

Miscellaneous

550

Total

3064

FIRE EXTINGUISHING ROBOT

Cost Per Individual Item Quantity

2016

Total

College of Engineering, Kidangoor

Bibliography
Magazine
[1] Electronics for you. Article: Fire Extinguishing Robot by Amol Gulhane, Edition May
2015.

Websites
[2] http://electronicsforu.com/electronicsforu/circuitarchieves/responsive/viewarticle.asp
[3] http://maxembedded.com/category/microcontrollers-2/atmel-avr/

44

Appendix A
DATA SHEETS
A.1

ATmega 16

A.2

ATmega 8

A.3

L293D

A.4

433 Mhz RF module

A.5

IR Photodiode

45

You might also like