You are on page 1of 48

MICROCONTROLLER BASED INDUSTRIAL

SAFETY AND SECURITY SYSTEMS

A PROJECT REPORT

Submitted by

RAGHAVENDRAN R. (41501112025)

SUBRAMANI C. (41501112029)

MURUGAN K. (41501112016)

in partial fulfillment for the award of the degree


of
BACHELOR OF ENGINEERING

in

INSTRUMENTATION AND CONTROL ENGINEERING

S.R.M. ENGINEERING COLLEGE, KATTANKULATHUR

ANNA UNIVERSITY :: CHENNAI 600025

MAY 2005
BONAFIDE CERTIFICATE

Certified that this project report “MICROCONROLLER BASED INDUSTRIAL

SAFETY AND SECURITY SYSTEMS” is the bonafide work of “SUBRAMANI C.

(41501112029), RAGHAVENDRAN R. (41501112025) and MURUGAN K.

(41501112016)” who carried out the project under my supervision.

SIGNATURE SIGNATURE
HEAD OF DEPARTMENT Dr. RANGANATH MUTHU
Department of Instrumentation SUPERVISOR
and Control Engineering PROFESSOR
S.R.M. Engineering College Department of
Kattankulathur Instrumentation and Control
Kanchipuram-603203 Engineering
S.R.M. Engineering
College, Kattankulathur
Kanchipuram-603203

ABSTRACT

In this project, five critical parameters namely fire, level, intruder, temperature and

smoke are sensed and detected. The thermistor is used to detect the fire; the level sensors

are used to detect the level at two levels. IR Transmitter and Receiver are used to detect

the trespassing, temperature detector is used to detect temperature and smoke sensor is

used to detect smoke. The sensors give the appropriate control signal to the

microcontroller unit. The microcontroller unit gives the control signal to the controlling

unit, like Water splashing unit, Motor control and Alarm unit. This project is mainly

implemented in industries to sense the critical parameters and to control the same. By

implementing this project the critical parameters are monitored continuously and the

ii
alarm signal is given for indication and the control action is also performed. This project

is also a real time application and monitoring system.

TABLE OF CONTENTS

CHAPTER NO. TITLE PAGE NO.

ABSTRACT iii
LIST OF TABLES vi
LIST OF FIGURES vii
LIST OF ABBREVIATIONS viii
AND NOMENCLATURE

1 INTRODUCTION
1.1 OUTLINE OF THE THESIS 1
1.2 BLOCK DIAGRAM OF THE PROJECT 3
1.3 REAL TIME APPLICATIONS OF THE
PROJECT 4

2 SENSOR DESCRIPTION
2.1 SMOKE SENSOR 5
2.2 TEMPERATURE SENSOR 8
2.3 WATER LEVEL DETECTION 11
2.4 FIRE DETECTION AND CONTROL LOOP 13
2.5 INTRUDER DETECTION 17

3 SIGNAL CONDITIONING CIRCUIT


3.1 ANALOG TO DIGITAL CONVERTER 20
3.2 BLOCK DIAGRAM OF ADC CIRCUIT 21

4 POWER SUPPLY
4.1 POWER SUPPLY COMPONENTS 22
4.2 CIRCUIT DIAGRAM OF POWER SUPPLY 24

5 MICROCONTROLLER
5.1 ATMEL 89C51 25
5.2 PROGRAMMING 28

6 RELAYS
6.1 INTRODUCTION 36
6.2 TYPES OF RELAYS 37
6.3 APPLICATION OF RELAYS 39

7 MICROCONTROLLER BASED INDUSTRIAL SAFETY


AND SECURITY SYSTEMS

iii
7.1 OVERVIEW OF THE PROJECT 40
7.2 BLOCK DIAGRAM OF THE 42
ENTIRE PROJECT

8 RESULTS AND CONCLUSION


8.1 RESULT OF THE DESIGN 43
8.2 EXPECTATION AND IMPROVEMENT 45
8.3 CONCLUSION 45

9 APPENDIX
9.1 PROGRAM CODE FOR OPERATION 46

10 REFERENCES 56

LIST OF TABLES

TABLE NO. TITLE PAGE NO.

2.1 Smoke Detector Details 7

5.1 Microcontroller Timer Operation 1 35

5.2 Microcontroller Timer Operation 2 35

5.3 Microcontroller Timer Operation 3 35

LIST OF FIGURES

FIGURE NO. TITLE PAGE NO.

1.1 Block diagram of the project 3

2.1 Temperature Control Loop using LM 35 10

2.2 Block Diagram of Water Level Detection Loop 12

2.3 Circuit Diagram of Water Level Detection 13

2.4 Circuit diagram of Fire Detection Loop 16

2.5 Block diagram of Fire Detection Loop 16

iv
2.6 Block diagram of Intruder Detection Loop 17

2.7 Circuit Diagram of IR Transmitter 18

2.8 Circuit diagram of IR Receiver 19

3.1 Block diagram of ADC circuit 21

4.1 Circuit Diagram of Power Supply Circuitry 24

5.1 Pin diagram of ATMEL 89C51 Microcontroller 33

5.2 Control blocks of Microcontroller 34

6.1 Diagram of a General Relay 36

6.2 SPST Relay 37

6.3 SPDT Relay 37

6.4 DPST Relay 38

6.5 DPDT Relay 38

7.1 Circuit Diagram of the Entire Project 42

LIST OF ABBREVIATIONS AND NOMENCLATURE

ABBREVIATIONS

SS - Smoke Sensor
FD - Fire Detector
TS - Temperature Detector
ID - Intruder detector
ADC - Analog to Digital converter.

NOMENCLATURE

APOLLO SERIES 65 - These are APOLLO made smoke sensors,


which are highly sensitive and are used in
industries

ATMEL 89C51 - This is a flash memory microcontroller

v
CHAPTER 1
INTRODUCTION

1.1 OUTLINE OF THE THESIS

Safety in industries is of paramount importance as it directly affects the


productivity of the concerned industries. The use of dedicated software for safety and
control applications began with the technological advancement in the field of
MICROCONTROLLERS. With the advent of newer technologies, situations have turned
around a lot and the need to view the live process in a system, within a control room has
become essential.

The various safety parameters that are monitored in this project are:

∗ Temperature control
∗ Water level indicator
∗ Fire Detection
∗ Intruder Detection
∗ Smoke detection

1.1.1 Temperature Control Loop

The basic idea involved in this loop is to maintain the temperature of the room at
a required ambient level. Temperature is one of crucial parameter, which has to be
monitored and controlled in an industry. In this loop, continuous scanning of room
temperature is done using a suitable sensor. By switching on/off the heating element, the
room temperature can be maintained at the required level.

1.1.2 Intruder Detection

It is of utmost importance in industries to detect intrusion in restricted area. The


principle behind this loop is obstruction of infrared wave propagation by an intruder,
which causes the activation of distress alarm.

1.1.3 Water Level Monitoring and Control

vi
The water level in a tank is monitored using a suitable sensor. So when the water
reaches low level, a control signal is sent to activate the motor and as soon as water
reaches the high level another control signal is sent to stop the motor.

1.1.4 Fire Detection

Fire detection sensor is situated in a suitable position in the industry. As soon as there is
accidental fire the sensor detects it and sends caution signal to the control room from were a control signa
sent to actuate the fire extinguishing unit.

1.1.5 Smoke Detection

An optical type smoke sensor is used for smoke detection. When the smoke
enters, it scatters photons on to the photodiode to excite it into activity. The LED then
emits two further bursts of light, at 2-second intervals. If light is scattered on to the
photodiode on both these pulses due to the presence of smoke, the detector will change to
the alarm state. Then a silicon controlled rectifier on the printed circuit board is switched
on and the current drawn by the detector is increased from an average of 40µA to a
maximum of 61mA. This comprises of a sensing chamber and a printed circuit board
within a white polycarbonate housing. The sensing chamber is a black molding
configured as a labyrinth which prevents ambient light penetrating into the chamber. The
labyrinth has a fine gauge cover to prevent insects from migrating into the chamber.
Within this chamber is an optical arrangement consisting of two main parts: an infrared
light emitting diode and a photo diode. The LED is positioned at an obtuse angle to the
photo diode, which has an internal daylight filter for further protection against ambient
light.

1.2 BLOCK DIAGRAM OF PROJECT

The block diagram of the project is shown in Fig 1.1.

vii
Fig. 1.1 Block diagram of the project

1.3 REAL TIME APPLICATIONS OF THE PROJECT

1.3.1 Industries

In manufacturing and heavy engineering industries, refineries and many other


process industries there is always a danger of fire and increase in temperature. In these
areas, this project can be implemented effectively and in a most efficient manner. This
also optimizes the working process and can be implemented in an effective way.

1.3.2 Domestic usage

This project can also be implemented for domestic uses such as in homes and also
in hotel and catering establishments, which are susceptible to hazards of smoke and fire.
For personal usage this is a best way to prevent fire.

1.3.3 Highlights of this Project

viii
This is implemented in a comparatively cheap manner. This is operated using a
microcontroller ATMEL 89C51 that has flash memory that can be reprogrammed.

CHAPTER 2
SENSOR DETAILS

2.1 SMOKE SENSOR

The smoke sensor that is being used here is APPOLO series 60 optical detector
type sensor. This comprises of a sensing chamber and a printed circuit board within white
polycarbonate housing. The sensing chamber is a black molding configured as a labyrinth
which prevents ambient light penetrating into the chamber. The labyrinth has a fine gauge
cover to prevent insects from migrating into the chamber. Within this chamber is an
optical arrangement consisting of two main parts: an infrared light emitting diode and a
photo diode. The LED is positioned at an obtuse angle to the photo diode, which has an
internal daylight filter for further protection against ambient light [Ross, 2004].
The LED emits collimated light for every 10 seconds. In clean air conditions, the
photo diode will not receive light particles or photons due to the collimation of light and
the angle at which the light is traveling relative to the photodiode. When the smoke enters
the chamber, it scatters photons onto the photodiode to excite it into activity. The LED
then emits two further bursts of light at 2-second intervals. If light is scattered onto the
photodiode on both these pulses due to the presence of smoke, the detector will change to
the alarm state. A silicon controlled rectifier on the printed circuit board is switched on
and the current drawn by the detector is increased from an average of 40µA to a
maximum of 61mA.

2.1.1 Electrical Description

Connection to the supply is made in the mounting between terminals L1 and L2


and the polarity is made insensitive. Terminal L1 IN is a supply input terminal and it is
connected to Terminal L1 OUT via the detector when fitted. L1 OUT and L2 provide the
supply output to the next detector on the zone or to the end of the line device. This

ix
method of connection permits continuous monitoring of the supply through the detector
and the end of line device.
A remote alarm indicator may be connected between the positive supply line and
the –R terminal. The –R terminal is to protect it against accidental connection to the
negative supply and to permit the connection of more than one detector to a single remote
indicator. The current taken from the above terminal should be externally limited to
23mA. The Apollo remote indicator typically sinks 20mA. The supply range is 8V to
28V to the detector.
The control unit must be arranged to supply a maximum of 28V and a minimum
of 6V in the alarm condition for correct operation of the detector. To ensure effective
illumination of the indicator, the supply to the indicator should exceed 12V. The
electrical details of the smoke detector are tabulated in the Table 2.1 [EPA].

Table 2.1 Smoke Detector Details

Average Smoke
Supply Pulse Smoke
standby alarm
voltage current alarm
current current
(V) (µA) (mA)
(µA) (mA)
28 38 110 61 54

24 37 90 52 48

17 25 60 37 33

10 1 1 18 16

It also has negative temperature coefficient thermistor. The alarm-reset time is 1

second. The alarm-reset voltage is 1V. In remote output characteristics there is 9000 Ω

resistor in series with a 3V drop at 24V with 5000 Ω line impedance gives 1mA at 9V.

The principle that is being used here is photoelectric detection of light scattered in a

forward direction by smoke particles. The holding voltage is 6V and the holding current

x
is 10mA. In the chamber configuration there is a horizontal optical bench housing an

infrared emitter and sensor arranged radically to detect forward scattered light.

2.2 TEMPERATURE SENSOR

The temperature sensor that is used is LM 35 sensor. The LM 35 series are


integrated circuit temperature sensors whose output voltage is linearly proportional to the
Celsius temperature. The LM 35 thus has an advantage over linear temperature sensors
calibrated in Kelvin, as the user is not required to subtract a large constant. This is also
suitable for remote applications. This also has a very low impedance output [Blintliff,
1992].

2.2.1 Applications

This can be applied easily as any other integrated circuit temperature sensor. It
can be glued or cemented to a surface. This is especially true for the TO-92 plastic
package, where the copper leads are the principal thermal package and carry heat to the
device so that its temperature might be closer to the air temperature rather than to the
surface temperature. These devices are sometimes soldered to a small lightweight fin, to
decrease the thermal time constant and speed up the response in a slowly moving air. The
temperature control loop is a closed one in which the temperature of a processing zone
has to be maintained at a temperature of 40°C to 70°C. A Blower is used to blow the air
into the processing zone. From the processing zone the air is passed through closed pipe
to heating zone, where it is heated by a heating coil and recycled into the processing zone
by the blower unit.

xi
2.2.2 Temperature Control Loop

The temperature control loop is a closed one in which the temperature of a


processing zone has to be maintained at a temperature of 40°C to 70°C. A blower is used
to blow the air into the processing zone. From the processing zone the air is passed
through closed pipe to heating zone, where it is heated by a heating coil and recycled into
the processing zone by the blower unit [Fischer, 1998].

2.2.3 Sensing Unit

The LM 35 sensor is used to sense the temperature in the processing zone. The
LM 35 gives the output from 0.1V to 1V for the temperature range of 0°C to 100°C. The
output of LM 35 is amplified 5 times using LM 324 to give reference signal to the ADC
0809. The output of ADC 0809 is latched for 0.1 seconds using 74LS373 for every 6
seconds using 555 timer. The latched output is given to the ULN 2803 driver IC to drive
the relay units.

2.2.4 Microcontroller Unit

Digital input of microcontroller is allocated to read the ADC output signal from
relay units. The potential free contacts from relay units are connected to the digital inputs
of the microcontroller. The microcontroller is programmed to convert the 8-bit digital
data to the corresponding analog signal. The analog signal is compared with the set point
and the appropriate control signal is given to the control unit from microcontroller [LM
324].

2.2.5 Control Unit

If the temperature of the processing zone is above/below the set point, the heater
is switched OFF/ON accordingly. Thus the appropriate control action takes place with the
help of LM 35 sensor.

2.2.6 Block diagram of temperature control loop

xii
The block diagram of the temperature control loop using LM 35 is depicted in the
Fig.2.1.

Fig. 2.1 Temperature Control Loop using LM 35

2.3 WATER LEVEL DETECTION

2.3.1 Working

System consists of two sensors-one to indicate low level and another to indicate
high level. The signals from these sensors after proper conditioning are given as input to
microcontroller, which, after going through given logics, control the pumping unit.
A simple water level indicator & control circuit can be constructed using a
comparator and relay. Whenever the water is at the low level, lead 1 senses it and gives
an output pulse, which makes the motor ON and fills the tank. As the water level rises
and reaches the high level, lead 2 senses it and switches the motor OFF .The output pulse
is given to the motor through the relay section. This can also be implemented using a
LDR circuit.

xiii
Whenever the photoconductive cell has the appropriate light incident upon it, its
resistance is low and the current through the relay is consequently high to operate the
relay. When the light is interrupted or shut-off partially or completely, the resistance of
the photocell increases thereby reducing the current through the relay. The current may
drop down to a level where it will not be able to operate the relay there by de-energizing
the relay [Northcutt, 2001].
The water level in a tank is monitored using a suitable sensor. So when the water
reaches low level, a control signal is sent to activate the motor and as soon as water
reaches the high level another control signal is sent to stop the motor.

2.3.2 Block diagram of Water level detection loop

The block diagram of water level detection loop is shown in the Fig.2.2.

Fig. 2.2 Block Diagram of Water Level Detection Loop

xiv
2.3.3 Circuit diagram of water level detection loop
The circuit diagram of water level detection loop, which is implemented using a
comparator and a relay, is shown in the Fig. 2.3.

Fig. 2.3 Circuit Diagram for Water Level Detection

2.4 FIRE DETECTION AND CONTROL LOOP

In this system, the fire is sensed by means of a suitable detector, which contains

pair of matched negative temperature coefficient thermistors mounted on a printed circuit

board within white polycarbonate housing. One thermistor is exposed and is therefore in

good thermal contact with the surrounding air and responds quickly to changes in air

temperature. The other thermistor is insulated from the surrounding air and responds

more quickly to changes in temperature.

Under stable conditions, both the thermistors are in thermal equilibrium with the

surrounding air and will have the same resistance value If the air temperature increases

rapidly then a temperature difference develops between the thermistors and the resistance

xv
of the exposed thermistors becomes less than that of the insulated thermistor. The ratio of

the resistances of the thermistors is monitored electronically and a fire alarm is initiated if

the ratio exceeds the limit. The detector is designed to be connected to a two wire

monitored supply of between 17V and 28V.

2.4.1 Thermistor

Thermistor is a contraction of the term thermal resistors. These are composed of


semi-conductor materials. This allows the thermistor circuits to detect very small changes
in temperature, which could not be observed with an RTD or a thermocouple.
Thermistors are widely used in applications, which involve measurements in the range of
-60˚C to 15˚C. The resistance of thermistors ranges from 0.5 Ω to 0.75 M Ω. They exhibit
highly non-linear characteristics of resistance versus temperature [Sonnewald, 1998].

2.4.1.1 Construction

They are composed of sintered mixture of metallic oxides such as manganese,

nickel, cobalt, copper, iron and uranium. They are available in variety of sizes and

shapes. They may be in the form of leads, rods and discs.

2.4.1.2 Resistance-temperature characteristics:

RT1=RT2 exp [β (1/T1 – 1/T2)] … (2.1)


where
RT1 = Resistance of thermistor at absolute temp T1 (K)
RT2 = Resistance of the thermistor at absolute temp T2 (K)
β = A constant depending upon the material of thermistor
The above characteristics show that the thermistor has a very high negative temperature

co-efficient of resistance, making it an ideal temperature transducer.

2.4.1.2 Working

xvi
A thermistor produces a large change of resistance with a small change in the

temperature being measured. This large sensitivity of thermistor provides good accuracy

and resolution. A typical industrial-type thermistor with a 2000 Ώ resistance at 25˚C and

a resistance temperature coefficient of 3.9% per ˚C exhibits a change of 78 Ώ per degree

celsius change in temperature.

A simple temperature control circuit is constructed using comparator and relay.


Any change in temperature causes a change in resistance of thermistor and an unbalance
voltage is fed to an op-amp whose output excites relay coil. The relay contacts are used to
control the current in the circuit, which generates the heat.

2.4.1.3 Features of Thermistors

∗ Thermistors are compact, rugged and inexpensive


∗ Thermistors when properly aged, have good stability
2.4.1.4 Circuit diagram of fire detection loop

The circuit diagram of fire detection loop is given in Fig. 2.4.

Fig 2.4 Circuit diagram of Fire Detection loop

2.4.1.5 Block diagram of fire detection loop

The block diagram of fire detection loop is shown in the Fig. 2.5.

xvii
Fig. 2.5 Block diagram of Fire Detection Loop

2.5 INTRUDER DETECTION


2.5.1 IR Transmitter

Infrared transmission is placed on one side and the transmitter is placed on other

side. When there is an intrusion, the path of propagation is disturbed and a signal is sent

to the microcontroller, which in turn raises an alarm based upon the logic given to it.

2.5.2 Block diagram of intruder detection loop


The block diagram of intruder detection loop is shown in the Fig. 2.6.

xviii
Fig. 2.6 Block diagram of Intruder Detection Loop

2.5.3 Circuit diagram of IR transmitter

The circuit diagram of IR transmitter is shown in the Fig. 2.7.

Fig. 2.7 Circuit Diagram of IR Transmitter

xix
2.5.4 Circuit diagram of IR receiver

The circuit diagram of IR receiver is shown in the Fig.2.8.

Fig. 2.8 Circuit diagram of IR Receiver

CHAPTER 3
SIGNAL CONDITIONING CIRCUIT

3.1 ANALOG TO DIGITAL CONVERTER (ADC)


Tracking A/D converter is a device commonly used in control system. Here an up

down-counter controls the DAC and the clock pulses are directed to pertinent counter

xx
input depending on whether the D/A output must increase or decrease to reach the analog

input voltage.

The obvious advantage of the A/D converter is that it can continuously follow the
input signal and give updated digital output data if the signal does not change too rapidly.
Also, for small input changes, the conversion can be quite fast. The converter can be
operated in either the track or hold modes by a digital input control.
The block diagram of a successive approximation register (SAR) is shown. It
consists of a DAC, as comparator, and a successive approximation register. One terminal
is required for analog input voltage. The digital output is available in either serial or
parallel form. A minimum of three-control terminal is required. Start of conversion
(SOC) initiates an A/D conversion and End of conversion (EOC) tells when the
conversion is completed. An external clock terminal sets the time to complete each
conversion.
3.2 BLOCK DIAGRAM OF ADC CIRCUIT
The block diagram of the ADC circuit is shown in the Fig. 3.1.

xxi
Fig. 3.1 Block diagram of ADC Circuit

CHAPTER 4
POWER SUPPLY

Most electronic circuits need a source of D.C. power. For our device a simple
power supply is sufficient where the input voltage is converted to D.C. through full wave
rectification.

4.1 POWER SUPPLY COMPONENTS

The power supply unit consists of


∗ Transformer

xxii
∗ Bridge rectifier
∗ Voltage regulators
∗ Filter circuit

4.1.1 Transformer

When A.C. is applied to the primary winding of the power transformer it can
either be stepped down or up depending on the value of the D.C. needed. In our circuit
the transformer performs the step-down operation where the 230V A.C. appears as 12V
A.C. across the secondary winding (practically as 15V A.C.). One alteration of the input
voltage will cause the top of the transformer to be positive and the bottom negative. The
next alteration will cause the polarity reverse. The current rating of the transformer used
in this project is 1A.

4.1.2 Bridge Rectifier

A commonly used circuit for supplying large amounts of DC power is the bridge
rectifier. In this rectifier configuration, we have used four diodes. Two diodes will
conduct during the negative alternation and two will conduct during positive alternation.
The bridge transformer is used in the half wave rectifier. The DC output voltage
appearing across the output of the bridge circuit will be somewhat less than 90% of the
applied R.M.S. value. A boosting capacitor is provided for boosting the DC voltage.

4.1.3 Voltage Regulator

Due to the fluctuation in the supply we need a regulator to provide a constant


voltage of 5V. The IC regulator 7805 produces a constant voltage of 5V and IC Regulator
7812 produces a constant voltage of 12V for a given input ranging from 17.5V to 7.5V.
The DC output produced will be a unidirectional pulsating current with a ripple
frequency of 120Hz.

4.1.4 Filter Circuit

xxiii
ICs are always followed by filter circuit which is usually a capacitor acting as a
surge arrester. This capacitor, also called as a DC coupling capacitor or bypassing
capacitor, is used to short the ripple with frequency of 120 Hz to ground but leave the DC
frequency to appear at the output. The load resistor R is connected so that a reference to
the ground is maintained. The load resistor should be 1% to 2.5% of the load.

4.2 CIRCUIT DIAGRAM OF POWER SUPPLY

The circuit diagram of power supply circuitry is shown in the Fig. 4.1.

Fig. 4.1 Circuit Diagram of Power Supply Circuitry

CHAPTER 5
MICROCONTROLLER

xxiv
5.1 ATMEL 89C51

The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer


with 4K bytes of flash programmable and erasable read only memory (PEROM). The
device is manufactured using Atmel’s high-density nonvolatile memory technology and
is compatible with the industry-standard MCS-51 instruction set and pin out. The on-chip
Flash allows the program memory to be reprogrammed in-system or by a conventional
nonvolatile memory programmer. By combining a versatile 8-bit CPU with flash on a
monolithic chip, the ATMEL AT89C51 is a powerful microcomputer, which provides a
highly flexible and cost-effective solution to many embedded control applications.
The AT89C51 provides the following standard features: 4K bytes of flash, 128
bytes of RAM, 32 I/O lines, 16-bit timers/counters, a five vector two-level interrupt
architecture, full duplex serial port, on-chip oscillator and clock circuitry. In addition, the
AT89C51 is designed with static logic for operation down to zero frequency and supports
two software selectable power saving modes. The Idle Mode stops the CPU while
allowing the RAM, timer/counters, serial port and interrupt system to continue
functioning. The Power-down Mode saves the RAM contents but freezes the oscillator
disabling all other chip functions until the next hardware reset.

5.1.1 Pin Description

5.1.1.1 VCC
Supply voltage to the microcontroller is 5V.

5.1.1.2 GND
Supply voltage to the microcontroller is 0V.

5.1.1.3 Port 0

Port 0 is an 8-bit open-drain bi-directional I/O port. As an output port, each pin
can sink eight TTL inputs. When 1s are written to Port 0 pins, the pins can be used as

xxv
high impedance inputs. Port 0 may also be configured to be the multiplexed low order
address/data bus during accesses to external program and data memory. In this mode Port
0 has internal pull-ups. Port 0 also receives the code bytes during flash programming, and
outputs the code bytes during program verification. External pull-ups are required during
program verification.

5.1.1.4 Port 1

Port 1 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 1 output
buffers can sink/source four TTL inputs. When 1s are written to Port 1 pins they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 1 pins that
are externally being pulled low will source current (IIL) because of the internal pull-ups.
Port 1 also receives the low-order address bytes during Flash programming and
verification.

5.1.1.5 Port 2

Port 2 is an 8-bit bi-directional I/O port with internal pull-ups. The Port 2 output
buffers can sink/source four TTL inputs. When 1s are written to Port 2 pins they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, port 2 pins that
are externally being pulled low will source current (IIL) because of the internal pull-ups.
Port 2 emits the high-order address byte during fetches from external program memory
and during accesses to external data memory that uses 16-bit addresses (MOVX
@DPTR). In this application, it uses strong internal pull-ups when emitting 1s. During
accesses to external data memory that uses 8-bit addresses (MOVX @ RI), Port 2 emits
the contents of the Port 2 Special Function Register. Port 2 also receives the high-order
address bits and some control signals during Flash programming and verification.

5.1.1.6 Port 3

Port 3 is an 8-bit bi-directional I/O port with internal pull-ups. Port 3 output
buffers can sink/source four TTL inputs. When 1s are written to Port 3 pins they are
pulled high by the internal pull-ups and can be used as inputs. As inputs, Port 3 pins that

xxvi
are externally being pulled low will source current (IIL) because of the pull-ups. Port 3
also receives some control signals for Flash programming and verification.

5.1.1.7 RST

This is Reset input (RST). A high on this pin for two machine cycles while the
oscillator is running resets the device.

5.1.1.8 ALE/PROG

Address Latch Enable (ALE) output pulse for latching the low byte of the address
during accesses to external memory. This pin is also the program pulse input (PROG)
during flash programming. In normal operation ALE is emitted at a constant rate of 1/6
the oscillator frequency, and may be used for external timing or clocking purposes.

5.2 PROGRAMMING

The AT89C51 is normally with the on-chip flash memory array in the erased state
(that is, contents = FFH) and ready to be programmed. The programming interface
accepts either a high-voltage (12V) or a low-voltage (VCC) program enable signal. The
low-voltage programming mode provides a convenient way to program the ATMEL
89C51 inside the user’s system, while the high-voltage programming mode is compatible
with conventional third party Flash or EPROM programmers. The AT89C51 is made
with either the high-voltage or low-voltage programming mode enabled. The AT89C51
code memory array is programmed byte by byte in either programming mode. To
program any nonblank byte in the on-chip Flash Memory, the entire memory must be
erased using the Chip Erase Mode.

5.2.1 Programming Algorithm

5.2.1.1 Data Polling

xxvii
The AT89C51 features data polling to indicate the end of a write cycle. During a
write cycle, an attempted read of the last byte written will result in the complement of the
written datum on Port 0.7. Once the write cycle has been completed, true data are valid
on all outputs, and the next cycle may begin. Data polling may begin any time after a
write cycle has been initiated.

5.2.1.2 Ready/Busy

The progress of byte programming can also be monitored by the RDY/BSY output signal. Port 3.4
pulled low after ALE goes high during programming to indicate BUSY. Port 3.4 is pulled high again wh
programming is done to indicate READY.

5.2.1.3 Program Verify

If lock bits LB1 and LB2 have not been programmed, the programmed code data
can be read back via the address and data lines for verification. The lock bits cannot be
verified directly. Verification of the lock bits is achieved by observing that their features
are enabled.

5.2.1.4 Chip Erase

The entire flash array is erased electrically by using the proper combination of
control signals and by holding ALE/PROG low for 10 ms. The code array is written with
all “1”s. The chip erase operation must be executed before the code memory can be re-
programmed.

5.2.1.5 Reading the Signature Bytes

The signature bytes are read by the same procedure as a normal verification of
locations 030H, 031H, and 032H, except that P3.6 and P3.7 must be pulled to logic low.
The values returned are as follows.
(030H) = 1EH indicates manufactured by Atmel
(031H) = 51H indicates 89C51

xxviii
(032H) = FFH indicates 12V programming
(032H) = 05H indicates 5V programming

5.2.2 Programming Interface

Every code byte in the Flash array can be written and using the appropriate combination of cont
signals can erase the entire array. The write operation cycle is self timed and once initiated, w
automatically time itself to completion. All major programming vendors offer worldwide support for
ATMEL microcontroller series.

5.2.3 AT89C51 In-Circuit Programming

This illustrates the in-circuit programmability of the ATMEL AT89C51 Flash-


based microcontroller. A method is then shown which can reprogram the AT89C51
microcontroller in the application remotely, over a commercial telephone line. The
circuitry described here supports 5V programming only, requiring the use of an
AT89C51. The standard AT89C51 requires 12V for programming.

5.2.4 General Considerations

Circuitry added to support AT89C51 in circuit programming should appear


transparent to the application when programming is not taking place.
EA/VPP must be held high during programming. In applications that do not utilize
external program memory, this pin may be permanently strapped to VCC. Applications
utilizing external program memory require that this pin be held low during normal
operation. RST must be held active during programming. A means must be provided for
overriding the application reset circuit, which typically asserts RST only briefly after
power is applied. PSEN must be held low during programming, but must not be driven
during normal operation. ALE/PROG is pulsed low during programming. But must not
be driven during normal operation. During programming, AT89C51 I/O ports are used
for the application of mode select, addresses and data, possibly requiring that the
controller be isolated from the application circuitry.

xxix
5.2.4.1 Port Used for Input

During programming, the controller must be isolated from signals sourced by the
application circuitry. A buffer with three state outputs might be inserted between the
application circuitry and the controller, with the buffer outputs three stated when
programming is enabled. Alternately, a multiplex might be used to select between signal
sources, with signals applied to the controller by either the application circuitry or the
programmer circuitry.

5.2.4.2 Port Used for Output

No circuit changes are required if the application circuitry can tolerate the state
changes which occur at the port during programming. If the prior state of the application
circuitry must be maintained during programming, a latch might be inserted between the
controller and the application circuitry. The latch is enabled during programming,
preserving the state of the application circuitry. Programming requires programmer
access to all of the four AT89C51 I/O ports. The programmer generates the addresses,
data and control signals necessary to program the AT89C51 embedded in the application.
The programmer circuitry consists of an AT89C51 and an RS-232 level translator. The
controller runs at 11.0592 MHz, which allows the serial port to operate at a number of
standard baud rates. A Maxim MAX232 line driver/receiver produces RS-232 levels at
the serial interface while requiring only a 5V supply. Many of the signals generated by
the programmer are connected directly, without buffering, to the AT89C51 in the
application. These signals, when inactive, are pulled high. The AT89C51 has internal
pull-ups of approximately 3 Ω on ports one, two and three. Because port zero does not
have internal pull-ups, external pull-ups of 10 Ω have been added to permit proper
operation of program verification mode. The sample application operates correctly in this
environment. If required for compatibility with an application, programmer signals may
be buffered with three-state buffers. The AT89C51 in the programmer does not utilize
external program or data memory, which would require sacrificing needed I/O pins. This
requires that program code and I/O buffers be kept small enough to fit in on-chip
memory.

5.2.5 Pin diagram of the microcontroller

xxx
The pin diagram of the microcontroller ATMEL 89C51 is shown in the Fig. 5.1.

Fig. 5.1 Pin


diagram of
ATMEL 89C51 Microcontroller

5.2.6 Control blocks of the microcontroller

The block diagram of the microcontroller is shown in the Fig. 5.2.

xxxi
5.2 Control blocks of Microcontroller

5.2.7 Timer operations

The timer operations of the microcontroller are tabulated in tables 5.1, 5.2 and 5.3
respectively.

Table 5.1 Microcontroller Timer Operation 1


SFR NAME DESCRIPTION SFR ADDRESS
TH0 Timer 0 High Byte 8CH
TLO Timer 0 Low byte 8AH
TH1 Timer 1 High byte 8DH
TL1 Timer1 Low byte 8BH
TCON Timer control 88H

Table 5.2 Microcontroller Timer Operation 2


Description of
TxM1 TxM0 Timer Mode
Mode
0 1 1 13 BIT TIMER
0 0 2 16 BIT TIMER
1 1 3 AUTO RELOAD

Table 5.3 Microcontroller Timer Operation 3


INSTRUCTION OPERATION PERFORMED
MOV TL0, #01 Low byte of 19,457 (19,456 + 1 = 19,457)
MOV TMOD, #01 Put Timer 0 in 16-bit mode
SETB TR0 Make Timer 0 start counting
JNB TF0, $ If TF0 is not set, jump back to this instruction.

xxxii
CHAPTER 6

RELAYS

6.1 INTRODUCTION

A relay is used to isolate one electrical circuit from another. It allows a low
current control circuit to make or break an electrically isolated high current circuit path.
The average remote lead can only handle about one half of an amp of current. If a circuit
with a large amount of current must be controlled by the remote output lead of a head
unit, a relay could be used to buffer the remote output from the head unit. The basic relay
consists of a coil and a set of contacts. The most common relay coil is a length of magnet
wire wrapped around a metal core.

6.1.1 Diagram of a General Relay

The diagram of a general relay is shown in the Fig. 6.1.

6.1 Diagram of a General Relay

6.2 TYPES OF RELAYS

6.2.1 SPST Relay

xxxiii
This is a Single Pole Single Throw relay. Current will only flow through the

contacts when the relay coil is energized. The diagram of SPST relay is shown in the Fig

6.2.

6.2 SPST Relay

6.2.2 SPDT Relay

This is a Single Pole Double Throw relay. Current will flow between the movable
contact and one fixed contact when the coil is de-energized and between the movable
contact and the alternate fixed contact when the relay coil is energized. The diagram of
SPDT relay is shown in the Fig.6.3.

Fig. 6.3 SPDT Relay


6.2.3 DPST Relay

This is a Double Pole Single Throw relay. When the relay coil is energized, two
separate and electrically isolated sets of contacts are pulled down to make contact with
their stationary counterparts. There is no complete circuit path when the relay is de-
energized. The diagram of DPST relay is shown in the Fig. 6.4.

xxxiv
Fig. 6.4 DPST Relay
6.2.4 DPDT Relay

This relay is a Double Pole Double Throw relay. It operates like the SPDT relay
but has twice as many contacts. There are two completely isolated sets of contacts. The
diagram of DPDT relay is shown in the Fig 6.5.

Fig. 6.5 DPDT Relay

6.3 APPLICATIONS OF RELAYS

A relay is used to isolate one electrical circuit from another. It allows a low
current control circuit to make or break an electrically isolated high current circuit path.
The average remote lead can only handle about one half of an amp of current. If a circuit
with a large amount of current must be controlled by the remote output lead of a head
unit, a relay could be used to buffer the remote output from the head unit.

xxxv
CHAPTER 7

MICROCONTROLLER BASED INDUSTRIAL SAFETY AND SECURITY SYSTEMS

7.1 OVERVIEW OF THE PROJECT


In this project we are monitoring and detecting five critical parameters namely

1) Temperature
2) Smoke
3) Fire
4) Intruder and
5) Level

Temperature sensor used in this project is LM 35 sensor. According to the rise


and fall in temperatures, the heating element is made on or off. Smoke sensor is
APOLLO made series 60 optical detector. When smoke enters the chamber, it scatters
photons on to the photodiode to excite it into activity. The LED then emits light at 2-
second intervals. If light is scattered on to the photodiode due to the presence of smoke,
the detector will change into the alarm state and the microcontroller will take the
corresponding control action. Fire is detected by means of fire detectors, which mainly
incorporate two thermistors. If the air temperature increases rapidly an alarm is initiated
so that the microcontroller will take the corresponding control action. In intruder
detection, IR receiver is placed on one side and the transmitter is placed on other side.
When there is an intrusion, the path of propagation is disturbed and a signal is sent to the
microcontroller, which in turn raises an alarm based upon the logic given to it. For water
level detection the water level in a tank is monitored using a suitable sensor. So when the
water reaches low level, a control signal is sent to activate the motor and as soon as water
reaches the high level another control signal is being sent to stop the motor.
Microcontroller used in this project is ATMEL 89C51, which is a flash memory
reprogrammable microcontroller. A/D converter is also used as a signal conditioning
element. This project is mainly implemented in industries to sense the critical parameters
and to control the same. By implementing this project the critical parameters are
monitored continuously and the alarm signal is given for indication and the control action
is also performed. This project is also a real time application and monitoring system.

xxxvi
7.2 BLOCK DIAGRAM OF THE ENTIRE PROJECT

The circuit diagram of the entire project is shown in Fig. 7.1.

Fig. 7.1 Block Diagram of the Entire Project

xxxvii
CHAPTER 8

RESULTS AND CONCLUSION

8.1 RESULT OF THE DESIGN

8.1.1 Speed of Execution

The speed of the execution is 564 ms. If a particular sensor is enabled, the LCD
screen will output a * symbol before the sensor name. User can also set the alert
temperature, enable/disable voice or buzzer alarm, and even specify the ring tone and
frequency of the buzzer alarm and the time before voice alarm goes off. The button de-
bounce scheme also works fine so users can navigate through the menu and use the
keypad perfectly.

8.1.2 Accuracy

After the user enables the security system, the green status LED will be lit to
indicate the system status. User can now enter proper password to unlock the system. If
any sensor goes wrong, the LCD will output ERROR and with proper initial for the
sensor (T for temperature, M for motion, S for smoke, D for door or window magnetic
switch). The red led light will flash at 4 Hz to indicate such an event. If the buzz alarm is
enabled, it will sound the tone that user choose. If the voice alarm is enabled, it will wait
for few seconds (user specified), if the system is still not locked, then it will start playing
voice to indicate which sensor had gone wrong. (For example, “Temperature Error,
please check and unlock the security system.”). If another sensor goes wrong after that,
the system will also act accordingly and indicate that in the voice alert in addition to the
LCD screen. (“Temperature Motion Error, please check and unlock the security
system.”).

8.1.3 Safety

xxxviii
There are two kinds of smoke detectors, ionization chamber and photoelectric
smoke detectors. Our detector is optical type. So there is no concern for any radiation
coming from our detector.

8.1.4 Usability

Our home security system is very practical. It can be used not only in the home
environment but also in a business environment too. It can monitor the surrounding to not
only protect our properties but also our lives. Besides, it can be highly customized to suit
one's need and preference. So our security system is very useful for us as well as other
people. We believe every house in the world should equip a security system like the one
we have designed.

8.2 EXPECTATION AND IMPROVEMENT

The result of our design has met our expectation, in which every sensor is
working and will sound specific alarm when the system goes into alert status. The keypad
and LCD also offer great interface and users can be familiar with our system in less than
few seconds. If we have chance to design this project again, we will add a phone dialer
chip like the Zarlink MT8880C we had mentioned before. By doing so, we can make sure
that if no one is at home or if no one is around the area, someone else can be notified to
take immediate action. In addition, we feel like our PORT B is a little bit wasted.
Besides, we will like to have another small microcontroller at a higher frequency, so we
can output our buzz alarm at a higher frequency tone.

8.3 CONCLUSION

This project is done mainly considering safety and security of the equipments and
the industry. The heart of this project is a microcontroller, which does all the activities
like monitoring, displaying and controlling the given parameters. In this project we have
monitored and controlled the five critical parameters like intruder, water level,
temperature, smoke and fire. This project can also monitor and control more than five
parameters by adding more number of interfacing circuits and control units. This project
can be used for domestic purpose as well as industrial usage. The main advantage of this
project is simple and easy method of controlling and it requires very low voltage for its

xxxix
operation and also faster in controlling the input parameters. So with this project can safe
guard the equipments and prevent heavy loses. Also, it guards the work place and
improves the safety and security of the industry.

CHAPTER 9

APPENDIX

9.1 PROGRAM CODE FOR OPERATION

#include "reg52.h"
#include "stdio.h"
#include "string.h"
data unsigned char temp;
data unsigned char val;
char line1[16];
char line2[16];

sbit RS = P3^2;
sbit RW = P3^3;
sbit EN = P3^4;
sbit BF = P1^7;
sbit ADCSC = P3^5;

// inputs

sbit intr = P0^5;


sbit low = P0^6;
sbit high = P0^7;
sbit smoke = P3^7;
sbit heat = P3^6;

sbit inc = P3^0;


sbit dec = P3^1;

xl
// outputs

sbit heating = P0^0;


sbit blower = P0^1;
sbit pump = P0^2;
sbit flash = P0^3;
sbit alarm = P0^4;

void dely(void)
{
int j;
for(j=0;j<5000;j++);
}
void delay(void)
{
int j;
for(j=0;j<10000;j++);
}
void lcdready(void)
{
EN=0;
P1=0xff;
RS=0;
RW=1;
while(BF==1)
{
EN=0;
EN=1;
}
EN=0;
}

void command(unsigned char lcddata)

xli
{
lcdready();
P1=lcddata;
RS=0;
RW=0;
EN=1;
EN=0;

void display(unsigned char lcddata)


{
lcdready();
P1=lcddata;
RS=1;
RW=0;
EN=1;
EN=0;
}

lcddisplay(char *buff1,char *buff2,int x)


{

data char value;


int len1,i,len2;
len1=strlen(buff1);
len2=strlen(buff2);
value=0x3c;
command(value);
value=0x0e;
command(value);
value=0x06;
command(value);
value=0x01;

xlii
command(value);
value=0x80;
command(value);
for(i=0;i<len1;i++)
{
value=buff1[i];
display(value);
if(x==1)
delay();
}
value=0xc0;
command(value);
for(i=0;i<len2;i++)
{
value=buff2[i];
display(value);
if(x==1)
delay();

}
}

void main()

{
int sp=40;
int ap=32;
pump = 0;
blower = 0;
heating = 0;
alarm = 0;
flash = 0;

lcddisplay(" S.R.M ENGG "," COLLEGE ",1);

xliii
delay();
lcddisplay(" INDUSTRIAL"," SAFETY SYSTEM",1);
delay();
lcddisplay("This Project ","is Done by ",1);
delay();
lcddisplay(" C.SUBRAMANI ","R.RAGHAVENDRAN ",1);
delay();
lcddisplay(" AND "," K.MURUGAN ",1);
for(;;)
{
P2 = 0xff;
ADCSC=0;
dely();
ADCSC=1;
temp=P2;
ap=(int)temp;
sprintf(line1,"Zone Temp:%d'C",ap = (int)(ap/5)*3);
sprintf(line2,"Set Point:%d'C ", sp );
delay();
lcddisplay(line1,line2,0);
delay();
if(sp < ap)
{
heating = 0;
}
if((sp-5)> ap)
{
blower = 1;
}
if((sp - 10) > ap)
{
heating = 1;
}

inc = 1;

xliv
if(inc == 0)
{
sp++;
if(sp >= 60)
sp = 30;
inc = 1;
while (inc==0);

dec = 1;
if(dec == 0)
{
sp--;
if(sp < 30)
sp = 60;
dec = 1;
while (dec==0);
}

low = 1;
high = 1;
if(low == 1 && high == 1)
{
pump = 1;
lcddisplay("Level","Low",1);
}

if(high == 0 && low ==0 )


{
pump = 0;
}

xlv
intr = 1;
dely();
if(intr ==1)
{
alarm = 1;
lcddisplay("INTRUDER","ALARM ENABLE",1);

while(inc==1)
{
inc =1;
}
alarm = 0;
lcddisplay("INTRUDER","ALARM DISABLE",1);
}

heat = 1;
dely();

if(heat == 0)
{
flash = 1;
lcddisplay("FIRE ALARM ","ENABLE",1);
inc = 1;
while(inc == 1)
{
inc=1; }
flash = 0;
lcddisplay("FIRE ALARM ","DISABLE",1);
}

smoke = 1;
dely();
if(smoke == 0)

{
flash = 1;

xlvi
lcddisplay("SMOKE ALARM ","ENABLE",1);
inc = 1;
while(inc == 1)
{
inc=1;
}

flash = 0;
lcddisplay("SMOKE ALARM ","DISABLE",1);
}

}
}

This program was initially done in C and loaded into the microcontroller using

Keil compiler.

xlvii
CHAPTER 10
REFERENCES

10.1 WEB REFERENCES


1. EPA - Smoke Detector and Radiation
http://www.epa.gov/radiation/sources/smoke_alarm.htm

2. LM34 specification
http://instruct1.cit.cornell.edu/courses/ee476/labs/s2004/LM34. pdf

10.2 TEXT BOOK REFERENCES

1. Blintliff R.L, (1992) “The Corporate Manual of Corporate and Industrial


Security”, Prentice Hall, London.

2. Fischer R.J and Green.G, (1998) “Introduction to Security”, Sixth edition,


Buttenworth-Heinemann, Boston.

3. Northcutt and Novak, (2001) “Network Intrusion and Detection –An Analysts
Handbook”, 2nd Edition, New Riders.

4. Ross Anderson, (2004) “Security Engineering-A Guide to Building


Dependable Distributed Systems”, Wiley and Sons, USA.

5. Sennewald C.A, (1998) “Effective Security Management”, 3rd Edition,


Buttenworth-Heinemann, Boston.

xlviii

You might also like