SlideShare ist ein Scribd-Unternehmen logo
1 von 74
ABSTRACT


       Security is primary concern for every one. This Project describes a design of
effective security alarm system that can monitor an industry with different sensors.
Unauthorized access, Temperature increment, IR detection can be monitored by the status
of each individual sensor. Obviously, this burglar alarm also has an input to 'arm' the
alarm, a tamper input and a couple of outputs to control a siren and Auto dialing system.
The alarm is also fitted with a so-called 'panic button'.

       The burglar alarm is built around the 8051 micro controller from Atmel. This
micro controller provides all the functionality of the burglar alarm. It also takes care of
filtering of the signals at the inputs. Only after an input has remained unchanged for 30
milliseconds, is this new signal level passed on for processing by the micro controller
program. This time can be varied by adopting small changes in the source code.

       A maximum of 5 sensors can be connected to the burglar alarm. These sensors
need to have their contacts closed when in the inactive state (i.e. Normally Closed). In
addition, each sensor needs to have its tamper connection wired as well. A power supply
voltage of +5 VDC is available for each sensor at the corresponding wiring terminals.


       The uniqueness of this project is not only alerting the neighbors by siren, it also
dials a mobile number which is already programmed into the system. A mobile number
or a land line number can be programmed into the system. As this system works on
existing telephone line, it can dial the number even the subscriber is out of station.


      This project uses regulated 5V, 500mA power supply. 7805 three terminal voltage
regulator is used for voltage regulation. Bridge type full wave rectifier is used to rectify
the ac out put of secondary of 230/12V step down transformer.
INTRODUCTION
Security is the condition of being protected against danger or loss. In the general sense,
security is a concept similar to safety. The nuance between the two is an added emphasis
on being protected from dangers that originate from outside. Individuals or actions that
encroach upon the condition of protection are responsible for the breach of security. The
word "security" in general usage is synonymous with "safety," but as a technical term
"security" means that something not only is secure but that it has been secured. One of
the best options for providing good security is by using a technology named
EMBEDDED SYSTEMS.


INTRODUCTION TO EMBEDDED SYSTEMS


      An embedded system can be defined as a computing device that does a specific
focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer,
fax machine, mobile phone etc. are examples of embedded systems. Each of these
appliances will have a processor and special hardware to meet the specific requirement of
the application along with the embedded software that is executed by the processor for
meeting that specific requirement. The embedded software is also called “firm ware”.
The desktop/laptop computer is a general purpose computer. You can use it for a variety
of applications such as playing games, word processing, accounting, software
development and so on. In contrast, the software in the embedded systems is always fixed
listed below:
· Embedded systems do a very specific task, they cannot be programmed to do different
things. . Embedded systems have very limited resources, particularly the memory.
Generally, they do not have secondary storage devices such as the CDROM or the floppy
disk. Embedded systems have to work against some deadlines. A specific job has to be
completed within a specific time. In some embedded systems, called real-time systems,
the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of life or
damage to property. Embedded systems are constrained for power. As many embedded
systems operate through a battery, the power consumption has to be very low.
· Some embedded systems have to operate in extreme environmental conditions such as
very high temperatures and humidity.


Application Areas
Nearly 99 per cent of the processors manufactured end up in embedded systems. The
embedded system market is one of the highest growth areas as these systems are used in
very market segment- consumer electronics, office automation, industrial automation,
biomedical     engineering,     wireless     communication,       data    communication,
telecommunications, transportation, military and so on.


Consumer appliances: At home we use a number of embedded systems which include
digital camera, digital diary, DVD player, electronic toys, microwave oven, remote
controls for TV and air-conditioner, VCO player, video game consoles, video recorders
etc. Today’s high-tech car has about 20 embedded systems for transmission control,
engine spark control, air-conditioning, navigation etc. Even wristwatches are now
becoming embedded systems. The palmtops are powerful embedded systems using which
we can carry out many general-purpose tasks such as playing games and word
processing.


Office automation: The office automation products using em embedded systems are
copying machine, fax machine, key telephone, modem, printer, scanner etc.


Industrial automation: Today a lot of industries use embedded systems for process
control. These include pharmaceutical, cement, sugar, oil exploration, nuclear energy,
electricity generation and transmission. The embedded systems for industrial use are
designed to carry out specific tasks such as monitoring the temperature, pressure,
humidity, voltage, current etc., and then take appropriate action based on the monitored
levels to control other devices or to send information to a centralized monitoring station.
In hazardous industrial environment, where human presence has to be avoided, robots are
used, which are programmed to do specific jobs. The robots are now becoming very
powerful and carry out many interesting and complicated tasks such as hardware
assembly.


Medical electronics: Almost every medical equipment in the hospital is an embedded
system. These equipments include diagnostic aids such as ECG, EEG, blood pressure
measuring devices, X-ray scanners; equipment used in blood analysis, radiation,
colonscopy, endoscopy etc. Developments in medical electronics have paved way for
more accurate diagnosis of diseases.


Computer networking: Computer networking products such as bridges, routers,
Integrated Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM),
X.25 and frame relay switches are embedded systems which implement the necessary
data communication protocols. For example, a router interconnects two networks. The
two networks may be running different protocol stacks. The router’s function is to obtain
the data packets from incoming pores, analyze the packets and send them towards the
destination after doing necessary protocol conversion. Most networking equipments,
other than the end systems (desktop computers) we use to access the networks, are
embedded systems
.
Telecommunications: In the field of telecommunications, the embedded systems can be
categorized as subscriber terminals and network equipment. The subscriber terminals
such as key telephones, ISDN phones, terminal adapters, web cameras are embedded
systems. The network equipment includes multiplexers, multiple access systems, Packet
Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP
gatekeeper etc. are the latest embedded systems that provide very low-cost voice
communication over the Internet.
Wireless technologies: Advances in mobile communications are paving way for many
interesting applications using embedded systems. The mobile phone is one of the marvels
of the last decade of the 20’h century. It is a very powerful embedded system that
provides voice communication while we are on the move. The Personal Digital Assistants
and the palmtops can now be used to access multimedia services over the Internet.
Mobile communication infrastructure such as base station controllers, mobile switching
centers are also powerful embedded systems.


Insemination: Testing and measurement are the fundamental requirements in all
scientific and engineering activities. The measuring equipment we use in laboratories to
measure parameters such as weight, temperature, pressure, humidity, voltage, current etc.
are all embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic
analyzer, protocol analyzer, radio communication test set etc. are embedded systems built
around powerful processors. Thank to miniaturization, the test and measuring equipment
are now becoming portable facilitating easy testing and measurement in the field by
field-personnel.


Security: Security of persons and information has always been a major issue. We need to
protect our homes and offices; and also the information we transmit and store.
Developing embedded systems for security applications is one of the most lucrative
businesses nowadays. Security devices at homes, offices, airports etc. for authentication
and verification are embedded systems. Encryption devices are nearly 99 per cent of
the processors that are manufactured end up in~ embedded systems. Embedded systems
find applications in . every industrial segment- consumer electronics, transportation,
avionics, biomedical engineering, manufacturing, process control and industrial
automation, data communication, telecommunication, defense, security etc. Used to
encrypt the data/voice being transmitted on communication links such as telephone lines.
Biometric systems using fingerprint and face recognition are now being extensively used
for user authentication in banking applications as well as for access control in high
security buildings.
Finance: Financial dealing through cash and cheques are now slowly paving way for
transactions using smart cards and ATM (Automatic Teller Machine, also expanded as
Any Time Money) machines. Smart card, of the size of a credit card, has a small micro-
controller and memory; and it interacts with the smart card reader! ATM machine and
acts as an electronic wallet. Smart card technology has the capability of ushering in a
cashless society. Well, the list goes on. It is no exaggeration to say that eyes wherever
you go, you can see, or at least feel, the work of an embedded system!




Overview of Embedded System Architecture
Every embedded system consists of custom-built hardware built around a Central
Processing Unit (CPU). This hardware also contains memory chips onto which the
software is loaded. The software residing on the memory chip is also called the
‘firmware’. The embedded system architecture can be represented as a layered
architecture as shown in Fig.
The operating system runs above the hardware, and the application software runs above




the operating system. The same architecture is applicable to any computer including a
desktop computer. However, there are significant differences. It is not compulsory to
have an operating system in every embedded system. For small appliances such as remote
control units, air conditioners, toys etc., there is no need for an operating system and you
can write only the software specific to that application. For applications involving
complex processing, it is advisable to have an operating system. In such a case, you need
to integrate the application software with the operating system and then transfer the entire
software on to the memory chip. Once the software is transferred to the memory chip, the
software will continue to run for a long time you don’t need to reload new software.
Now, let us see the details of the various building blocks of the hardware of an embedded
system. As shown in Fig. the building blocks are;
· Central Processing Unit (CPU)
· Memory (Read-only Memory and Random Access Memory)
· Input Devices
· Output devices
· Communication interfaces
· Application-specific circuitry




Central Processing Unit (CPU):
The Central Processing Unit (processor, in short) can be any of the following:
microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is
a low-cost processor. Its main attraction is that on the chip itself, there will be many other
components such as memory, serial communication interface, analog-to digital converter
etc. So, for small applications, a micro-controller is the best choice as the number of
external components required will be very less. On the other hand, microprocessors are
more powerful, but you need to use many external components with them. D5P is used
mainly for applications in which signal processing is involved such as audio and video
processing.




Memory:
The memory is categorized as Random Access 11emory (RAM) and Read Only Memory
(ROM). The contents of the RAM will be erased if power is switched off to the chip,
whereas ROM retains the contents even if the power is switched off. So, the firmware is
stored in the ROM. When power is switched on, the processor reads the ROM; the
program is program is executed.


Input devices:
Unlike the desktops, the input devices to an embedded system have very limited
capability. There will be no keyboard or a mouse, and hence interacting with the
embedded system is no easy task. Many embedded systems will have a small keypad-you
press one key to give a specific command. A keypad may be used to input only the digits.
Many embedded systems used in process control do not have any input device for user
interaction; they take inputs from sensors or transducers 1’fnd produce electrical signals
that are in turn fed to other systems.


Output devices:
The output devices of the embedded systems also have very limited capability. Some
embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health
status of the system modules, or for visual indication of alarms. A small Liquid Crystal
Display (LCD) may also be used to display some important parameters.


Communication interfaces:
The embedded systems may need to, interact with other embedded systems at they may
have to transmit data to a desktop. To facilitate this, the embedded systems are provided
with one or a few communication interfaces such as RS232, RS422, RS485, Universal
Serial Bus (USB), IEEE 1394, Ethernet etc.


Application-specific circuitry:
 Sensors, transducers, special processing and control circuitry may be required fat an
embedded system, depending on its application. This circuitry interacts with the
processor to carry out the necessary work. The entire hardware has to be given power
supply either through the 230 volts main supply or through a battery. The hardware has to
designed in such a way that the power consumption is minimized.




BLOCK DIAGRAM
DESCRIPTION
POWER SUPPLY:

The input to the circuit is applied from the regulated power supply. The a.c. input i.e.,
230V from the mains supply is step down by the transformer to 12V and is fed to a
rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to
get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any
a.c components present even after rectification. Now, this voltage is given to a voltage
regulator to obtain a pure constant dc voltage.




   230V AC
    50Hz                                                              D.C
                                                                      Output




 Step down                 Bridge
                                                  Filter              Regulator
 transformer               Rectifier


                               Fig: Power supply




Transformer:

       Usually, DC voltages are required to operate various electronic equipment and
these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus
the a.c input available at the mains supply i.e., 230V is to be brought down to the
required voltage level. This is done by a transformer. Thus, a step down transformer is
employed to decrease the voltage to a required level.
Rectifier:

          The output from the transformer is fed to the rectifier. It converts A.C. into
pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a
bridge rectifier is used because of its merits like good stability and full wave rectification.

Filter:

          Capacitive filter is used in this project. It removes the ripples from the output of
rectifier and smoothens the D.C. Output        received from this filter is constant until the
mains voltage and load is maintained constant. However, if either of the two is varied,
D.C. voltage received at this point changes. Therefore a regulator is applied at the output
stage.

Voltage regulator:
          As the name itself implies, it regulates the input applied to it. A voltage regulator
is an electrical regulator designed to automatically maintain a constant voltage level. In
this project, power supply of 5V and 12V are required. In order to obtain these voltage
levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents
positive supply and the numbers 05, 12 represent the required output voltage levels.




MICROCONTROLLERS:
Microprocessors and microcontrollers are widely used in embedded
systems products. Microcontroller is a programmable device. A microcontroller has a
CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on
a single chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in
microcontrollers makes them ideal for many applications in which cost and space are
critical.

        The Intel 8051 is Harvard architecture, single chip microcontroller (µC) which
was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s
and early 1990s, but today it has largely been superseded by a vast range of enhanced
devices with 8051-compatible processor cores that are manufactured by more than 20
independent manufacturers including Atmel, Infineon Technologies and Maxim
Integrated Products.

        8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data
at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the
CPU. 8051 is available in different memory types such as UV-EPROM, Flash and NV-
RAM.

        The present project is implemented on Keil Uvision. In order to program the
device, Proload tool has been used to burn the program onto the microcontroller.

        The features, pin description of the microcontroller and the software tools used
are discussed in the following sections.




FEATURES OF AT89s52:
•   8K Bytes of Re-programmable Flash Memory.
•   RAM is 256 bytes.
•   4.0V to 5.5V Operating Range.
•   Fully Static Operation: 0 Hz to 33 MHz’s
•   Three-level Program Memory Lock.
•   256 x 8-bit Internal RAM.
•   32 Programmable I/O Lines.
•   Three 16-bit Timer/Counters.
•   Eight Interrupt Sources.
•   Full Duplex UART Serial Channel.
•   Low-power Idle and Power-down Modes.
•   Interrupt recovery from power down mode.
•   Watchdog timer.
•   Dual data pointer.
•   Power-off flag.
•   Fast programming time.
•   Flexible ISP programming (byte and page mode).



Description:

The AT89s52 is a low-voltage, high-performance CMOS 8-bit microcomputer with 8K
bytes of Flash programmable memory. The device is manufactured using Atmel’s high
density nonvolatile memory technology and is compatible with the industry-standard
MCS-51 instruction set. The on chip flash allows the program memory to be
reprogrammed in system or by a conventional non volatile memory programmer. By
combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89s52 is a
powerful microcomputer, which provides a highly flexible and cost-effective solution to
many embedded control applications.
In addition, the AT89s52 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.




                               Fig: Pin diagram
Fig: Block diagram
PIN DESCRIPTION:



Vcc Pin 40 provides supply voltage to the chip. The voltage source is +5V.

GND Pin 20 is the ground.

Port 0

Port 0 is an 8-bit open drain bidirectional 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 high
impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/
data bus during accesses to external program and data memory. In this mode, P0 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.

Port 1

Port 1 is an 8-bit bidirectional 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. In
addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input
(P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in
the following table.

Port 1 also receives the low-order address bytes during Flash programming and
verification.
Port 2

Port 2 is an 8-bit bidirectional 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, Port 2 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 P2 Special Function Register. The port also receives the high-order
address bits and some control signals during Flash programming and verification.

Port 3

Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The 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 are
externally being pulled low will source current (IIL) because of the pull-ups. Port 3
receives some control signals for Flash programming and verification.

Port 3 also serves the functions of various special features of the AT89S52, as shown in
the following table.
RST

Reset input. A high on this pin for two machine cycles while the oscillator is running
resets the device. This pin drives high for 98 oscillator periods after the Watchdog times
out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In
the default state of bit DISRTO, the RESET HIGH out feature is enabled.

ALE/PROG

Address Latch Enable (ALE) is an 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. Note, however, that one ALE pulse
is skipped during each access to external data memory.

If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the
bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is
weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in
external execution mode.
PSEN

Program Store Enable (PSEN) is the read strobe to external program memory. When the
AT89S52 is executing code from external program memory, PSEN is activated twice
each machine cycle, except that two PSEN activations are skipped during each access to
external data memory.

EA/VPP

External Access Enable. EA must be strapped to GND in order to enable the device to
fetch code from external program memory locations starting at 0000H up to FFFFH.
Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset.

EA should be strapped to VCC for internal program executions. This pin also receives the
12-volt programming enable voltage (VPP) during Flash programming.

XTAL1

Input to the inverting oscillator amplifier and input to the internal clock operating circuit.

XTAL2

Output from the inverting oscillator amplifier.

Oscillator Connections




C1, C2 = 30 pF ± 10 pF for Crystals
       = 40 pF ± 10 pF for Ceramic Resonators

External Clock Drive Configuration
XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that
can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic
resonator may be used. To drive the device from an external clock source, XTAL2 should
be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle
of the external clock signal, since the input to the internal clocking circuitry is through a
divide-by-two flip-flop, but minimum and maximum voltage high and low time
specifications must be observed.




Special Function Registers

A map of the on-chip memory area called the Special Function Register (SFR) space is
shown in the following table.

It should be noted that not all of the addresses are occupied and unoccupied addresses
may not be implemented on the chip. Read accesses to these addresses will in general
return random data, and write accesses will have an indeterminate effect.

User software should not write 1s to these unlisted locations, since they may be used in
future products to invoke new features. In that case, the reset or inactive values of the
new bits will always be 0.



Timer 2 Registers:
Control and status bits are contained in registers T2CON and T2MOD for Timer 2. The
register pair (RCAP2H, RCAP2L) is the Capture/Reload register for Timer 2 in 16-bit
capture mode or 16-bit auto-reload mode.

Interrupt Registers:

The individual interrupt enable bits are in the IE register. Two priorities can be set for
each of the six interrupt sources in the IP register.
Dual Data Pointer Registers:

To facilitate accessing both internal and external data memory, two banks of 16-bit Data
Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H
and 85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user
should ALWAYS initialize the DPS bit to the appropriate value before accessing the
respective Data Pointer Register.

Power Off Flag:

The Power Off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set to
“1” during power up. It can be set and rest under software control and is not affected by
reset.
Memory Organization

MCS-51 devices have a separate address space for Program and Data Memory. Up to
64K bytes each of external Program and Data Memory can be addressed.

Program Memory

If the EA pin is connected to GND, all program fetches are directed to external memory.
On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H
through 1FFFH are directed to internal memory and fetches to addresses 2000H through
FFFFH are to external memory.

Data Memory

The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a
parallel address space to the Special Function Registers. This means that the upper 128
bytes have the same addresses as the SFR space but are physically separate from SFR
space.

When an instruction accesses an internal location above address 7FH, the address mode
used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM
or the SFR space. Instructions which use direct addressing access the SFR space.
For example, the following direct addressing instruction accesses the SFR at location
0A0H (which is P2).

                       MOV 0A0H, #data

Instructions that use indirect addressing access the upper 128 bytes of RAM. For
example, the following indirect addressing instruction, where R0 contains 0A0H,
accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H).

                       MOV @R0, #data

Note that stack operations are examples of indirect addressing, so the upper 128 bytes of
data RAM are available as stack space.




Watchdog Timer (One-time Enabled with Reset-out)
 The WDT is intended as a recovery method in situations where the CPU may be
subjected to software upsets. The WDT consists of a 14-bit counter and the Watchdog
Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To
enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register
(SFR location 0A6H).

When the WDT is enabled, it will increment every machine cycle while the oscillator is
running. The WDT timeout period is dependent on the external clock frequency. There is
no way to disable the WDT except through reset (either hardware reset or WDT overflow
reset). When WDT overflows, it will drive an output RESET HIGH pulse at the RST pin.
Using the WDT

       To enable the WDT, a user must write 01EH and 0E1H in sequence to the
WDTRST register (SFR location 0A6H). When the WDT is enabled, the user needs to
service it by writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit
counter overflows when it reaches 16383 (3FFFH), and this will reset the device. When
the WDT is enabled, it will increment every machine cycle while the oscillator is
running. This means the user must reset the WDT at least every 16383 machine cycles.

       To reset the WDT the user must write 01EH and 0E1H to WDTRST. WDTRST is
a write-only register. The WDT counter cannot be read or written. When WDT
overflows, it will generate an output RESET pulse at the RST pin. The RESET pulse
duration is 98xTOSC, where TOSC = 1/FOSC. To make the best use of the WDT, it
should be serviced in those sections of code that will periodically be executed within the
time required to prevent a WDT reset.



WDT during Power-down and Idle

In Power-down mode the oscillator stops, which means the WDT also stops. While in
Power down mode, the user does not need to service the WDT. There are two methods of
exiting Power-down mode: by a hardware reset or via a level-activated external interrupt
which is enabled prior to entering Power-down mode. When Power-down is exited with
hardware reset, servicing the WDT should occur as it normally does whenever the
AT89S52 is reset. Exiting Power-down with an interrupt is significantly different.

The interrupt is held low long enough for the oscillator to stabilize. When the interrupt is
brought high, the interrupt is serviced. To prevent the WDT from resetting the device
while the interrupt pin is held low, the WDT is not started until the interrupt is pulled
high. It is suggested that the WDT be reset during the interrupt service for the interrupt
used to exit Power-down mode.

To ensure that the WDT does not overflow within a few states of exiting Power-down, it
is best to reset the WDT just before entering Power-down mode.
Before going into the IDLE mode, the WDIDLE bit in SFR AUXR is used to determine
whether the WDT continues to count if enabled. The WDT keeps counting during IDLE
(WDIDLE bit = 0) as the default state. To prevent the WDT from resetting the AT89S52
while in IDLE mode, the user should always set up a timer that will periodically exit
IDLE, service the WDT, and reenter IDLE mode. With WDIDLE bit enabled, the WDT
will stop to count in IDLE mode and resumes the count upon exit from IDLE.




UART

The Atmel 80C51 Microcontrollers implement three general purpose, 16-bit timers/
counters. They are identified as Timer 0, Timer 1 and Timer 2 and can be independently
configured to operate in a variety of modes as a timer or as an event counter. When
operating as a timer, the timer/counter runs for a programmed length of time and then
issues an interrupt request. When operating as a counter, the timer/counter counts
negative transitions on an external pin. After a preset number of counts, the counter
issues an interrupt request. The various operating modes of each timer/counter are
described in the following sections.


A basic operation consists of timer registers THx and TLx (x= 0, 1) connected in cascade
to form a 16-bit timer. Setting the run control bit (TRx) in TCON register turns the timer
on by allowing the selected input to increment TLx. When TLx overflows it increments
THx; when THx overflows it sets the timer overflow flag (TFx) in TCON register.
Setting the TRx does not clear the THx and TLx timer registers. Timer registers can be
accessed to obtain the current count or to enter preset values. They can be read at any
time but TRx bit must be cleared to preset their values, otherwise the behavior of the
timer/counter is unpredictable.


The C/Tx# control bit (in TCON register) selects timer operation, or counter operation,
by selecting the divided-down peripheral clock or external pin Tx as the source for the
counted signal. TRx bit must be cleared when changing the mode of operation, otherwise
the behavior of the timer/counter is unpredictable. For timer operation (C/Tx# = 0), the
timer register counts the divided-down peripheral clock. The timer register is incremented
once every peripheral cycle (6 peripheral clock periods). The timer clock rate is FPER /
6, i.e. FOSC / 12 in standard mode or FOSC / 6 in X2 mode. For counter operation
(C/Tx# = 1), the timer register counts the negative transitions on the Tx external input
pin. The external input is sampled every peripheral cycle. When the sample is high in one
cycle and low in the next one, the counter is incremented.


Since it takes 2 cycles (12 peripheral clock periods) to recognize a negative transition,
the maximum count rate is FPER / 12, i.e. FOSC / 24 in standard mode or FOSC / 12 in
X2 mode. There are no restrictions on the duty cycle of the external input signal, but to
ensure that a given level is sampled at least once before it changes, it should be held for
at least one full peripheral cycle. In addition to the “timer” or “counter” selection, Timer
0 and Timer 1 have four operating modes from which to select which are selected by bit-
pairs (M1, M0) in TMOD. Modes 0, 1and 2 are the same for both timer/counters. Mode 3
is different.


The four operating modes are described below. Timer 2, has three modes of operation:
‘capture’, ‘auto-reload’ and ‘baud rate generator’.


Timer 0


Timer 0 functions as either a timer or event counter in four modes of operation.


Timer 0 is controlled by the four lower bits of the TMOD register and bits 0, 1, 4 and 5 of
the TCON register. TMOD register selects the method of timer gating (GATE0), timer or
counter operation (T/C0#) and mode of operation (M10 and M00). The TCON register
provides timer 0 control functions: overflow flag (TF0), run control bit (TR0), interrupt
flag (IE0) and interrupt type control bit (IT0).




For normal timer operation (GATE0= 0), setting TR0 allows TL0 to be incremented by
the selected input. Setting GATE0 and TR0 allows external pin INT0# to control timer
operation.


Timer 0 overflow (count rolls over from all 1s to all 0s) sets TF0 flag, generating an
interrupt request. It is important to stop timer/counter before changing mode.


Mode 0 (13-bit Timer)
Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit timer (TH0
register) with a modulo 32 prescaler implemented with the lower five bits of the TL0
register. The upper three bits of TL0 register are indeterminate and should be ignored.
Prescaler overflow increments the TH0 register.


As the count rolls over from all 1’s to all 0’s, it sets the timer interrupt flag TF0. The
counted input is enabled to the Timer when TR0 = 1 and either GATE = 0 or INT0 = 1.
(Setting GATE = 1 allows the Timer to be controlled by external input INT0, to facilitate
pulse width measurements). TR0 is a control bit in the Special Function register TCON.
GATE is in TMOD.


The 13-bit register consists of all 8 bits of TH0 and the lower 5 bits of TL0. The upper 3
bits of TL0 are indeterminate and should be ignored. Setting the run flag (TR0) does not
clear the registers.


Mode 0 operation is the same for Timer 0 as for Timer 1. There are two different GATE
bits, one for Timer 1 (TMOD.7) and one for Timer 0 (TMOD.3).


Timer/Counter x (x = 0 or 1) in Mode 0
Mode 1 (16-bit Timer)
Mode 1 is the same as Mode 0, except that the Timer register is being run with all 16
bits. Mode 1 configures timer 0 as a 16-bit timer with the TH0 and TL0 registers
connected in cascade. The selected input increments the TL0 register.


Timer/Counter x (x = 0 or 1) in Mode 1




Mode 2 (8-bit Timer with Auto-Reload)
Mode 2 configures timer 0 as an 8-bit timer (TL0 register) that automatically reloads
from the TH0 register. TL0 overflow sets TF0 flag in the TCON register and reloads TL0
with the contents of TH0, which is preset by software.


When the interrupt request is serviced, hardware clears TF0. The reload leaves TH0
unchanged. The next reload value may be changed at any time by writing it to the TH0
register. Mode 2 operation is the same for Timer/Counter 1.


Timer/Counter x (x = 0 or 1) in Mode 2
Mode 3 (Two 8-bit Timers)
Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8-bit timers.
This mode is provided for applications requiring an additional 8-bit timer or counter. TL0
uses the timer 0 control bits C/T0# and GATE0 in the TMOD register, and TR0 and TF0
in the TCON register in the normal manner. TH0 is locked into a timer function (counting
FPER /6) and takes over use of the timer 1 interrupt (TF1) and run control (TR1) bits.
Thus, operation of timer 1 is restricted when timer 0 is in mode 3.


Timer/Counter 0 in Mode 3: Two 8-bit Counters




Timer 1
Timer 1 is identical to timer 0, except for mode 3, which is a hold-count mode. The
following comments help to understand the differences:
• Timer 1 functions as either a timer or event counter in three modes of operation. Timer
1’s mode 3 is a hold-count mode.
• Timer 1 is controlled by the four high-order bits of the TMOD register and bits 2, 3, 6
and 7 of the TCON register. The TMOD register selects the method of timer gating
(GATE1), timer or counter operation (C/T1#) and mode of operation (M11 and M01).
The TCON register provides timer 1 control functions: overflow flag (TF1), run control
bit (TR1), interrupt flag (IE1) and interrupt type control bit (IT1).
• Timer 1 can serve as the baud rate generator for the serial port. Mode 2 is best suited for
this purpose.
• For normal timer operation (GATE1 = 0), setting TR1 allows TL1 to be incremented by
the selected input. Setting GATE1 and TR1 allows external pin INT1# to control timer
operation.
• Timer 1 overflow (count rolls over from all 1s to all 0s) sets the TF1 flag generating an
interrupt request.
• When timer 0 is in mode 3, it uses timer 1’s overflow flag (TF1) and run control bit
(TR1). For this situation, use timer 1 only for applications that do not require an interrupt
(such as a baud rate generator for the serial port) and switch timer 1 in and out of mode 3
to turn it off and on.
• It is important to stop timer/counter before changing modes.


Mode 0 (13-bit Timer)
Mode 0 configures Timer 1 as a 13-bit timer, which is set up as an 8-bit timer (TH1
register) with a modulo-32 prescaler implemented with the lower 5 bits of the TL1
register. The upper 3 bits of the TL1 register are ignored. Prescaler overflow increments
the TH1 register.


Mode 1 (16-bit Timer)
Mode 1 configures Timer 1 as a 16-bit timer with the TH1 and TL1 registers connected
in cascade. The selected input increments the TL1 register.


Mode 2 (8-bit Timer with Auto Reload)
Mode 2 configures Timer 1 as an 8-bit timer (TL1 register) with automatic reload from
the TH1 register on overflow. TL1 overflow sets the TF1 flag in the TCON register and
reloads TL1 with the contents of TH1, which is preset by software. The reload leaves
TH1 unchanged.
Mode 3 (Halt)
Placing Timer 1 in mode 3 causes it to halt and hold its count. This can be used to halt
Timer 1 when TR1 run control bit is not available i.e., when Timer 0 is in mode 3.


Timer 2
Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter.
The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 5-2).
Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud
rate generator. The modes are selected by bits in T2CON, as shown in Table 10-1. Timer
2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is
incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods,
the count rate is 1/12 of the oscillator frequency.




In the Counter function, the register is incremented in response to a 1-to-0 transition at its
corresponding external input pin, T2. In this function, the external input is sampled
during S5P2 of every machine cycle. When the samples show a high in one cycle and a
low in the next cycle, the count is incremented. The new count value appears in the
register during S3P1 of the cycle following the one in which the transition was detected.
Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0
transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure that a
given level is sampled at least once before it changes, the level should be held for at least
one full machine cycle.
Capture Mode

In the capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0,
Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON. This bit
can then be used to generate an interrupt. If EXEN2 = 1, Timer 2 performs the same
operation, but a 1-to-0 transition at external input T2EX also causes the current value in
TH2 and TL2 to be captured into RCAP2H and RCAP2L, respectively. In addition, the
transition at T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit, like TF2, can
generate an interrupt.




                                Timer in Capture Mode

Auto-reload (Up or Down Counter)
Timer 2 can be programmed to count up or down when configured in its 16-bit auto-
reload mode. This feature is invoked by the DCEN (Down Counter Enable) bit located in
the SFR T2MOD. Upon reset, the DCEN bit is set to 0 so that timer 2 will default to
count up. When DCEN is set, Timer 2 can count up or down, depending on the value of
the T2EX pin.
T2MOD – Timer 2 Mode Control Register

The above figure shows Timer 2 automatically counting up when DCEN = 0. In this
mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts
up to 0FFFFH and then sets the TF2 bit upon overflow. The overflow also causes the
timer registers to be reloaded with the 16-bit value in RCAP2H and RCAP2L. The values
in Timer in Capture ModeRCAP2H and RCAP2L are preset by software. If EXEN2 = 1,
a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at external
input T2EX. This transition also sets the EXF2 bit. Both the TF2 and EXF2 bits can
generate an interrupt if enabled.

Setting the DCEN bit enables Timer 2 to count up or down, as shown in Figure 10-2. In
this mode, the T2EX pin controls the direction of the count. A logic 1 at T2EX makes
Timer 2 count up. The timer will overflow at 0FFFFH and set the TF2 bit. This overflow
also causes the 16-bit value in RCAP2H and RCAP2L to be reloaded into the timer
registers, TH2 and TL2, respectively.

A logic 0 at T2EX makes Timer 2 count down. The timer underflows when TH2 and TL2
equal the values stored in RCAP2H and RCAP2L. The underflow sets the TF2 bit and
causes 0FFFFH to be reloaded into the timer registers.

The EXF2 bit toggles whenever Timer 2 overflows or underflows and can be used as a
17th bit of resolution. In this operating mode, EXF2 does not flag an interrupt.
Baud Rate Generator

Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON.
Note that the baud rates for transmit and receive can be different if Timer 2 is used for the
receiver or transmitter and Timer 1 is used for the other function. Setting RCLK and/or
TCLK puts Timer 2 into its baud rate generator mode.
The baud rate generator mode is similar to the auto-reload mode, in that a rollover in TH2
causes the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H
and RCAP2L, which are preset by software.

The baud rates in Modes 1 and 3 are determined by Timer 2’s overflow rate according to
the following equation.




The Timer can be configured for either timer or counter operation. In most applications, it
is configured for timer operation (CP/T2 = 0). The timer operation is different for Timer
2 when it is used as a baud rate generator. Normally, as a timer, it increments every
machine cycle (at 1/12 the oscillator frequency). As a baud rate generator, however, it
increments every state time (at 1/2 the oscillator frequency). The baud rate formula is
given below.




Where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit
unsigned integer.

Timer 2 as a baud rate generator is shown in the below figure. This figure is valid only if
RCLK or TCLK = 1 in T2CON. Note that a rollover in TH2 does not set TF2 and will
not generate an interrupt. Note too, that if EXEN2 is set, a 1-to-0 transition in T2EX will
set EXF2 but will not cause a reload from (RCAP2H, RCAP2L) to (TH2, TL2). Thus,
when Timer 2 is in use as a baud rate generator, T2EX can be used as an extra external
interrupt.

Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate generator mode,
TH2 or TL2 should not be read from or written to. Under these conditions, the Timer is
incremented every state time, and the results of a read or write may not be accurate. The
RCAP2 registers may be read but should not be written to, because a write might overlap
a reload and cause write and/or reload errors. The timer should be turned off (clear TR2)
before accessing the Timer 2 or RCAP2 registers.




                      Timer 2 in Baud Rate Generator Mode

Programmable Clock Out

A 50% duty cycle clock can be programmed to come out on P1.0, as shown in the below
figure. This pin, besides being a regular I/O pin, has two alternate functions. It can be
programmed to input the external clock for Timer/Counter 2 or to output a 50% duty
cycle clock ranging from 61 Hz to 4 MHz (for a 16-MHz operating frequency).
Timer 2 in Clock-Out Mode

To configure the Timer/Counter 2 as a clock generator, bit C/T2 (T2CON.1) must be
cleared and bit T2OE (T2MOD.1) must be set. Bit TR2 (T2CON.2) starts and stops the
timer. The clock-out frequency depends on the oscillator frequency and the reload value
of Timer 2 capture registers (RCAP2H, RCAP2L), as shown in the following equation.




In the clock-out mode, Timer 2 roll-overs will not generate an interrupt. This behavior is
similar to when Timer 2 is used as a baud-rate generator. It is possible to use Timer 2 as a
baud-rate generator and a clock generator simultaneously. Note, however, that the baud
rate and clock-out frequencies cannot be determined independently from one another
since they both use RCAP2H and RCAP2L.



Interrupts
The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and
INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These
interrupts are all shown in Figure 13-1.




Each of these interrupt sources can be individually enabled or disabled by setting or
clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA,
which disables all interrupts at once. Note that Table 13-1 shows that bit position IE.6 is
unimplemented. User software should not write a 1 to this bit position, since it may be
used in future AT89 products.

Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register
T2CON. Neither of these flags is cleared by hardware when the service routine is
vectored to. In fact, the service routine may have to determine whether it was TF2 or
EXF2 that generated the interrupt, and that bit will have to be cleared in software.

The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the
timers overflow. The values are then polled by the circuitry in the next cycle. However,
the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer
overflows.
Idle Mode

In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active.
The mode is invoked by software. The content of the on-chip RAM and all the special
functions registers remain unchanged during this mode. The idle mode can be terminated
by any enabled interrupt or by a hardware reset.

Note that when idle mode is terminated by a hardware reset, the device normally resumes
program execution from where it left off, up to two machine cycles before the internal
reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this
event, but access to the port pins is not inhibited. To eliminate the possibility of an
unexpected write to a port pin when idle mode is terminated by a reset, the instruction
following the one that invokes idle mode should not write to a port pin or to external
memory.




Power-down Mode

In the Power-down mode, the oscillator is stopped, and the instruction that invokes
Power-down is the last instruction executed. The on-chip RAM and Special Function
Registers retain their values until the Power-down mode is terminated. Exit from Power
down mode can be initiated either by a hardware reset or by an enabled external interrupt.
Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be
activated before VCC is restored to its normal operating level and must be held active
long enough to allow the oscillator to restart and stabilize.




               Status of External Pins During Idle and Power-down Modes

Program Memory Lock Bits
The AT89S52 has three lock bits that can be left un programmed (U) or can be
programmed (P) to obtain the additional features listed in the table.




                       Lock Bit Protection Modes

When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched
during reset. If the device is powered up without a reset, the latch initializes to a random
value and holds that value until reset is activated. The latched value of EA must agree
with the current logic level at that pin in order for the device to function properly.
Programming the Flash – Parallel Mode
The AT89S52 is shipped with the on-chip Flash memory array ready to be programmed.
The programming interface needs a high-voltage (12-volt) program enable signal and is
compatible with conventional third-party Flash or EPROM programmers.
The AT89S52 code memory array is programmed byte-by-byte.
Programming Algorithm:
Before programming the AT89S52, the address, data, and control signals should be set up
according to the “Flash Programming Modes”. To program the AT89S52, take the
following steps:

1. Input the desired memory location on the address lines.

2. Input the appropriate data byte on the data lines.

3. Activate the correct combination of control signals.

4. Raise EA/VPP to 12V.

5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte
write cycle is self-timed and typically takes no more than 50 µs. Repeat steps 1 through
5, changing the address and data for the entire array or until the end of the object file is
reached.




Data Polling:

The AT89S52 features Data Polling to indicate the end of a byte write cycle. During a
write cycle, an attempted read of the last byte written will result in the complement of the
written data on P0.7. Once the write cycle has been completed, true data is valid on all
outputs, and the next cycle may begin. Data Polling may begin any time after a write
cycle has been initiated.

Ready/Busy:

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

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 status of the individual lock
bits can be verified directly by reading them back.

Reading the Signature Bytes:

The signature bytes are read by the same procedure as a normal verification of locations
000H, 100H, and 200H, except that P3.6 and P3.7 must be pulled to a logic low. The
values returned are as follows.

(000H) = 1EH indicates manufactured by Atmel

(100H) = 52H indicates AT89S52

(200H) = 06H

Chip Erase:
In the parallel programming mode, a chip erase operation is initiated by using the proper
combination of control signals and by pulsing ALE/PROG low for a duration of 200 ns -
500 ns.




In the serial programming mode, a chip erase operation is initiated by issuing the Chip
Erase instruction. In this mode, chip erase is self-timed and takes about 500 ms. During
chip erase, a serial read from any address location will return 00H at the data output.



Programming the Flash – Serial Mode

The Code memory array can be programmed using the serial ISP interface while RST is
pulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO
(output). After RST is set high, the Programming Enable instruction needs to be executed
first before other operations can be executed. Before a reprogramming sequence can
occur, a Chip Erase operation is required.

The Chip Erase operation turns the content of every memory location in the Code array
into FFH. Either an external system clock can be supplied at pin XTAL1 or a crystal
needs to be connected across pins XTAL1 and XTAL2. The maximum serial clock
(SCK) frequency should be less than 1/16 of the crystal frequency. With a 33 MHz
oscillator clock, the maximum SCK frequency is 2 MHz.



Serial Programming Algorithm



To program and verify the AT89S52 in the serial programming mode, the following
sequence is recommended:

1. Power-up sequence:

   a. Apply power between VCC and GND pins.

   b. Set RST pin to “H”.
If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHz
clock to XTAL1 pin and wait for at least 10 milliseconds.

2.    Enable   serial   programming     by   sending   the    Programming   Enable   serial
instruction to pin MOSI/P1.5. The frequency of the shift clock supplied at pin
SCK/P1.7 needs to be less than the CPU clock at XTAL1 divided by 16.

3. The Code array is programmed one byte at a time in either the Byte or Page mode. The
write cycle is self-timed and typically takes less than 0.5 ms at 5V.

4. Any memory location can be verified by using the Read instruction which returns the
content at the selected address at serial output MISO/P1.6.

5. At the end of a programming session, RST can be set low to commence normal device
operation.




Power-off sequence (if needed):

     1. Set XTAL1 to “L” (if a crystal is not used).

     2. Set RST to “L”.

     3. Turn VCC power off.



Data Polling:

The Data Polling feature is also available in the serial mode. In this mode, during a write
cycle an attempted read of the last byte written will result in the complement of the MSB
of the serial output byte on MISO.




Serial Programming Instruction Set

The Instruction Set for Serial Programming follows a 4-byte protocol and is shown in the
table given below.
Serial Programming Instruction Set

Programming Interface – Parallel Mode
Every code byte in the Flash array can be programmed by using the appropriate
combination of control signals. The write operation cycle is self-timed and once initiated,
will automatically time itself to completion.
Flash Programming Modes
After Reset signal is high, SCK should be low for at least 64 system clocks before it goes
high to clock in the enable data bytes. No pulsing of Reset signal is necessary. SCK
should be no faster than 1/16 of the system clock at XTAL1.

For Page Read/Write, the data always starts from byte 0 to 255. After the command byte
and upper address byte are latched, each byte thereafter is treated as data until all 256
bytes are shifted in/out. Then the next instruction will be ready to be decoded.
Switches and Pushbuttons

There is nothing simpler than this! This is the simplest way of controlling appearance of
some voltage on microcontroller’s input pin. There is also no need for additional
explanation of how these components operate.




Nevertheless, it is not so simple in practice... This is about something commonly
unnoticeable when using these components in everyday life. It is about contact bounce- a
common problem with m e c h a n i c a l switches. If contact switching does not happen
so quickly, several consecutive bounces can be noticed prior to maintain stable state. The
reasons for this are: vibrations, slight rough spots and dirt. Anyway, whole this process
does not last long (a few micro- or miliseconds), but long enough to be registered by the
microcontroller. Concerning pulse counter, error occurs in almost 100% of cases!
The simplest solution is to connect simple RC circuit which will “suppress” each quick
voltage change. Since the bouncing time is not defined, the values of elements are not
strictly determined. In the most cases, the values shown on figure are sufficient.

If complete safety is needed, radical measures should be taken! The circuit, shown on the
figure (RS flip-flop), changes logic state on its output with the first pulse triggered by
contact bounce. Even though this is more expensive solution (SPDT switch), the problem
is definitely resolved! Besides, since the condensator is not used, very short pulses can be
also registered in this way. In addition to these hardware solutions, a simple software
solution is commonly applied too: when a program tests the state of some input pin and
finds changes, the check should be done one more time after certain time delay. If the
change is confirmed it means that switch (or pushbutton) has changed its position. The
advantages of such solution are obvious: it is free of charge, effects of disturbances are
eliminated too and it can be adjusted to the worst-quality contacts.




AUTO DIALER:




The very simplest working telephone would look like this inside:
As you can see, it only contains three parts and they are all simple:

        •   A switch to connect and disconnect the phone from the network - This
            switch is generally called the hook switch. It connects when you lift the
            handset.
        •   A speaker - This is generally a little 50-cent, 8-ohm speaker of some sort.
        •   A microphone - In the past, telephone microphones have been as simple
            as carbon granules compressed between two thin metal plates. Sound
            waves from your voice compress and decompress the granules, changing
            the resistance of the granules and modulating the current flowing through
            the microphone.

Most people find that annoying, so any "real" phone contains a device called a duplex
coil or something functionally equivalent to block the sound of your own voice from
reaching your ear. A modern telephone also includes a bell so it can ring and a touch-
tone keypad and frequency generator. A "real" phone looks like this:
A "real" telephone

Still, it's pretty simple. In a modern phone there is an electronic microphone, amplifier
and circuit to replace the carbon granules and loading coil. The mechanical bell is often
replaced by a speaker and a circuit to generate a pleasant ringing tone.

Here in our project we will be replacing the HOOK SWITCH with a RELAY so that the
switching can be controlled with the microcontroller itself. That is nothing but we are
connecting to the telephone line when ever we want by just activating that relay.



Redial:

    The telephone stores in memory the last number you called. The number will remain
in the Redial memory until you dial another number.

To dial the same number again

   1. Lift the handset or press your telephone's Hands free button.

   2. Listen for the dial tone, and press Redial.

    This is done manually but as we want all this to be done automatically we will be
replacing the redial button with another RELAY. Here we are using two relays for
controlling the ON and OFF of the phone and for redialing. So now every thing is
automatic as the relays are being controlled by the microcontroller itself.




RELAYS:

      A relay is an electrically controllable switch widely used in industrial controls,
automobiles and appliances.

The relay allows the isolation of two separate sections of a system with two different
voltage sources i.e., a small amount of voltage/current on one side can handle a large
amount of voltage/current on the other side but there is no chance that these two voltages
mix up.




                                Inductor




                         Fig: Circuit symbol of a relay




Operation:
When current flows through the coil, a magnetic field is created around the coil
i.e., the coil is energized. This causes the armature to be attracted to the coil. The
armature’s contact acts like a switch and closes or opens the circuit. When the coil is not
energized, a spring pulls the armature to its normal state of open or closed. There are all
types of relays for all kinds of applications.




                      Fig: Relay Operation and use of protection diodes




     Transistors and ICs must be protected from the brief high voltage 'spike' produced
when the relay coil is switched off. The above diagram shows how a signal diode (eg
1N4148) is connected across the relay coil to provide this protection. The diode is
connected 'backwards' so that it will normally not conduct. Conduction occurs only when
the relay coil is switched off, at this moment the current tries to flow continuously
through the coil and it is safely diverted through the diode. Without the diode no current
could flow and the coil would produce a damaging high voltage 'spike' in its attempt to
keep the current flowing.

In choosing a relay, the following characteristics need to be considered:
1. The contacts can be normally open (NO) or normally closed (NC). In the NC type, the
contacts are closed when the coil is not energized. In the NO type, the contacts are closed
when the coil is energized.

2. There can be one or more contacts. i.e., different types like SPST (single pole single
throw), SPDT (single pole double throw) and DPDT (double pole double throw) relays.

3. The voltage and current required to energize the coil. The voltage can vary from a few
volts to 50 volts, while the current can be from a few milliamps to 20milliamps. The relay
has a minimum voltage, below which the coil will not be energized. This minimum
voltage is called the “pull-in” voltage.

4. The minimum DC/AC voltage and current that can be handled by the contacts. This is
in the range of a few volts to hundreds of volts, while the current can be from a few amps
to 40A or more, depending on the relay.

SENSOR BOARD:

The different sensors used in this project are as follows:

   1. REED SWITCHES or MAGNETIC SENSORS
   2. LED & LDR section
   3. TEMPERATURE SENSOR
   4. PANIC SWITCH
   5.   IR tx AND IR rx.

Let us see the description of each sensor.
REED SWITCHES OR MAGNETIC SENSORS:

The reed switch is an electrical switch operated by an applied magnetic field. The basic
reed switch consists of two identical flattened ferromagnetic reeds, sealed in a dry inert-
gas atmosphere within a glass capsule, thereby protecting the contact from
contamination. The reeds are sealed in the capsule in such a way that their free ends
overlap and are separated by a small air gap.




                              Fig: Reed Switch

The contacts may be normally open, closing when a magnetic field is present, or
normally closed and opening when a magnetic field is applied.

A magnetic field from an electromagnet or a permanent magnet will cause the contacts to
pull together, thus completing an electrical circuit. The stiffness of the reeds causes them
to separate, and open the circuit, when the magnetic field ceases. Good electrical contact
is assured by plating a thin layer of precious metal over the flat contact portions of the
reeds.

Since the contacts of the reed switch are sealed away from the atmosphere, they are
protected against atmospheric corrosion. The hermetic sealing of a reed switch makes
them suitable for use in explosive atmospheres where tiny sparks from conventional
switches would constitute a hazard.

REED SENSOR:

A reed sensor is a device built using a reed switch with additional functionality like
ability to withstand higher shock, easier mounting, additional intelligent circuitry, etc.

In production, a metal reed is inserted in each end of a glass tube and the end of the tube
heated so that it seals around a shank portion on the reed. Infrared-absorbing glass is
used, so an infrared heat source can concentrate the heat in the small sealing zone of the
glass tube. The thermal coefficient of expansion of the glass material and metal parts
must be similar to prevent breaking the glass-to-metal seal. The glass used must have a
high electrical resistance and must not contain volatile components such as lead oxide
and fluorides. The leads of the switch must be handled carefully to prevent breaking the
glass envelope.

How does a reed switch work?

When a magnetic force is generated parallel to the reed switch, the reeds become flux
carriers in the magnetic circuit. The overlapping ends of the reeds become opposite
magnetic poles, which attract each other. If the magnetic force between the poles is
strong enough to overcome the restoring force of the reeds, the reeds will be drawn
together.

One important quality of the switch is its sensitivity, the amount of magnetic energy
necessary to actuate it. Sensitivity is measured in units of Ampere-turns, corresponding to
the current in a coil multiplied by the number of turns. Typical pull-in sensitivities for
commercial devices are in the 10 to 60 AT range.
Uses:

Reed switches are widely used for electrical circuit control, particularly in the
communications field. Reed switches are commonly used in mechanical systems as
proximity switches as well as in door and window sensors in burglar alarm systems and
tamper proofing methods. These were formerly used in the keyboards for computer
terminals, where each key had a magnet and a reed switch actuated by depressing the
key. Speed sensors on bicycles use a reed switch to detect when the magnet on the wheel
passes the sensor.

Advantages:

   1. They are hermetically sealed in glass environment.

   2. Free from contamination, and are safe to use in harsh industrial and explosive
        environments.

   3.   Reed switches are immune to electrostatic discharge (ESD) and do not require
        any external ESD protection circuits. The isolation resistance between the
        contacts is as high as 1015 ohms, and contact resistance is as low as 50 milliohms.

   4. They can directly switch loads as low as a few microwatts without the help of
        external amplification circuits, to as high as 120W.

   5.   When the reed switches are combined with magnets and coils, they can be used
        to form many different types of relays.

The arrangement of the reed switch in our project is as shown in the figure above. We
will be using two reed switches, one at the door and other at the window.
LED AND LDR SECTION:

LDR:

LDRs or Light Dependent Resistors are very useful especially in light/dark sensor
circuits. Normally the resistance of an LDR is very high, sometimes as high as 1000 000
ohms, but when they are illuminated with light resistance drops dramatically.
When the light level is low the resistance of the LDR is high. This prevents current from
flowing to the base of the transistors. Consequently the LED does not light.
However, when light shines onto the LDR its resistance falls and current flows into the
base of the first transistor and then the second transistor. The LED lights.




Here in our project to avoid the light from led to fall on to LDR we place a box in which
we will keep our jewelry. If any one removes the box the light from led falls directly on
to the LDR and then the transistor will be on which is monitored by the microcontroller.



Temperature Sensor:

A sensor can be defined as a device which can convert one form of energy into electrical
energy. Here we are using a sensor to sense the temperature around us. For this purpose
we will be taking help of LM 35 which is a temperature sensor.

LM35:

The LM35 series are precision integrated-circuit temperature sensors, whose output
voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus
has an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not
required to subtract a large constant voltage from its output to obtain convenient
Centigrade scaling. The LM35 does not require any external calibration or trimming to
provide typical accuracies of   ±1⁄4°C   at room temperature and   ±3⁄4°C   over a full −55 to
+150°C temperature range. Low cost is assured by trimming and calibration at the wafer
level. The LM35’s low output impedance, linear output, and precise inherent calibration
make interfacing to readout or control circuitry especially easy. It can be used with single
power supplies, or with plus and minus supplies. As it draws only 60 μA from its supply,
it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to operate over
a −55° to +150°C temperature range.


Features
   •   Calibrated directly in ° Celsius (Centigrade)
   •   Linear + 10.0 mV/°C scale factor
   •   0.5°C accuracy guarantee able (at +25°C)
   •   Rated for full −55° to +150°C range
   •   Suitable for remote applications
   •   Low cost due to wafer-level trimming
   •   Operates from 4 to 30 volts
   •   Less than 60 μA current drain
   •   Low self-heating, 0.08°C in still air
   •   Nonlinearity only ±1⁄4°C typical
   •   Low impedance output, 0.1 W for 1 mA load.


Typical Applications
The arrangement of this sensor in our board is as shown in the figure below.




In this we directly connect the output of the sensor to the base of the transistor as of
LM35 for every 1˚C rise of temperature the output will increase for 10mV. Now if the
temperature reaches 70˚C the output voltage will be 0.7V which is enough for the
transistor junction to be biased. Hence the transistor gets on and the output is sensed by
the microcontroller.


Panic Switch:


This is nothing but a simple switch which is connected in the sensor board. The
arrangement of this is as shown in the figure below.
The response of this switch is monitored by the microcontroller and the corresponding
action takes place.


IR Section:


IR Tx.:




TSAL6200 is a high efficiency infrared emitting diode in GaAlAs on GaAs technology,
molded in clear, bluegrey tinted plastic packages. In comparison with the standard GaAs
on GaAs technology these emitters achieve more than 100 % radiant power improvement
at a similar wavelength. The forward voltages at low current and at high pulse current
roughly correspond to the low values of the standard technology. Therefore these emitters
are ideally suitable as high performance replacements of standard emitters.


Features
• Extra high radiant power and radiant intensity
• High reliability
• Low forward voltage
• Suitable for high pulse current operation
• Standard T-1¾ (∅ 5 mm) package
• Angle of half intensity ϕ = ± 17°
• Peak wavelength λp = 940 nm
• Good spectral matching to Si photodetectors




Applications
Infrared remote control units with high power requirements
Free air transmission systems
Infrared source for optical counters and card readers
IR source for smoke detectors.




       Most photo-detecting modules for industrial use are using modulated light to
avoid interference by the ambient light. The detected signal is filtered with a band pass
filter and disused signals are filtered out. Therefore, only the modulated signal from the
light emitter can be detected. Of course, the detector must not be saturated by ambient
light because it is effective when the detector is working in its linear region.
In this project, pulsed light is used to cancel ambient light. This is suitable for
arrayed sensors that are scanned in sequence to avoid interference from the next sensor.
The microcontroller starts to scan the sensor status, sample the output voltage, turns on
the LED and samples again the output voltage. The difference between the two samples
is the optical current created by the LED, as the output voltage produced by the ambient
light is canceled. The other sensors are also scanned the same way in sequence.


The IR TX and RX are placed adjacent to each other. The TX transmits the IR radiation
continuously and these will pass away when there is no object interrupting the signal. The
IR receiver does not receive the IR radiation in this case. When there is an obstacle or
when some one interrupts the IR signal, the rays transmitted by the IR transmitter will get
reflected back and these reflected rays will be received by the IR receiver. Thus, the IR
receiver receives the signal now in this case. The microcontroller detects this change and
does the necessary action.




DRIVER CIRCUIT:


       Digital systems and microcontroller pins lack sufficient current to drive the
circuits like relays, buzzer circuits etc. While these circuits require around 10milli amps
to be operated, the microcontroller’s pin can provide a maximum of 1-2milli amps
current. For this reason, a driver such as a power transistor is placed in between the
microcontroller and the buzzer circuit.
Vcc




                                                                               BUZZER



                   AT89S52

                                                            GROUND
                             P1.0




The operation of this circuit is as follows:

The input to the base of the transistor is applied from the microcontroller port pin P1.0.
The transistor will be switched on when the base to emitter voltage is greater than 0.7V
(cut-in voltage). Thus when the voltage applied to the pin P1.0 is high i.e., P1.0=1
(>0.7V), the transistor will be switched on and thus the buzzer will be ON.

When the voltage at the pin P1.0 is low i.e., P1.0=0 (<0.7V) the transistor will be in off
state and the buzzer will be OFF. Thus the transistor acts like a current driver to operate
the buzzer accordingly.
BUZZER INTERFACING WITH THE MICROCONTROLLER:




                     DRIVER
                                    BUZZER
   AT 89s52          CIRCUIT
         P1.0
SCHEMATIC DIAGRAM:
WORKING PROCEDURE:


This is a stand alone project to provide security to industries using an advanced
technology called embedded systems. In this we are providing security by taking 5
different sensors. They are namely:
   1. Reed sensor
   2. LED & LDR
   3. Temperature Sensor
   4. Panic Switch
   5. IR Tx & IR Rx.


The working of all these sensors will start only when the arm key which is connected to
the main board is made on.


Here we will be using Reed switches at two different places viz. At doors and at
windows. When using at doors we have two conditions to be checked, they are, whether
the person is leaving outside or coming inside.


The microcontroller continuously checks all the sensors. When this door sensor is
triggered, it waits for a small amount of time allowing the person to close or open the
door within that predefined delay. If the user closes or opens the door within the given
delay, the controller will not ring the buzzer or the alarm and will wait again for another
sensor to be activated. If the user can’t close or open the door in the given time, the
controller will enter into the next case which is called as the entry delay.


Another reed sensor is placed at the window. If the window is opened then the buzzer is
activated and then the auto-dialer action is performed.
After this comes the LED & LDR section. In this we will be placing all important things
in a box and place that box on the LDR such that it objects the light falling from the LED.
If any one removes the box the light falls on the ldr and then the microcontroller detects it
and the buzzer will be activated and then the auto-dialer.


The next sensor is Temperature sensor. This sensor gets activated only when the
temperature in the room exceeds 70 degrees. This is because of the hardware connections
we have made. When this sensor is activated the buzzer followed by auto-dialer is also
activated.


The next one is the panic switch. This can be activated by pressing this switch which will
lead to the activation of buzzer and auto-dialer.


Next comes the IR section. This contains a IR Tx. and IR Rx. This is arranged in such a
manner that the IR signal falls continuously on the IR Rx. When ever an obstacle is
passed through this pair this sensor gets activated. When this sensor is activated the alarm
is on and auto-dialer is activated.


The final sensor is the Smoke detector. Internally this has a pair of IR Tx. and Rx. This
sensor is activated when there is a fire accident which results in smoke. This smoke is
detected by this sensor and then the buzzer is activated followed by auto-dialer.
14983184 industrial-security-system-using-auto-dialer

Weitere ähnliche Inhalte

Was ist angesagt?

Implementation of vision based intelligent home security system using ARM7
Implementation of vision based intelligent home security system using ARM7Implementation of vision based intelligent home security system using ARM7
Implementation of vision based intelligent home security system using ARM7IRJET Journal
 
An electronic switch sensor with a point to-point intrusive monitoring system
An electronic switch sensor with a point to-point intrusive monitoring systemAn electronic switch sensor with a point to-point intrusive monitoring system
An electronic switch sensor with a point to-point intrusive monitoring systemZac Darcy
 
Gsm based industrial security system
Gsm based industrial security system Gsm based industrial security system
Gsm based industrial security system RAJASHREE B
 
Gsm based home security system
Gsm based home security systemGsm based home security system
Gsm based home security systemNarayan Gour
 
Gsm based industrial security system
Gsm based industrial security systemGsm based industrial security system
Gsm based industrial security systemRAJASHREE B
 
Wireless AI based industrial security robot
Wireless AI based industrial security robotWireless AI based industrial security robot
Wireless AI based industrial security robotVarun B P
 
home automaton using pc ppt
home automaton using pc ppthome automaton using pc ppt
home automaton using pc pptRajesh Kumar
 
IRJET- Centralised Status alert system for industrial machines
IRJET-  	  Centralised Status alert system for industrial machinesIRJET-  	  Centralised Status alert system for industrial machines
IRJET- Centralised Status alert system for industrial machinesIRJET Journal
 
Rail Track Inspector
Rail Track InspectorRail Track Inspector
Rail Track Inspectorncct
 
Automatic door using arduino
Automatic door using arduinoAutomatic door using arduino
Automatic door using arduinosayyed sabir
 
CEIS101: IoT Home Security System
CEIS101: IoT Home Security SystemCEIS101: IoT Home Security System
CEIS101: IoT Home Security SystemBillBlanco
 
Remote-Monitoring and Energy-Saving Room Architecture with Security System ba...
Remote-Monitoring and Energy-Saving Room Architecture with Security System ba...Remote-Monitoring and Energy-Saving Room Architecture with Security System ba...
Remote-Monitoring and Energy-Saving Room Architecture with Security System ba...Praveen Reddy
 
Voice Recognition Wireless Home Automation System Based On Zigbee
Voice Recognition Wireless Home Automation System Based On ZigbeeVoice Recognition Wireless Home Automation System Based On Zigbee
Voice Recognition Wireless Home Automation System Based On ZigbeeIOSR Journals
 
Smart door project ppt shivnaresh likhar
Smart door project ppt shivnaresh likharSmart door project ppt shivnaresh likhar
Smart door project ppt shivnaresh likharShivnaresh Likhar
 
Password based door locking system
Password based door locking systemPassword based door locking system
Password based door locking systemArjun Singh
 

Was ist angesagt? (20)

GSM Based Security System
GSM Based Security SystemGSM Based Security System
GSM Based Security System
 
Implementation of vision based intelligent home security system using ARM7
Implementation of vision based intelligent home security system using ARM7Implementation of vision based intelligent home security system using ARM7
Implementation of vision based intelligent home security system using ARM7
 
An electronic switch sensor with a point to-point intrusive monitoring system
An electronic switch sensor with a point to-point intrusive monitoring systemAn electronic switch sensor with a point to-point intrusive monitoring system
An electronic switch sensor with a point to-point intrusive monitoring system
 
Gsm based industrial security system
Gsm based industrial security system Gsm based industrial security system
Gsm based industrial security system
 
I45015153
I45015153I45015153
I45015153
 
Gsm based home security system
Gsm based home security systemGsm based home security system
Gsm based home security system
 
Gsm based industrial security system
Gsm based industrial security systemGsm based industrial security system
Gsm based industrial security system
 
Home automation
Home automationHome automation
Home automation
 
Wireless AI based industrial security robot
Wireless AI based industrial security robotWireless AI based industrial security robot
Wireless AI based industrial security robot
 
home automaton using pc ppt
home automaton using pc ppthome automaton using pc ppt
home automaton using pc ppt
 
Home security system
Home security systemHome security system
Home security system
 
IRJET- Centralised Status alert system for industrial machines
IRJET-  	  Centralised Status alert system for industrial machinesIRJET-  	  Centralised Status alert system for industrial machines
IRJET- Centralised Status alert system for industrial machines
 
Rail Track Inspector
Rail Track InspectorRail Track Inspector
Rail Track Inspector
 
Automatic door using arduino
Automatic door using arduinoAutomatic door using arduino
Automatic door using arduino
 
Home security system
Home security system Home security system
Home security system
 
CEIS101: IoT Home Security System
CEIS101: IoT Home Security SystemCEIS101: IoT Home Security System
CEIS101: IoT Home Security System
 
Remote-Monitoring and Energy-Saving Room Architecture with Security System ba...
Remote-Monitoring and Energy-Saving Room Architecture with Security System ba...Remote-Monitoring and Energy-Saving Room Architecture with Security System ba...
Remote-Monitoring and Energy-Saving Room Architecture with Security System ba...
 
Voice Recognition Wireless Home Automation System Based On Zigbee
Voice Recognition Wireless Home Automation System Based On ZigbeeVoice Recognition Wireless Home Automation System Based On Zigbee
Voice Recognition Wireless Home Automation System Based On Zigbee
 
Smart door project ppt shivnaresh likhar
Smart door project ppt shivnaresh likharSmart door project ppt shivnaresh likhar
Smart door project ppt shivnaresh likhar
 
Password based door locking system
Password based door locking systemPassword based door locking system
Password based door locking system
 

Andere mochten auch

laser security alarm thesis
laser security alarm thesislaser security alarm thesis
laser security alarm thesisyash kumar singh
 
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3Abhishekvb
 
Automatic room-light-controller-visitor-counter
Automatic room-light-controller-visitor-counterAutomatic room-light-controller-visitor-counter
Automatic room-light-controller-visitor-counterMohit Awasthi
 
Project report on bidirectional visitor counter & home automation
Project report on bidirectional visitor counter & home automationProject report on bidirectional visitor counter & home automation
Project report on bidirectional visitor counter & home automationRoshan Mani
 
Employee health & safety SOMS
Employee health & safety SOMSEmployee health & safety SOMS
Employee health & safety SOMSBharambe Rahul
 
power generated from URINE SEMINAR REPORT
power generated from URINE SEMINAR REPORTpower generated from URINE SEMINAR REPORT
power generated from URINE SEMINAR REPORTMAHESH294
 
power generation from RAILWAY TRACKS
power generation from RAILWAY TRACKSpower generation from RAILWAY TRACKS
power generation from RAILWAY TRACKSMAHESH294
 
Alok ppt new 13 aprl
Alok ppt new 13 aprlAlok ppt new 13 aprl
Alok ppt new 13 aprlNitesh Prasad
 
ppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counterppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counterMannavapremkumar
 
Automatic room light controller with bidirectional visitor counter
Automatic room light controller with bidirectional visitor counterAutomatic room light controller with bidirectional visitor counter
Automatic room light controller with bidirectional visitor counterBIRLA VISHVAKARMA MAHAVIDYALAY
 
Linear Induction Motor (Electric Trains based on magnetic Levtation)
Linear Induction Motor (Electric Trains based on magnetic Levtation)Linear Induction Motor (Electric Trains based on magnetic Levtation)
Linear Induction Motor (Electric Trains based on magnetic Levtation)Ajit Singh Rajawat
 
Burglar alarm project
Burglar alarm projectBurglar alarm project
Burglar alarm projectAmar Ahir
 
Power generation from railway track
Power generation from railway trackPower generation from railway track
Power generation from railway trackManojkumar Mishra
 
Linear Motor In Maglev Train
Linear Motor In Maglev TrainLinear Motor In Maglev Train
Linear Motor In Maglev TrainEng_Ahmad
 

Andere mochten auch (20)

laser security alarm thesis
laser security alarm thesislaser security alarm thesis
laser security alarm thesis
 
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
Bidirectional Visitor Counter using IR sensors and Arduino Uno R3
 
Automatic room-light-controller-visitor-counter
Automatic room-light-controller-visitor-counterAutomatic room-light-controller-visitor-counter
Automatic room-light-controller-visitor-counter
 
Project report on bidirectional visitor counter & home automation
Project report on bidirectional visitor counter & home automationProject report on bidirectional visitor counter & home automation
Project report on bidirectional visitor counter & home automation
 
At89s52
At89s52At89s52
At89s52
 
Employee health & safety SOMS
Employee health & safety SOMSEmployee health & safety SOMS
Employee health & safety SOMS
 
power generated from URINE SEMINAR REPORT
power generated from URINE SEMINAR REPORTpower generated from URINE SEMINAR REPORT
power generated from URINE SEMINAR REPORT
 
power generation from RAILWAY TRACKS
power generation from RAILWAY TRACKSpower generation from RAILWAY TRACKS
power generation from RAILWAY TRACKS
 
Nttf ppt
Nttf pptNttf ppt
Nttf ppt
 
Speed
SpeedSpeed
Speed
 
Alok ppt new 13 aprl
Alok ppt new 13 aprlAlok ppt new 13 aprl
Alok ppt new 13 aprl
 
ppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counterppt of automatic room light controller and BI directional counter
ppt of automatic room light controller and BI directional counter
 
Automatic room light controller with bidirectional visitor counter
Automatic room light controller with bidirectional visitor counterAutomatic room light controller with bidirectional visitor counter
Automatic room light controller with bidirectional visitor counter
 
Bidirect visitor counter
Bidirect visitor counterBidirect visitor counter
Bidirect visitor counter
 
Linear Induction Motor (Electric Trains based on magnetic Levtation)
Linear Induction Motor (Electric Trains based on magnetic Levtation)Linear Induction Motor (Electric Trains based on magnetic Levtation)
Linear Induction Motor (Electric Trains based on magnetic Levtation)
 
Security alarm
Security alarmSecurity alarm
Security alarm
 
electrical engineering
electrical engineeringelectrical engineering
electrical engineering
 
Burglar alarm project
Burglar alarm projectBurglar alarm project
Burglar alarm project
 
Power generation from railway track
Power generation from railway trackPower generation from railway track
Power generation from railway track
 
Linear Motor In Maglev Train
Linear Motor In Maglev TrainLinear Motor In Maglev Train
Linear Motor In Maglev Train
 

Ähnlich wie 14983184 industrial-security-system-using-auto-dialer

IR and Metal senosors Based Product Sorting.docx
IR and Metal senosors Based Product Sorting.docxIR and Metal senosors Based Product Sorting.docx
IR and Metal senosors Based Product Sorting.docxSaikiranBasuthkar
 
Mini final docmtn final
Mini final docmtn finalMini final docmtn final
Mini final docmtn finalAyesha Mubeen
 
Esd notes iae
Esd notes iaeEsd notes iae
Esd notes iaeMuru Gan
 
Unit 1 embedded systems and applications
Unit 1 embedded systems and applicationsUnit 1 embedded systems and applications
Unit 1 embedded systems and applicationsDr.YNM
 
Unit 1 Embedded systems and applications
Unit 1 Embedded systems and applicationsUnit 1 Embedded systems and applications
Unit 1 Embedded systems and applicationsDr.YNM
 
Gesture control robot using accelerometer documentation
Gesture control robot using accelerometer documentationGesture control robot using accelerometer documentation
Gesture control robot using accelerometer documentationRajendra Prasad
 
NEW Advanced low cost voice recognition based smart homeoffice
NEW Advanced low cost voice recognition based smart homeofficeNEW Advanced low cost voice recognition based smart homeoffice
NEW Advanced low cost voice recognition based smart homeofficemohammed shoaib uddin
 
protection on lineman while working on transmission line report
 protection on lineman while working on transmission line report protection on lineman while working on transmission line report
protection on lineman while working on transmission line reportRavi Phadtare
 
R20 REGULATION JNTUK EMBEDDED SYSTEMS UNIT-1
R20 REGULATION JNTUK EMBEDDED SYSTEMS UNIT-1R20 REGULATION JNTUK EMBEDDED SYSTEMS UNIT-1
R20 REGULATION JNTUK EMBEDDED SYSTEMS UNIT-1swarna pasupuleti
 
Embedded system and real time operating system
Embedded system  and real time operating systemEmbedded system  and real time operating system
Embedded system and real time operating systemDhilibanSwaminathan
 
Building management system from link vue system
Building management system  from link vue systemBuilding management system  from link vue system
Building management system from link vue systemMahesh Chandra Manav
 
Link vue system pvt ltd product catalouge 2021 -
Link vue system pvt ltd  product catalouge 2021 -Link vue system pvt ltd  product catalouge 2021 -
Link vue system pvt ltd product catalouge 2021 -Mahesh Chandra Manav
 
Microprocessors and microcontrollers
Microprocessors and microcontrollersMicroprocessors and microcontrollers
Microprocessors and microcontrollersAditya Porwal
 

Ähnlich wie 14983184 industrial-security-system-using-auto-dialer (20)

Project report3
Project report3Project report3
Project report3
 
IR and Metal senosors Based Product Sorting.docx
IR and Metal senosors Based Product Sorting.docxIR and Metal senosors Based Product Sorting.docx
IR and Metal senosors Based Product Sorting.docx
 
Mini final docmtn final
Mini final docmtn finalMini final docmtn final
Mini final docmtn final
 
Esd notes iae
Esd notes iaeEsd notes iae
Esd notes iae
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systems
 
Unit 1 embedded systems and applications
Unit 1 embedded systems and applicationsUnit 1 embedded systems and applications
Unit 1 embedded systems and applications
 
Unit 1 Embedded systems and applications
Unit 1 Embedded systems and applicationsUnit 1 Embedded systems and applications
Unit 1 Embedded systems and applications
 
Gesture control robot using accelerometer documentation
Gesture control robot using accelerometer documentationGesture control robot using accelerometer documentation
Gesture control robot using accelerometer documentation
 
MAJOR_PROJECT
MAJOR_PROJECTMAJOR_PROJECT
MAJOR_PROJECT
 
NEW Advanced low cost voice recognition based smart homeoffice
NEW Advanced low cost voice recognition based smart homeofficeNEW Advanced low cost voice recognition based smart homeoffice
NEW Advanced low cost voice recognition based smart homeoffice
 
protection on lineman while working on transmission line report
 protection on lineman while working on transmission line report protection on lineman while working on transmission line report
protection on lineman while working on transmission line report
 
R20 REGULATION JNTUK EMBEDDED SYSTEMS UNIT-1
R20 REGULATION JNTUK EMBEDDED SYSTEMS UNIT-1R20 REGULATION JNTUK EMBEDDED SYSTEMS UNIT-1
R20 REGULATION JNTUK EMBEDDED SYSTEMS UNIT-1
 
Embedded system and real time operating system
Embedded system  and real time operating systemEmbedded system  and real time operating system
Embedded system and real time operating system
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systems
 
Building management system from link vue system
Building management system  from link vue systemBuilding management system  from link vue system
Building management system from link vue system
 
Embedded systems
Embedded systemsEmbedded systems
Embedded systems
 
Link vue system pvt ltd product catalouge 2021 -
Link vue system pvt ltd  product catalouge 2021 -Link vue system pvt ltd  product catalouge 2021 -
Link vue system pvt ltd product catalouge 2021 -
 
edited doc
edited docedited doc
edited doc
 
Microprocessors and microcontrollers
Microprocessors and microcontrollersMicroprocessors and microcontrollers
Microprocessors and microcontrollers
 
J04701080085
J04701080085J04701080085
J04701080085
 

Kürzlich hochgeladen

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostZilliz
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebUiPathCommunity
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 3652toLead Limited
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyAlfredo García Lavilla
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsMark Billinghurst
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii SoldatenkoFwdays
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLScyllaDB
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubKalema Edgar
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsPixlogix Infotech
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxhariprasad279825
 

Kürzlich hochgeladen (20)

What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage CostLeverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
Leverage Zilliz Serverless - Up to 50X Saving for Your Vector Storage Cost
 
Dev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio WebDev Dives: Streamline document processing with UiPath Studio Web
Dev Dives: Streamline document processing with UiPath Studio Web
 
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365Ensuring Technical Readiness For Copilot in Microsoft 365
Ensuring Technical Readiness For Copilot in Microsoft 365
 
Commit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easyCommit 2024 - Secret Management made easy
Commit 2024 - Secret Management made easy
 
Human Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR SystemsHuman Factors of XR: Using Human Factors to Design XR Systems
Human Factors of XR: Using Human Factors to Design XR Systems
 
"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko"Debugging python applications inside k8s environment", Andrii Soldatenko
"Debugging python applications inside k8s environment", Andrii Soldatenko
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Developer Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQLDeveloper Data Modeling Mistakes: From Postgres to NoSQL
Developer Data Modeling Mistakes: From Postgres to NoSQL
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
Unleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding ClubUnleash Your Potential - Namagunga Girls Coding Club
Unleash Your Potential - Namagunga Girls Coding Club
 
The Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and ConsThe Ultimate Guide to Choosing WordPress Pros and Cons
The Ultimate Guide to Choosing WordPress Pros and Cons
 
Artificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptxArtificial intelligence in cctv survelliance.pptx
Artificial intelligence in cctv survelliance.pptx
 

14983184 industrial-security-system-using-auto-dialer

  • 1. ABSTRACT Security is primary concern for every one. This Project describes a design of effective security alarm system that can monitor an industry with different sensors. Unauthorized access, Temperature increment, IR detection can be monitored by the status of each individual sensor. Obviously, this burglar alarm also has an input to 'arm' the alarm, a tamper input and a couple of outputs to control a siren and Auto dialing system. The alarm is also fitted with a so-called 'panic button'. The burglar alarm is built around the 8051 micro controller from Atmel. This micro controller provides all the functionality of the burglar alarm. It also takes care of filtering of the signals at the inputs. Only after an input has remained unchanged for 30 milliseconds, is this new signal level passed on for processing by the micro controller program. This time can be varied by adopting small changes in the source code. A maximum of 5 sensors can be connected to the burglar alarm. These sensors need to have their contacts closed when in the inactive state (i.e. Normally Closed). In addition, each sensor needs to have its tamper connection wired as well. A power supply voltage of +5 VDC is available for each sensor at the corresponding wiring terminals. The uniqueness of this project is not only alerting the neighbors by siren, it also dials a mobile number which is already programmed into the system. A mobile number or a land line number can be programmed into the system. As this system works on existing telephone line, it can dial the number even the subscriber is out of station. This project uses regulated 5V, 500mA power supply. 7805 three terminal voltage regulator is used for voltage regulation. Bridge type full wave rectifier is used to rectify the ac out put of secondary of 230/12V step down transformer.
  • 2. INTRODUCTION Security is the condition of being protected against danger or loss. In the general sense, security is a concept similar to safety. The nuance between the two is an added emphasis on being protected from dangers that originate from outside. Individuals or actions that encroach upon the condition of protection are responsible for the breach of security. The word "security" in general usage is synonymous with "safety," but as a technical term "security" means that something not only is secure but that it has been secured. One of the best options for providing good security is by using a technology named EMBEDDED SYSTEMS. INTRODUCTION TO EMBEDDED SYSTEMS An embedded system can be defined as a computing device that does a specific focused job. Appliances such as the air-conditioner, VCD player, DVD player, printer, fax machine, mobile phone etc. are examples of embedded systems. Each of these appliances will have a processor and special hardware to meet the specific requirement of the application along with the embedded software that is executed by the processor for meeting that specific requirement. The embedded software is also called “firm ware”. The desktop/laptop computer is a general purpose computer. You can use it for a variety of applications such as playing games, word processing, accounting, software development and so on. In contrast, the software in the embedded systems is always fixed listed below: · Embedded systems do a very specific task, they cannot be programmed to do different things. . Embedded systems have very limited resources, particularly the memory. Generally, they do not have secondary storage devices such as the CDROM or the floppy disk. Embedded systems have to work against some deadlines. A specific job has to be completed within a specific time. In some embedded systems, called real-time systems, the deadlines are stringent. Missing a deadline may cause a catastrophe-loss of life or damage to property. Embedded systems are constrained for power. As many embedded systems operate through a battery, the power consumption has to be very low.
  • 3. · Some embedded systems have to operate in extreme environmental conditions such as very high temperatures and humidity. Application Areas Nearly 99 per cent of the processors manufactured end up in embedded systems. The embedded system market is one of the highest growth areas as these systems are used in very market segment- consumer electronics, office automation, industrial automation, biomedical engineering, wireless communication, data communication, telecommunications, transportation, military and so on. Consumer appliances: At home we use a number of embedded systems which include digital camera, digital diary, DVD player, electronic toys, microwave oven, remote controls for TV and air-conditioner, VCO player, video game consoles, video recorders etc. Today’s high-tech car has about 20 embedded systems for transmission control, engine spark control, air-conditioning, navigation etc. Even wristwatches are now becoming embedded systems. The palmtops are powerful embedded systems using which we can carry out many general-purpose tasks such as playing games and word processing. Office automation: The office automation products using em embedded systems are copying machine, fax machine, key telephone, modem, printer, scanner etc. Industrial automation: Today a lot of industries use embedded systems for process control. These include pharmaceutical, cement, sugar, oil exploration, nuclear energy, electricity generation and transmission. The embedded systems for industrial use are designed to carry out specific tasks such as monitoring the temperature, pressure, humidity, voltage, current etc., and then take appropriate action based on the monitored levels to control other devices or to send information to a centralized monitoring station. In hazardous industrial environment, where human presence has to be avoided, robots are used, which are programmed to do specific jobs. The robots are now becoming very
  • 4. powerful and carry out many interesting and complicated tasks such as hardware assembly. Medical electronics: Almost every medical equipment in the hospital is an embedded system. These equipments include diagnostic aids such as ECG, EEG, blood pressure measuring devices, X-ray scanners; equipment used in blood analysis, radiation, colonscopy, endoscopy etc. Developments in medical electronics have paved way for more accurate diagnosis of diseases. Computer networking: Computer networking products such as bridges, routers, Integrated Services Digital Networks (ISDN), Asynchronous Transfer Mode (ATM), X.25 and frame relay switches are embedded systems which implement the necessary data communication protocols. For example, a router interconnects two networks. The two networks may be running different protocol stacks. The router’s function is to obtain the data packets from incoming pores, analyze the packets and send them towards the destination after doing necessary protocol conversion. Most networking equipments, other than the end systems (desktop computers) we use to access the networks, are embedded systems . Telecommunications: In the field of telecommunications, the embedded systems can be categorized as subscriber terminals and network equipment. The subscriber terminals such as key telephones, ISDN phones, terminal adapters, web cameras are embedded systems. The network equipment includes multiplexers, multiple access systems, Packet Assemblers Dissemblers (PADs), sate11ite modems etc. IP phone, IP gateway, IP gatekeeper etc. are the latest embedded systems that provide very low-cost voice communication over the Internet. Wireless technologies: Advances in mobile communications are paving way for many interesting applications using embedded systems. The mobile phone is one of the marvels of the last decade of the 20’h century. It is a very powerful embedded system that provides voice communication while we are on the move. The Personal Digital Assistants and the palmtops can now be used to access multimedia services over the Internet.
  • 5. Mobile communication infrastructure such as base station controllers, mobile switching centers are also powerful embedded systems. Insemination: Testing and measurement are the fundamental requirements in all scientific and engineering activities. The measuring equipment we use in laboratories to measure parameters such as weight, temperature, pressure, humidity, voltage, current etc. are all embedded systems. Test equipment such as oscilloscope, spectrum analyzer, logic analyzer, protocol analyzer, radio communication test set etc. are embedded systems built around powerful processors. Thank to miniaturization, the test and measuring equipment are now becoming portable facilitating easy testing and measurement in the field by field-personnel. Security: Security of persons and information has always been a major issue. We need to protect our homes and offices; and also the information we transmit and store. Developing embedded systems for security applications is one of the most lucrative businesses nowadays. Security devices at homes, offices, airports etc. for authentication and verification are embedded systems. Encryption devices are nearly 99 per cent of the processors that are manufactured end up in~ embedded systems. Embedded systems find applications in . every industrial segment- consumer electronics, transportation, avionics, biomedical engineering, manufacturing, process control and industrial automation, data communication, telecommunication, defense, security etc. Used to encrypt the data/voice being transmitted on communication links such as telephone lines. Biometric systems using fingerprint and face recognition are now being extensively used for user authentication in banking applications as well as for access control in high security buildings. Finance: Financial dealing through cash and cheques are now slowly paving way for transactions using smart cards and ATM (Automatic Teller Machine, also expanded as Any Time Money) machines. Smart card, of the size of a credit card, has a small micro- controller and memory; and it interacts with the smart card reader! ATM machine and acts as an electronic wallet. Smart card technology has the capability of ushering in a
  • 6. cashless society. Well, the list goes on. It is no exaggeration to say that eyes wherever you go, you can see, or at least feel, the work of an embedded system! Overview of Embedded System Architecture Every embedded system consists of custom-built hardware built around a Central Processing Unit (CPU). This hardware also contains memory chips onto which the software is loaded. The software residing on the memory chip is also called the ‘firmware’. The embedded system architecture can be represented as a layered architecture as shown in Fig. The operating system runs above the hardware, and the application software runs above the operating system. The same architecture is applicable to any computer including a desktop computer. However, there are significant differences. It is not compulsory to have an operating system in every embedded system. For small appliances such as remote control units, air conditioners, toys etc., there is no need for an operating system and you can write only the software specific to that application. For applications involving complex processing, it is advisable to have an operating system. In such a case, you need to integrate the application software with the operating system and then transfer the entire software on to the memory chip. Once the software is transferred to the memory chip, the software will continue to run for a long time you don’t need to reload new software. Now, let us see the details of the various building blocks of the hardware of an embedded system. As shown in Fig. the building blocks are;
  • 7. · Central Processing Unit (CPU) · Memory (Read-only Memory and Random Access Memory) · Input Devices · Output devices · Communication interfaces · Application-specific circuitry Central Processing Unit (CPU): The Central Processing Unit (processor, in short) can be any of the following: microcontroller, microprocessor or Digital Signal Processor (DSP). A micro-controller is a low-cost processor. Its main attraction is that on the chip itself, there will be many other components such as memory, serial communication interface, analog-to digital converter etc. So, for small applications, a micro-controller is the best choice as the number of external components required will be very less. On the other hand, microprocessors are more powerful, but you need to use many external components with them. D5P is used mainly for applications in which signal processing is involved such as audio and video processing. Memory:
  • 8. The memory is categorized as Random Access 11emory (RAM) and Read Only Memory (ROM). The contents of the RAM will be erased if power is switched off to the chip, whereas ROM retains the contents even if the power is switched off. So, the firmware is stored in the ROM. When power is switched on, the processor reads the ROM; the program is program is executed. Input devices: Unlike the desktops, the input devices to an embedded system have very limited capability. There will be no keyboard or a mouse, and hence interacting with the embedded system is no easy task. Many embedded systems will have a small keypad-you press one key to give a specific command. A keypad may be used to input only the digits. Many embedded systems used in process control do not have any input device for user interaction; they take inputs from sensors or transducers 1’fnd produce electrical signals that are in turn fed to other systems. Output devices: The output devices of the embedded systems also have very limited capability. Some embedded systems will have a few Light Emitting Diodes (LEDs) to indicate the health status of the system modules, or for visual indication of alarms. A small Liquid Crystal Display (LCD) may also be used to display some important parameters. Communication interfaces: The embedded systems may need to, interact with other embedded systems at they may have to transmit data to a desktop. To facilitate this, the embedded systems are provided with one or a few communication interfaces such as RS232, RS422, RS485, Universal Serial Bus (USB), IEEE 1394, Ethernet etc. Application-specific circuitry: Sensors, transducers, special processing and control circuitry may be required fat an embedded system, depending on its application. This circuitry interacts with the processor to carry out the necessary work. The entire hardware has to be given power
  • 9. supply either through the 230 volts main supply or through a battery. The hardware has to designed in such a way that the power consumption is minimized. BLOCK DIAGRAM
  • 11. POWER SUPPLY: The input to the circuit is applied from the regulated power supply. The a.c. input i.e., 230V from the mains supply is step down by the transformer to 12V and is fed to a rectifier. The output obtained from the rectifier is a pulsating d.c voltage. So in order to get a pure d.c voltage, the output voltage from the rectifier is fed to a filter to remove any a.c components present even after rectification. Now, this voltage is given to a voltage regulator to obtain a pure constant dc voltage. 230V AC 50Hz D.C Output Step down Bridge Filter Regulator transformer Rectifier Fig: Power supply Transformer: Usually, DC voltages are required to operate various electronic equipment and these voltages are 5V, 9V or 12V. But these voltages cannot be obtained directly. Thus the a.c input available at the mains supply i.e., 230V is to be brought down to the required voltage level. This is done by a transformer. Thus, a step down transformer is employed to decrease the voltage to a required level.
  • 12. Rectifier: The output from the transformer is fed to the rectifier. It converts A.C. into pulsating D.C. The rectifier may be a half wave or a full wave rectifier. In this project, a bridge rectifier is used because of its merits like good stability and full wave rectification. Filter: Capacitive filter is used in this project. It removes the ripples from the output of rectifier and smoothens the D.C. Output received from this filter is constant until the mains voltage and load is maintained constant. However, if either of the two is varied, D.C. voltage received at this point changes. Therefore a regulator is applied at the output stage. Voltage regulator: As the name itself implies, it regulates the input applied to it. A voltage regulator is an electrical regulator designed to automatically maintain a constant voltage level. In this project, power supply of 5V and 12V are required. In order to obtain these voltage levels, 7805 and 7812 voltage regulators are to be used. The first number 78 represents positive supply and the numbers 05, 12 represent the required output voltage levels. MICROCONTROLLERS:
  • 13. Microprocessors and microcontrollers are widely used in embedded systems products. Microcontroller is a programmable device. A microcontroller has a CPU in addition to a fixed amount of RAM, ROM, I/O ports and a timer embedded all on a single chip. The fixed amount of on-chip ROM, RAM and number of I/O ports in microcontrollers makes them ideal for many applications in which cost and space are critical. The Intel 8051 is Harvard architecture, single chip microcontroller (µC) which was developed by Intel in 1980 for use in embedded systems. It was popular in the 1980s and early 1990s, but today it has largely been superseded by a vast range of enhanced devices with 8051-compatible processor cores that are manufactured by more than 20 independent manufacturers including Atmel, Infineon Technologies and Maxim Integrated Products. 8051 is an 8-bit processor, meaning that the CPU can work on only 8 bits of data at a time. Data larger than 8 bits has to be broken into 8-bit pieces to be processed by the CPU. 8051 is available in different memory types such as UV-EPROM, Flash and NV- RAM. The present project is implemented on Keil Uvision. In order to program the device, Proload tool has been used to burn the program onto the microcontroller. The features, pin description of the microcontroller and the software tools used are discussed in the following sections. FEATURES OF AT89s52:
  • 14. 8K Bytes of Re-programmable Flash Memory. • RAM is 256 bytes. • 4.0V to 5.5V Operating Range. • Fully Static Operation: 0 Hz to 33 MHz’s • Three-level Program Memory Lock. • 256 x 8-bit Internal RAM. • 32 Programmable I/O Lines. • Three 16-bit Timer/Counters. • Eight Interrupt Sources. • Full Duplex UART Serial Channel. • Low-power Idle and Power-down Modes. • Interrupt recovery from power down mode. • Watchdog timer. • Dual data pointer. • Power-off flag. • Fast programming time. • Flexible ISP programming (byte and page mode). Description: The AT89s52 is a low-voltage, high-performance CMOS 8-bit microcomputer with 8K bytes of Flash programmable memory. The device is manufactured using Atmel’s high density nonvolatile memory technology and is compatible with the industry-standard MCS-51 instruction set. The on chip flash allows the program memory to be reprogrammed in system or by a conventional non volatile memory programmer. By combining a versatile 8-bit CPU with Flash on a monolithic chip, the Atmel AT89s52 is a powerful microcomputer, which provides a highly flexible and cost-effective solution to many embedded control applications.
  • 15. In addition, the AT89s52 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. Fig: Pin diagram
  • 17. PIN DESCRIPTION: Vcc Pin 40 provides supply voltage to the chip. The voltage source is +5V. GND Pin 20 is the ground. Port 0 Port 0 is an 8-bit open drain bidirectional 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 high impedance inputs. Port 0 can also be configured to be the multiplexed low-order address/ data bus during accesses to external program and data memory. In this mode, P0 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. Port 1 Port 1 is an 8-bit bidirectional 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. In addition, P1.0 and P1.1 can be configured to be the timer/counter 2 external count input (P1.0/T2) and the timer/counter 2 trigger input (P1.1/T2EX), respectively, as shown in the following table. Port 1 also receives the low-order address bytes during Flash programming and verification.
  • 18. Port 2 Port 2 is an 8-bit bidirectional 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, Port 2 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 P2 Special Function Register. The port also receives the high-order address bits and some control signals during Flash programming and verification. Port 3 Port 3 is an 8-bit bidirectional I/O port with internal pull-ups. The 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 are externally being pulled low will source current (IIL) because of the pull-ups. Port 3 receives some control signals for Flash programming and verification. Port 3 also serves the functions of various special features of the AT89S52, as shown in the following table.
  • 19. RST Reset input. A high on this pin for two machine cycles while the oscillator is running resets the device. This pin drives high for 98 oscillator periods after the Watchdog times out. The DISRTO bit in SFR AUXR (address 8EH) can be used to disable this feature. In the default state of bit DISRTO, the RESET HIGH out feature is enabled. ALE/PROG Address Latch Enable (ALE) is an 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. Note, however, that one ALE pulse is skipped during each access to external data memory. If desired, ALE operation can be disabled by setting bit 0 of SFR location 8EH. With the bit set, ALE is active only during a MOVX or MOVC instruction. Otherwise, the pin is weakly pulled high. Setting the ALE-disable bit has no effect if the microcontroller is in external execution mode.
  • 20. PSEN Program Store Enable (PSEN) is the read strobe to external program memory. When the AT89S52 is executing code from external program memory, PSEN is activated twice each machine cycle, except that two PSEN activations are skipped during each access to external data memory. EA/VPP External Access Enable. EA must be strapped to GND in order to enable the device to fetch code from external program memory locations starting at 0000H up to FFFFH. Note, however, that if lock bit 1 is programmed, EA will be internally latched on reset. EA should be strapped to VCC for internal program executions. This pin also receives the 12-volt programming enable voltage (VPP) during Flash programming. XTAL1 Input to the inverting oscillator amplifier and input to the internal clock operating circuit. XTAL2 Output from the inverting oscillator amplifier. Oscillator Connections C1, C2 = 30 pF ± 10 pF for Crystals = 40 pF ± 10 pF for Ceramic Resonators External Clock Drive Configuration
  • 21. XTAL1 and XTAL2 are the input and output, respectively, of an inverting amplifier that can be configured for use as an on-chip oscillator. Either a quartz crystal or ceramic resonator may be used. To drive the device from an external clock source, XTAL2 should be left unconnected while XTAL1 is driven. There are no requirements on the duty cycle of the external clock signal, since the input to the internal clocking circuitry is through a divide-by-two flip-flop, but minimum and maximum voltage high and low time specifications must be observed. Special Function Registers A map of the on-chip memory area called the Special Function Register (SFR) space is shown in the following table. It should be noted that not all of the addresses are occupied and unoccupied addresses may not be implemented on the chip. Read accesses to these addresses will in general return random data, and write accesses will have an indeterminate effect. User software should not write 1s to these unlisted locations, since they may be used in future products to invoke new features. In that case, the reset or inactive values of the new bits will always be 0. Timer 2 Registers:
  • 22. Control and status bits are contained in registers T2CON and T2MOD for Timer 2. The register pair (RCAP2H, RCAP2L) is the Capture/Reload register for Timer 2 in 16-bit capture mode or 16-bit auto-reload mode. Interrupt Registers: The individual interrupt enable bits are in the IE register. Two priorities can be set for each of the six interrupt sources in the IP register.
  • 23.
  • 24.
  • 25. Dual Data Pointer Registers: To facilitate accessing both internal and external data memory, two banks of 16-bit Data Pointer Registers are provided: DP0 at SFR address locations 82H-83H and DP1 at 84H and 85H. Bit DPS = 0 in SFR AUXR1 selects DP0 and DPS = 1 selects DP1. The user should ALWAYS initialize the DPS bit to the appropriate value before accessing the respective Data Pointer Register. Power Off Flag: The Power Off Flag (POF) is located at bit 4 (PCON.4) in the PCON SFR. POF is set to “1” during power up. It can be set and rest under software control and is not affected by reset.
  • 26. Memory Organization MCS-51 devices have a separate address space for Program and Data Memory. Up to 64K bytes each of external Program and Data Memory can be addressed. Program Memory If the EA pin is connected to GND, all program fetches are directed to external memory. On the AT89S52, if EA is connected to VCC, program fetches to addresses 0000H through 1FFFH are directed to internal memory and fetches to addresses 2000H through FFFFH are to external memory. Data Memory The AT89S52 implements 256 bytes of on-chip RAM. The upper 128 bytes occupy a parallel address space to the Special Function Registers. This means that the upper 128 bytes have the same addresses as the SFR space but are physically separate from SFR space. When an instruction accesses an internal location above address 7FH, the address mode used in the instruction specifies whether the CPU accesses the upper 128 bytes of RAM or the SFR space. Instructions which use direct addressing access the SFR space.
  • 27. For example, the following direct addressing instruction accesses the SFR at location 0A0H (which is P2). MOV 0A0H, #data Instructions that use indirect addressing access the upper 128 bytes of RAM. For example, the following indirect addressing instruction, where R0 contains 0A0H, accesses the data byte at address 0A0H, rather than P2 (whose address is 0A0H). MOV @R0, #data Note that stack operations are examples of indirect addressing, so the upper 128 bytes of data RAM are available as stack space. Watchdog Timer (One-time Enabled with Reset-out) The WDT is intended as a recovery method in situations where the CPU may be subjected to software upsets. The WDT consists of a 14-bit counter and the Watchdog Timer Reset (WDTRST) SFR. The WDT is defaulted to disable from exiting reset. To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, it will increment every machine cycle while the oscillator is running. The WDT timeout period is dependent on the external clock frequency. There is no way to disable the WDT except through reset (either hardware reset or WDT overflow reset). When WDT overflows, it will drive an output RESET HIGH pulse at the RST pin.
  • 28. Using the WDT To enable the WDT, a user must write 01EH and 0E1H in sequence to the WDTRST register (SFR location 0A6H). When the WDT is enabled, the user needs to service it by writing 01EH and 0E1H to WDTRST to avoid a WDT overflow. The 14-bit counter overflows when it reaches 16383 (3FFFH), and this will reset the device. When the WDT is enabled, it will increment every machine cycle while the oscillator is running. This means the user must reset the WDT at least every 16383 machine cycles. To reset the WDT the user must write 01EH and 0E1H to WDTRST. WDTRST is a write-only register. The WDT counter cannot be read or written. When WDT overflows, it will generate an output RESET pulse at the RST pin. The RESET pulse duration is 98xTOSC, where TOSC = 1/FOSC. To make the best use of the WDT, it should be serviced in those sections of code that will periodically be executed within the time required to prevent a WDT reset. WDT during Power-down and Idle In Power-down mode the oscillator stops, which means the WDT also stops. While in Power down mode, the user does not need to service the WDT. There are two methods of exiting Power-down mode: by a hardware reset or via a level-activated external interrupt which is enabled prior to entering Power-down mode. When Power-down is exited with hardware reset, servicing the WDT should occur as it normally does whenever the AT89S52 is reset. Exiting Power-down with an interrupt is significantly different. The interrupt is held low long enough for the oscillator to stabilize. When the interrupt is brought high, the interrupt is serviced. To prevent the WDT from resetting the device while the interrupt pin is held low, the WDT is not started until the interrupt is pulled high. It is suggested that the WDT be reset during the interrupt service for the interrupt used to exit Power-down mode. To ensure that the WDT does not overflow within a few states of exiting Power-down, it is best to reset the WDT just before entering Power-down mode.
  • 29. Before going into the IDLE mode, the WDIDLE bit in SFR AUXR is used to determine whether the WDT continues to count if enabled. The WDT keeps counting during IDLE (WDIDLE bit = 0) as the default state. To prevent the WDT from resetting the AT89S52 while in IDLE mode, the user should always set up a timer that will periodically exit IDLE, service the WDT, and reenter IDLE mode. With WDIDLE bit enabled, the WDT will stop to count in IDLE mode and resumes the count upon exit from IDLE. UART The Atmel 80C51 Microcontrollers implement three general purpose, 16-bit timers/ counters. They are identified as Timer 0, Timer 1 and Timer 2 and can be independently configured to operate in a variety of modes as a timer or as an event counter. When operating as a timer, the timer/counter runs for a programmed length of time and then issues an interrupt request. When operating as a counter, the timer/counter counts negative transitions on an external pin. After a preset number of counts, the counter issues an interrupt request. The various operating modes of each timer/counter are described in the following sections. A basic operation consists of timer registers THx and TLx (x= 0, 1) connected in cascade to form a 16-bit timer. Setting the run control bit (TRx) in TCON register turns the timer on by allowing the selected input to increment TLx. When TLx overflows it increments THx; when THx overflows it sets the timer overflow flag (TFx) in TCON register. Setting the TRx does not clear the THx and TLx timer registers. Timer registers can be accessed to obtain the current count or to enter preset values. They can be read at any time but TRx bit must be cleared to preset their values, otherwise the behavior of the timer/counter is unpredictable. The C/Tx# control bit (in TCON register) selects timer operation, or counter operation, by selecting the divided-down peripheral clock or external pin Tx as the source for the counted signal. TRx bit must be cleared when changing the mode of operation, otherwise the behavior of the timer/counter is unpredictable. For timer operation (C/Tx# = 0), the
  • 30. timer register counts the divided-down peripheral clock. The timer register is incremented once every peripheral cycle (6 peripheral clock periods). The timer clock rate is FPER / 6, i.e. FOSC / 12 in standard mode or FOSC / 6 in X2 mode. For counter operation (C/Tx# = 1), the timer register counts the negative transitions on the Tx external input pin. The external input is sampled every peripheral cycle. When the sample is high in one cycle and low in the next one, the counter is incremented. Since it takes 2 cycles (12 peripheral clock periods) to recognize a negative transition, the maximum count rate is FPER / 12, i.e. FOSC / 24 in standard mode or FOSC / 12 in X2 mode. There are no restrictions on the duty cycle of the external input signal, but to ensure that a given level is sampled at least once before it changes, it should be held for at least one full peripheral cycle. In addition to the “timer” or “counter” selection, Timer 0 and Timer 1 have four operating modes from which to select which are selected by bit- pairs (M1, M0) in TMOD. Modes 0, 1and 2 are the same for both timer/counters. Mode 3 is different. The four operating modes are described below. Timer 2, has three modes of operation: ‘capture’, ‘auto-reload’ and ‘baud rate generator’. Timer 0 Timer 0 functions as either a timer or event counter in four modes of operation. Timer 0 is controlled by the four lower bits of the TMOD register and bits 0, 1, 4 and 5 of the TCON register. TMOD register selects the method of timer gating (GATE0), timer or counter operation (T/C0#) and mode of operation (M10 and M00). The TCON register provides timer 0 control functions: overflow flag (TF0), run control bit (TR0), interrupt flag (IE0) and interrupt type control bit (IT0). For normal timer operation (GATE0= 0), setting TR0 allows TL0 to be incremented by
  • 31. the selected input. Setting GATE0 and TR0 allows external pin INT0# to control timer operation. Timer 0 overflow (count rolls over from all 1s to all 0s) sets TF0 flag, generating an interrupt request. It is important to stop timer/counter before changing mode. Mode 0 (13-bit Timer) Mode 0 configures timer 0 as a 13-bit timer which is set up as an 8-bit timer (TH0 register) with a modulo 32 prescaler implemented with the lower five bits of the TL0 register. The upper three bits of TL0 register are indeterminate and should be ignored. Prescaler overflow increments the TH0 register. As the count rolls over from all 1’s to all 0’s, it sets the timer interrupt flag TF0. The counted input is enabled to the Timer when TR0 = 1 and either GATE = 0 or INT0 = 1. (Setting GATE = 1 allows the Timer to be controlled by external input INT0, to facilitate pulse width measurements). TR0 is a control bit in the Special Function register TCON. GATE is in TMOD. The 13-bit register consists of all 8 bits of TH0 and the lower 5 bits of TL0. The upper 3 bits of TL0 are indeterminate and should be ignored. Setting the run flag (TR0) does not clear the registers. Mode 0 operation is the same for Timer 0 as for Timer 1. There are two different GATE bits, one for Timer 1 (TMOD.7) and one for Timer 0 (TMOD.3). Timer/Counter x (x = 0 or 1) in Mode 0
  • 32. Mode 1 (16-bit Timer) Mode 1 is the same as Mode 0, except that the Timer register is being run with all 16 bits. Mode 1 configures timer 0 as a 16-bit timer with the TH0 and TL0 registers connected in cascade. The selected input increments the TL0 register. Timer/Counter x (x = 0 or 1) in Mode 1 Mode 2 (8-bit Timer with Auto-Reload) Mode 2 configures timer 0 as an 8-bit timer (TL0 register) that automatically reloads from the TH0 register. TL0 overflow sets TF0 flag in the TCON register and reloads TL0 with the contents of TH0, which is preset by software. When the interrupt request is serviced, hardware clears TF0. The reload leaves TH0 unchanged. The next reload value may be changed at any time by writing it to the TH0 register. Mode 2 operation is the same for Timer/Counter 1. Timer/Counter x (x = 0 or 1) in Mode 2
  • 33. Mode 3 (Two 8-bit Timers) Mode 3 configures timer 0 so that registers TL0 and TH0 operate as separate 8-bit timers. This mode is provided for applications requiring an additional 8-bit timer or counter. TL0 uses the timer 0 control bits C/T0# and GATE0 in the TMOD register, and TR0 and TF0 in the TCON register in the normal manner. TH0 is locked into a timer function (counting FPER /6) and takes over use of the timer 1 interrupt (TF1) and run control (TR1) bits. Thus, operation of timer 1 is restricted when timer 0 is in mode 3. Timer/Counter 0 in Mode 3: Two 8-bit Counters Timer 1 Timer 1 is identical to timer 0, except for mode 3, which is a hold-count mode. The following comments help to understand the differences: • Timer 1 functions as either a timer or event counter in three modes of operation. Timer 1’s mode 3 is a hold-count mode. • Timer 1 is controlled by the four high-order bits of the TMOD register and bits 2, 3, 6 and 7 of the TCON register. The TMOD register selects the method of timer gating
  • 34. (GATE1), timer or counter operation (C/T1#) and mode of operation (M11 and M01). The TCON register provides timer 1 control functions: overflow flag (TF1), run control bit (TR1), interrupt flag (IE1) and interrupt type control bit (IT1). • Timer 1 can serve as the baud rate generator for the serial port. Mode 2 is best suited for this purpose. • For normal timer operation (GATE1 = 0), setting TR1 allows TL1 to be incremented by the selected input. Setting GATE1 and TR1 allows external pin INT1# to control timer operation. • Timer 1 overflow (count rolls over from all 1s to all 0s) sets the TF1 flag generating an interrupt request. • When timer 0 is in mode 3, it uses timer 1’s overflow flag (TF1) and run control bit (TR1). For this situation, use timer 1 only for applications that do not require an interrupt (such as a baud rate generator for the serial port) and switch timer 1 in and out of mode 3 to turn it off and on. • It is important to stop timer/counter before changing modes. Mode 0 (13-bit Timer) Mode 0 configures Timer 1 as a 13-bit timer, which is set up as an 8-bit timer (TH1 register) with a modulo-32 prescaler implemented with the lower 5 bits of the TL1 register. The upper 3 bits of the TL1 register are ignored. Prescaler overflow increments the TH1 register. Mode 1 (16-bit Timer) Mode 1 configures Timer 1 as a 16-bit timer with the TH1 and TL1 registers connected in cascade. The selected input increments the TL1 register. Mode 2 (8-bit Timer with Auto Reload) Mode 2 configures Timer 1 as an 8-bit timer (TL1 register) with automatic reload from the TH1 register on overflow. TL1 overflow sets the TF1 flag in the TCON register and reloads TL1 with the contents of TH1, which is preset by software. The reload leaves TH1 unchanged.
  • 35. Mode 3 (Halt) Placing Timer 1 in mode 3 causes it to halt and hold its count. This can be used to halt Timer 1 when TR1 run control bit is not available i.e., when Timer 0 is in mode 3. Timer 2 Timer 2 is a 16-bit Timer/Counter that can operate as either a timer or an event counter. The type of operation is selected by bit C/T2 in the SFR T2CON (shown in Table 5-2). Timer 2 has three operating modes: capture, auto-reload (up or down counting), and baud rate generator. The modes are selected by bits in T2CON, as shown in Table 10-1. Timer 2 consists of two 8-bit registers, TH2 and TL2. In the Timer function, the TL2 register is incremented every machine cycle. Since a machine cycle consists of 12 oscillator periods, the count rate is 1/12 of the oscillator frequency. In the Counter function, the register is incremented in response to a 1-to-0 transition at its corresponding external input pin, T2. In this function, the external input is sampled during S5P2 of every machine cycle. When the samples show a high in one cycle and a low in the next cycle, the count is incremented. The new count value appears in the register during S3P1 of the cycle following the one in which the transition was detected. Since two machine cycles (24 oscillator periods) are required to recognize a 1-to-0 transition, the maximum count rate is 1/24 of the oscillator frequency. To ensure that a given level is sampled at least once before it changes, the level should be held for at least one full machine cycle.
  • 36. Capture Mode In the capture mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 is a 16-bit timer or counter which upon overflow sets bit TF2 in T2CON. This bit can then be used to generate an interrupt. If EXEN2 = 1, Timer 2 performs the same operation, but a 1-to-0 transition at external input T2EX also causes the current value in TH2 and TL2 to be captured into RCAP2H and RCAP2L, respectively. In addition, the transition at T2EX causes bit EXF2 in T2CON to be set. The EXF2 bit, like TF2, can generate an interrupt. Timer in Capture Mode Auto-reload (Up or Down Counter) Timer 2 can be programmed to count up or down when configured in its 16-bit auto- reload mode. This feature is invoked by the DCEN (Down Counter Enable) bit located in the SFR T2MOD. Upon reset, the DCEN bit is set to 0 so that timer 2 will default to count up. When DCEN is set, Timer 2 can count up or down, depending on the value of the T2EX pin.
  • 37. T2MOD – Timer 2 Mode Control Register The above figure shows Timer 2 automatically counting up when DCEN = 0. In this mode, two options are selected by bit EXEN2 in T2CON. If EXEN2 = 0, Timer 2 counts up to 0FFFFH and then sets the TF2 bit upon overflow. The overflow also causes the timer registers to be reloaded with the 16-bit value in RCAP2H and RCAP2L. The values in Timer in Capture ModeRCAP2H and RCAP2L are preset by software. If EXEN2 = 1, a 16-bit reload can be triggered either by an overflow or by a 1-to-0 transition at external input T2EX. This transition also sets the EXF2 bit. Both the TF2 and EXF2 bits can generate an interrupt if enabled. Setting the DCEN bit enables Timer 2 to count up or down, as shown in Figure 10-2. In this mode, the T2EX pin controls the direction of the count. A logic 1 at T2EX makes Timer 2 count up. The timer will overflow at 0FFFFH and set the TF2 bit. This overflow also causes the 16-bit value in RCAP2H and RCAP2L to be reloaded into the timer registers, TH2 and TL2, respectively. A logic 0 at T2EX makes Timer 2 count down. The timer underflows when TH2 and TL2 equal the values stored in RCAP2H and RCAP2L. The underflow sets the TF2 bit and causes 0FFFFH to be reloaded into the timer registers. The EXF2 bit toggles whenever Timer 2 overflows or underflows and can be used as a 17th bit of resolution. In this operating mode, EXF2 does not flag an interrupt.
  • 38. Baud Rate Generator Timer 2 is selected as the baud rate generator by setting TCLK and/or RCLK in T2CON. Note that the baud rates for transmit and receive can be different if Timer 2 is used for the receiver or transmitter and Timer 1 is used for the other function. Setting RCLK and/or TCLK puts Timer 2 into its baud rate generator mode.
  • 39. The baud rate generator mode is similar to the auto-reload mode, in that a rollover in TH2 causes the Timer 2 registers to be reloaded with the 16-bit value in registers RCAP2H and RCAP2L, which are preset by software. The baud rates in Modes 1 and 3 are determined by Timer 2’s overflow rate according to the following equation. The Timer can be configured for either timer or counter operation. In most applications, it is configured for timer operation (CP/T2 = 0). The timer operation is different for Timer 2 when it is used as a baud rate generator. Normally, as a timer, it increments every machine cycle (at 1/12 the oscillator frequency). As a baud rate generator, however, it increments every state time (at 1/2 the oscillator frequency). The baud rate formula is given below. Where (RCAP2H, RCAP2L) is the content of RCAP2H and RCAP2L taken as a 16-bit unsigned integer. Timer 2 as a baud rate generator is shown in the below figure. This figure is valid only if RCLK or TCLK = 1 in T2CON. Note that a rollover in TH2 does not set TF2 and will not generate an interrupt. Note too, that if EXEN2 is set, a 1-to-0 transition in T2EX will set EXF2 but will not cause a reload from (RCAP2H, RCAP2L) to (TH2, TL2). Thus, when Timer 2 is in use as a baud rate generator, T2EX can be used as an extra external interrupt. Note that when Timer 2 is running (TR2 = 1) as a timer in the baud rate generator mode, TH2 or TL2 should not be read from or written to. Under these conditions, the Timer is
  • 40. incremented every state time, and the results of a read or write may not be accurate. The RCAP2 registers may be read but should not be written to, because a write might overlap a reload and cause write and/or reload errors. The timer should be turned off (clear TR2) before accessing the Timer 2 or RCAP2 registers. Timer 2 in Baud Rate Generator Mode Programmable Clock Out A 50% duty cycle clock can be programmed to come out on P1.0, as shown in the below figure. This pin, besides being a regular I/O pin, has two alternate functions. It can be programmed to input the external clock for Timer/Counter 2 or to output a 50% duty cycle clock ranging from 61 Hz to 4 MHz (for a 16-MHz operating frequency).
  • 41. Timer 2 in Clock-Out Mode To configure the Timer/Counter 2 as a clock generator, bit C/T2 (T2CON.1) must be cleared and bit T2OE (T2MOD.1) must be set. Bit TR2 (T2CON.2) starts and stops the timer. The clock-out frequency depends on the oscillator frequency and the reload value of Timer 2 capture registers (RCAP2H, RCAP2L), as shown in the following equation. In the clock-out mode, Timer 2 roll-overs will not generate an interrupt. This behavior is similar to when Timer 2 is used as a baud-rate generator. It is possible to use Timer 2 as a baud-rate generator and a clock generator simultaneously. Note, however, that the baud rate and clock-out frequencies cannot be determined independently from one another since they both use RCAP2H and RCAP2L. Interrupts
  • 42. The AT89S52 has a total of six interrupt vectors: two external interrupts (INT0 and INT1), three timer interrupts (Timers 0, 1, and 2), and the serial port interrupt. These interrupts are all shown in Figure 13-1. Each of these interrupt sources can be individually enabled or disabled by setting or clearing a bit in Special Function Register IE. IE also contains a global disable bit, EA, which disables all interrupts at once. Note that Table 13-1 shows that bit position IE.6 is unimplemented. User software should not write a 1 to this bit position, since it may be used in future AT89 products. Timer 2 interrupt is generated by the logical OR of bits TF2 and EXF2 in register T2CON. Neither of these flags is cleared by hardware when the service routine is vectored to. In fact, the service routine may have to determine whether it was TF2 or EXF2 that generated the interrupt, and that bit will have to be cleared in software. The Timer 0 and Timer 1 flags, TF0 and TF1, are set at S5P2 of the cycle in which the timers overflow. The values are then polled by the circuitry in the next cycle. However, the Timer 2 flag, TF2, is set at S2P2 and is polled in the same cycle in which the timer overflows.
  • 43.
  • 44. Idle Mode In idle mode, the CPU puts itself to sleep while all the on-chip peripherals remain active. The mode is invoked by software. The content of the on-chip RAM and all the special functions registers remain unchanged during this mode. The idle mode can be terminated by any enabled interrupt or by a hardware reset. Note that when idle mode is terminated by a hardware reset, the device normally resumes program execution from where it left off, up to two machine cycles before the internal reset algorithm takes control. On-chip hardware inhibits access to internal RAM in this event, but access to the port pins is not inhibited. To eliminate the possibility of an unexpected write to a port pin when idle mode is terminated by a reset, the instruction following the one that invokes idle mode should not write to a port pin or to external memory. Power-down Mode In the Power-down mode, the oscillator is stopped, and the instruction that invokes Power-down is the last instruction executed. The on-chip RAM and Special Function Registers retain their values until the Power-down mode is terminated. Exit from Power down mode can be initiated either by a hardware reset or by an enabled external interrupt. Reset redefines the SFRs but does not change the on-chip RAM. The reset should not be activated before VCC is restored to its normal operating level and must be held active long enough to allow the oscillator to restart and stabilize. Status of External Pins During Idle and Power-down Modes Program Memory Lock Bits
  • 45. The AT89S52 has three lock bits that can be left un programmed (U) or can be programmed (P) to obtain the additional features listed in the table. Lock Bit Protection Modes When lock bit 1 is programmed, the logic level at the EA pin is sampled and latched during reset. If the device is powered up without a reset, the latch initializes to a random value and holds that value until reset is activated. The latched value of EA must agree with the current logic level at that pin in order for the device to function properly. Programming the Flash – Parallel Mode The AT89S52 is shipped with the on-chip Flash memory array ready to be programmed. The programming interface needs a high-voltage (12-volt) program enable signal and is compatible with conventional third-party Flash or EPROM programmers. The AT89S52 code memory array is programmed byte-by-byte. Programming Algorithm: Before programming the AT89S52, the address, data, and control signals should be set up according to the “Flash Programming Modes”. To program the AT89S52, take the following steps: 1. Input the desired memory location on the address lines. 2. Input the appropriate data byte on the data lines. 3. Activate the correct combination of control signals. 4. Raise EA/VPP to 12V. 5. Pulse ALE/PROG once to program a byte in the Flash array or the lock bits. The byte write cycle is self-timed and typically takes no more than 50 µs. Repeat steps 1 through
  • 46. 5, changing the address and data for the entire array or until the end of the object file is reached. Data Polling: The AT89S52 features Data Polling to indicate the end of a byte write cycle. During a write cycle, an attempted read of the last byte written will result in the complement of the written data on P0.7. Once the write cycle has been completed, true data is valid on all outputs, and the next cycle may begin. Data Polling may begin any time after a write cycle has been initiated. Ready/Busy: The progress of byte programming can also be monitored by the RDY/BSY output signal. P3.0 is pulled low after ALE goes high during programming to indicate BUSY. P3.0 is pulled high again when programming is done to indicate READY. 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 status of the individual lock bits can be verified directly by reading them back. Reading the Signature Bytes: The signature bytes are read by the same procedure as a normal verification of locations 000H, 100H, and 200H, except that P3.6 and P3.7 must be pulled to a logic low. The values returned are as follows. (000H) = 1EH indicates manufactured by Atmel (100H) = 52H indicates AT89S52 (200H) = 06H Chip Erase:
  • 47. In the parallel programming mode, a chip erase operation is initiated by using the proper combination of control signals and by pulsing ALE/PROG low for a duration of 200 ns - 500 ns. In the serial programming mode, a chip erase operation is initiated by issuing the Chip Erase instruction. In this mode, chip erase is self-timed and takes about 500 ms. During chip erase, a serial read from any address location will return 00H at the data output. Programming the Flash – Serial Mode The Code memory array can be programmed using the serial ISP interface while RST is pulled to VCC. The serial interface consists of pins SCK, MOSI (input) and MISO (output). After RST is set high, the Programming Enable instruction needs to be executed first before other operations can be executed. Before a reprogramming sequence can occur, a Chip Erase operation is required. The Chip Erase operation turns the content of every memory location in the Code array into FFH. Either an external system clock can be supplied at pin XTAL1 or a crystal needs to be connected across pins XTAL1 and XTAL2. The maximum serial clock (SCK) frequency should be less than 1/16 of the crystal frequency. With a 33 MHz oscillator clock, the maximum SCK frequency is 2 MHz. Serial Programming Algorithm To program and verify the AT89S52 in the serial programming mode, the following sequence is recommended: 1. Power-up sequence: a. Apply power between VCC and GND pins. b. Set RST pin to “H”.
  • 48. If a crystal is not connected across pins XTAL1 and XTAL2, apply a 3 MHz to 33 MHz clock to XTAL1 pin and wait for at least 10 milliseconds. 2. Enable serial programming by sending the Programming Enable serial instruction to pin MOSI/P1.5. The frequency of the shift clock supplied at pin SCK/P1.7 needs to be less than the CPU clock at XTAL1 divided by 16. 3. The Code array is programmed one byte at a time in either the Byte or Page mode. The write cycle is self-timed and typically takes less than 0.5 ms at 5V. 4. Any memory location can be verified by using the Read instruction which returns the content at the selected address at serial output MISO/P1.6. 5. At the end of a programming session, RST can be set low to commence normal device operation. Power-off sequence (if needed): 1. Set XTAL1 to “L” (if a crystal is not used). 2. Set RST to “L”. 3. Turn VCC power off. Data Polling: The Data Polling feature is also available in the serial mode. In this mode, during a write cycle an attempted read of the last byte written will result in the complement of the MSB of the serial output byte on MISO. Serial Programming Instruction Set The Instruction Set for Serial Programming follows a 4-byte protocol and is shown in the table given below.
  • 49. Serial Programming Instruction Set Programming Interface – Parallel Mode Every code byte in the Flash array can be programmed by using the appropriate combination of control signals. The write operation cycle is self-timed and once initiated, will automatically time itself to completion.
  • 51. After Reset signal is high, SCK should be low for at least 64 system clocks before it goes high to clock in the enable data bytes. No pulsing of Reset signal is necessary. SCK should be no faster than 1/16 of the system clock at XTAL1. For Page Read/Write, the data always starts from byte 0 to 255. After the command byte and upper address byte are latched, each byte thereafter is treated as data until all 256 bytes are shifted in/out. Then the next instruction will be ready to be decoded.
  • 52. Switches and Pushbuttons There is nothing simpler than this! This is the simplest way of controlling appearance of some voltage on microcontroller’s input pin. There is also no need for additional explanation of how these components operate. Nevertheless, it is not so simple in practice... This is about something commonly unnoticeable when using these components in everyday life. It is about contact bounce- a common problem with m e c h a n i c a l switches. If contact switching does not happen so quickly, several consecutive bounces can be noticed prior to maintain stable state. The reasons for this are: vibrations, slight rough spots and dirt. Anyway, whole this process does not last long (a few micro- or miliseconds), but long enough to be registered by the microcontroller. Concerning pulse counter, error occurs in almost 100% of cases!
  • 53. The simplest solution is to connect simple RC circuit which will “suppress” each quick voltage change. Since the bouncing time is not defined, the values of elements are not strictly determined. In the most cases, the values shown on figure are sufficient. If complete safety is needed, radical measures should be taken! The circuit, shown on the figure (RS flip-flop), changes logic state on its output with the first pulse triggered by contact bounce. Even though this is more expensive solution (SPDT switch), the problem is definitely resolved! Besides, since the condensator is not used, very short pulses can be also registered in this way. In addition to these hardware solutions, a simple software solution is commonly applied too: when a program tests the state of some input pin and finds changes, the check should be done one more time after certain time delay. If the change is confirmed it means that switch (or pushbutton) has changed its position. The advantages of such solution are obvious: it is free of charge, effects of disturbances are eliminated too and it can be adjusted to the worst-quality contacts. AUTO DIALER: The very simplest working telephone would look like this inside:
  • 54. As you can see, it only contains three parts and they are all simple: • A switch to connect and disconnect the phone from the network - This switch is generally called the hook switch. It connects when you lift the handset. • A speaker - This is generally a little 50-cent, 8-ohm speaker of some sort. • A microphone - In the past, telephone microphones have been as simple as carbon granules compressed between two thin metal plates. Sound waves from your voice compress and decompress the granules, changing the resistance of the granules and modulating the current flowing through the microphone. Most people find that annoying, so any "real" phone contains a device called a duplex coil or something functionally equivalent to block the sound of your own voice from reaching your ear. A modern telephone also includes a bell so it can ring and a touch- tone keypad and frequency generator. A "real" phone looks like this:
  • 55. A "real" telephone Still, it's pretty simple. In a modern phone there is an electronic microphone, amplifier and circuit to replace the carbon granules and loading coil. The mechanical bell is often replaced by a speaker and a circuit to generate a pleasant ringing tone. Here in our project we will be replacing the HOOK SWITCH with a RELAY so that the switching can be controlled with the microcontroller itself. That is nothing but we are connecting to the telephone line when ever we want by just activating that relay. Redial: The telephone stores in memory the last number you called. The number will remain in the Redial memory until you dial another number. To dial the same number again 1. Lift the handset or press your telephone's Hands free button. 2. Listen for the dial tone, and press Redial. This is done manually but as we want all this to be done automatically we will be replacing the redial button with another RELAY. Here we are using two relays for
  • 56. controlling the ON and OFF of the phone and for redialing. So now every thing is automatic as the relays are being controlled by the microcontroller itself. RELAYS: A relay is an electrically controllable switch widely used in industrial controls, automobiles and appliances. The relay allows the isolation of two separate sections of a system with two different voltage sources i.e., a small amount of voltage/current on one side can handle a large amount of voltage/current on the other side but there is no chance that these two voltages mix up. Inductor Fig: Circuit symbol of a relay Operation:
  • 57. When current flows through the coil, a magnetic field is created around the coil i.e., the coil is energized. This causes the armature to be attracted to the coil. The armature’s contact acts like a switch and closes or opens the circuit. When the coil is not energized, a spring pulls the armature to its normal state of open or closed. There are all types of relays for all kinds of applications. Fig: Relay Operation and use of protection diodes Transistors and ICs must be protected from the brief high voltage 'spike' produced when the relay coil is switched off. The above diagram shows how a signal diode (eg 1N4148) is connected across the relay coil to provide this protection. The diode is connected 'backwards' so that it will normally not conduct. Conduction occurs only when the relay coil is switched off, at this moment the current tries to flow continuously through the coil and it is safely diverted through the diode. Without the diode no current could flow and the coil would produce a damaging high voltage 'spike' in its attempt to keep the current flowing. In choosing a relay, the following characteristics need to be considered:
  • 58. 1. The contacts can be normally open (NO) or normally closed (NC). In the NC type, the contacts are closed when the coil is not energized. In the NO type, the contacts are closed when the coil is energized. 2. There can be one or more contacts. i.e., different types like SPST (single pole single throw), SPDT (single pole double throw) and DPDT (double pole double throw) relays. 3. The voltage and current required to energize the coil. The voltage can vary from a few volts to 50 volts, while the current can be from a few milliamps to 20milliamps. The relay has a minimum voltage, below which the coil will not be energized. This minimum voltage is called the “pull-in” voltage. 4. The minimum DC/AC voltage and current that can be handled by the contacts. This is in the range of a few volts to hundreds of volts, while the current can be from a few amps to 40A or more, depending on the relay. SENSOR BOARD: The different sensors used in this project are as follows: 1. REED SWITCHES or MAGNETIC SENSORS 2. LED & LDR section 3. TEMPERATURE SENSOR 4. PANIC SWITCH 5. IR tx AND IR rx. Let us see the description of each sensor.
  • 59. REED SWITCHES OR MAGNETIC SENSORS: The reed switch is an electrical switch operated by an applied magnetic field. The basic reed switch consists of two identical flattened ferromagnetic reeds, sealed in a dry inert- gas atmosphere within a glass capsule, thereby protecting the contact from contamination. The reeds are sealed in the capsule in such a way that their free ends overlap and are separated by a small air gap. Fig: Reed Switch The contacts may be normally open, closing when a magnetic field is present, or normally closed and opening when a magnetic field is applied. A magnetic field from an electromagnet or a permanent magnet will cause the contacts to pull together, thus completing an electrical circuit. The stiffness of the reeds causes them to separate, and open the circuit, when the magnetic field ceases. Good electrical contact is assured by plating a thin layer of precious metal over the flat contact portions of the reeds. Since the contacts of the reed switch are sealed away from the atmosphere, they are protected against atmospheric corrosion. The hermetic sealing of a reed switch makes
  • 60. them suitable for use in explosive atmospheres where tiny sparks from conventional switches would constitute a hazard. REED SENSOR: A reed sensor is a device built using a reed switch with additional functionality like ability to withstand higher shock, easier mounting, additional intelligent circuitry, etc. In production, a metal reed is inserted in each end of a glass tube and the end of the tube heated so that it seals around a shank portion on the reed. Infrared-absorbing glass is used, so an infrared heat source can concentrate the heat in the small sealing zone of the glass tube. The thermal coefficient of expansion of the glass material and metal parts must be similar to prevent breaking the glass-to-metal seal. The glass used must have a high electrical resistance and must not contain volatile components such as lead oxide and fluorides. The leads of the switch must be handled carefully to prevent breaking the glass envelope. How does a reed switch work? When a magnetic force is generated parallel to the reed switch, the reeds become flux carriers in the magnetic circuit. The overlapping ends of the reeds become opposite magnetic poles, which attract each other. If the magnetic force between the poles is strong enough to overcome the restoring force of the reeds, the reeds will be drawn together. One important quality of the switch is its sensitivity, the amount of magnetic energy necessary to actuate it. Sensitivity is measured in units of Ampere-turns, corresponding to the current in a coil multiplied by the number of turns. Typical pull-in sensitivities for commercial devices are in the 10 to 60 AT range.
  • 61. Uses: Reed switches are widely used for electrical circuit control, particularly in the communications field. Reed switches are commonly used in mechanical systems as proximity switches as well as in door and window sensors in burglar alarm systems and tamper proofing methods. These were formerly used in the keyboards for computer terminals, where each key had a magnet and a reed switch actuated by depressing the key. Speed sensors on bicycles use a reed switch to detect when the magnet on the wheel passes the sensor. Advantages: 1. They are hermetically sealed in glass environment. 2. Free from contamination, and are safe to use in harsh industrial and explosive environments. 3. Reed switches are immune to electrostatic discharge (ESD) and do not require any external ESD protection circuits. The isolation resistance between the contacts is as high as 1015 ohms, and contact resistance is as low as 50 milliohms. 4. They can directly switch loads as low as a few microwatts without the help of external amplification circuits, to as high as 120W. 5. When the reed switches are combined with magnets and coils, they can be used to form many different types of relays. The arrangement of the reed switch in our project is as shown in the figure above. We will be using two reed switches, one at the door and other at the window.
  • 62. LED AND LDR SECTION: LDR: LDRs or Light Dependent Resistors are very useful especially in light/dark sensor circuits. Normally the resistance of an LDR is very high, sometimes as high as 1000 000 ohms, but when they are illuminated with light resistance drops dramatically.
  • 63. When the light level is low the resistance of the LDR is high. This prevents current from flowing to the base of the transistors. Consequently the LED does not light. However, when light shines onto the LDR its resistance falls and current flows into the base of the first transistor and then the second transistor. The LED lights. Here in our project to avoid the light from led to fall on to LDR we place a box in which we will keep our jewelry. If any one removes the box the light from led falls directly on to the LDR and then the transistor will be on which is monitored by the microcontroller. Temperature Sensor: A sensor can be defined as a device which can convert one form of energy into electrical energy. Here we are using a sensor to sense the temperature around us. For this purpose we will be taking help of LM 35 which is a temperature sensor. LM35: The LM35 series are precision integrated-circuit temperature sensors, whose output voltage is linearly proportional to the Celsius (Centigrade) temperature. The LM35 thus has an advantage over linear temperature sensors calibrated in ° Kelvin, as the user is not
  • 64. required to subtract a large constant voltage from its output to obtain convenient Centigrade scaling. The LM35 does not require any external calibration or trimming to provide typical accuracies of ±1⁄4°C at room temperature and ±3⁄4°C over a full −55 to +150°C temperature range. Low cost is assured by trimming and calibration at the wafer level. The LM35’s low output impedance, linear output, and precise inherent calibration make interfacing to readout or control circuitry especially easy. It can be used with single power supplies, or with plus and minus supplies. As it draws only 60 μA from its supply, it has very low self-heating, less than 0.1°C in still air. The LM35 is rated to operate over a −55° to +150°C temperature range. Features • Calibrated directly in ° Celsius (Centigrade) • Linear + 10.0 mV/°C scale factor • 0.5°C accuracy guarantee able (at +25°C) • Rated for full −55° to +150°C range • Suitable for remote applications • Low cost due to wafer-level trimming • Operates from 4 to 30 volts • Less than 60 μA current drain • Low self-heating, 0.08°C in still air • Nonlinearity only ±1⁄4°C typical • Low impedance output, 0.1 W for 1 mA load. Typical Applications
  • 65. The arrangement of this sensor in our board is as shown in the figure below. In this we directly connect the output of the sensor to the base of the transistor as of LM35 for every 1˚C rise of temperature the output will increase for 10mV. Now if the temperature reaches 70˚C the output voltage will be 0.7V which is enough for the transistor junction to be biased. Hence the transistor gets on and the output is sensed by the microcontroller. Panic Switch: This is nothing but a simple switch which is connected in the sensor board. The arrangement of this is as shown in the figure below.
  • 66. The response of this switch is monitored by the microcontroller and the corresponding action takes place. IR Section: IR Tx.: TSAL6200 is a high efficiency infrared emitting diode in GaAlAs on GaAs technology, molded in clear, bluegrey tinted plastic packages. In comparison with the standard GaAs on GaAs technology these emitters achieve more than 100 % radiant power improvement at a similar wavelength. The forward voltages at low current and at high pulse current roughly correspond to the low values of the standard technology. Therefore these emitters are ideally suitable as high performance replacements of standard emitters. Features • Extra high radiant power and radiant intensity • High reliability • Low forward voltage • Suitable for high pulse current operation • Standard T-1¾ (∅ 5 mm) package • Angle of half intensity ϕ = ± 17° • Peak wavelength λp = 940 nm • Good spectral matching to Si photodetectors Applications
  • 67. Infrared remote control units with high power requirements Free air transmission systems Infrared source for optical counters and card readers IR source for smoke detectors. Most photo-detecting modules for industrial use are using modulated light to avoid interference by the ambient light. The detected signal is filtered with a band pass filter and disused signals are filtered out. Therefore, only the modulated signal from the light emitter can be detected. Of course, the detector must not be saturated by ambient light because it is effective when the detector is working in its linear region.
  • 68. In this project, pulsed light is used to cancel ambient light. This is suitable for arrayed sensors that are scanned in sequence to avoid interference from the next sensor. The microcontroller starts to scan the sensor status, sample the output voltage, turns on the LED and samples again the output voltage. The difference between the two samples is the optical current created by the LED, as the output voltage produced by the ambient light is canceled. The other sensors are also scanned the same way in sequence. The IR TX and RX are placed adjacent to each other. The TX transmits the IR radiation continuously and these will pass away when there is no object interrupting the signal. The IR receiver does not receive the IR radiation in this case. When there is an obstacle or when some one interrupts the IR signal, the rays transmitted by the IR transmitter will get reflected back and these reflected rays will be received by the IR receiver. Thus, the IR receiver receives the signal now in this case. The microcontroller detects this change and does the necessary action. DRIVER CIRCUIT: Digital systems and microcontroller pins lack sufficient current to drive the circuits like relays, buzzer circuits etc. While these circuits require around 10milli amps to be operated, the microcontroller’s pin can provide a maximum of 1-2milli amps current. For this reason, a driver such as a power transistor is placed in between the microcontroller and the buzzer circuit.
  • 69. Vcc BUZZER AT89S52 GROUND P1.0 The operation of this circuit is as follows: The input to the base of the transistor is applied from the microcontroller port pin P1.0. The transistor will be switched on when the base to emitter voltage is greater than 0.7V (cut-in voltage). Thus when the voltage applied to the pin P1.0 is high i.e., P1.0=1 (>0.7V), the transistor will be switched on and thus the buzzer will be ON. When the voltage at the pin P1.0 is low i.e., P1.0=0 (<0.7V) the transistor will be in off state and the buzzer will be OFF. Thus the transistor acts like a current driver to operate the buzzer accordingly.
  • 70. BUZZER INTERFACING WITH THE MICROCONTROLLER: DRIVER BUZZER AT 89s52 CIRCUIT P1.0
  • 72. WORKING PROCEDURE: This is a stand alone project to provide security to industries using an advanced technology called embedded systems. In this we are providing security by taking 5 different sensors. They are namely: 1. Reed sensor 2. LED & LDR 3. Temperature Sensor 4. Panic Switch 5. IR Tx & IR Rx. The working of all these sensors will start only when the arm key which is connected to the main board is made on. Here we will be using Reed switches at two different places viz. At doors and at windows. When using at doors we have two conditions to be checked, they are, whether the person is leaving outside or coming inside. The microcontroller continuously checks all the sensors. When this door sensor is triggered, it waits for a small amount of time allowing the person to close or open the door within that predefined delay. If the user closes or opens the door within the given delay, the controller will not ring the buzzer or the alarm and will wait again for another sensor to be activated. If the user can’t close or open the door in the given time, the controller will enter into the next case which is called as the entry delay. Another reed sensor is placed at the window. If the window is opened then the buzzer is activated and then the auto-dialer action is performed.
  • 73. After this comes the LED & LDR section. In this we will be placing all important things in a box and place that box on the LDR such that it objects the light falling from the LED. If any one removes the box the light falls on the ldr and then the microcontroller detects it and the buzzer will be activated and then the auto-dialer. The next sensor is Temperature sensor. This sensor gets activated only when the temperature in the room exceeds 70 degrees. This is because of the hardware connections we have made. When this sensor is activated the buzzer followed by auto-dialer is also activated. The next one is the panic switch. This can be activated by pressing this switch which will lead to the activation of buzzer and auto-dialer. Next comes the IR section. This contains a IR Tx. and IR Rx. This is arranged in such a manner that the IR signal falls continuously on the IR Rx. When ever an obstacle is passed through this pair this sensor gets activated. When this sensor is activated the alarm is on and auto-dialer is activated. The final sensor is the Smoke detector. Internally this has a pair of IR Tx. and Rx. This sensor is activated when there is a fire accident which results in smoke. This smoke is detected by this sensor and then the buzzer is activated followed by auto-dialer.