Escolar Documentos
Profissional Documentos
Cultura Documentos
INTRODUCTION
1
1.1 Aim of the project:
The main objective of this project is to develop an Automatic
Door opening system using IR sensors which will reduce the
need of manual labor.
1.2 Methodology:
According to our project requirements, the following modules
are essential.
• Power supply
• Microcontroller
• Stepper Motor
• IR sensors
2
service which reduces the requirement of shifting
watchmen.
• Simple Technology: This project uses a relatively
simple technology, thus reducing the strain to a good
extent.
3
CHAPTER 2
OVERVIEW
4
2.1 OVERVIEW OF THE PROJECT
5
• Microcontroller: This project employs the 8-bit
microcontroller from ATMEL (AT89S52). The microcontroller
in our security system is used for sending signals to the auto
dialer and buzzer alarm.
• Stepper motor: The stepper motor used here is for the
movement of the door connected to it, through a particular
specified angle in steps in precise positions.
• Power supply: Supply of 230V, 50Hz ac signal from main
supply board is given to a step down transformer. The
transformer is selected such that its output ranges from 10V to
12V, used for the various components in the project, as per
their needs.
• ULN 2803: As the microcontrollers maximum voltage is 5V,
this component is used for supplying the 12V to run the stepper
motor. It provides the 12V to the motor to run it, as it receives
the signal from the microcontroller.
6
CHAPTER 3
EMBEDDED SYSTEMS
7
3.1 INTRODUCTION TO EMBEDDED SYSTEM
Embedded
8
3.1.1 Examples of embedded systems
9
Microprocessor CPU contains Arithmetic Logical Unit, a
program counter, a stack pointer, some working registers, a clock
timing circuits and interrupt circuit.
10
A microcontroller is a general purpose device but one that is
meant to read data, perform limited calculations on that data and
control its environment based on those calculations.The prime use of
microcontroller is to control the operation of machine using a fixed
program that is stored in ROM that does not change over the life time
of the system.
• cost is less
• speed is more
• power consumption is less
• compact device
11
3.3 Criterion for choosing a microcontroller
(a) speed : the highest speed that the microcontroller can support
(b) Packaging: is it a 40-pin DIP, QPF or some other packaging
format? This is important in terms of space, assembling and
prototyping the end-product.
(c) Power consumption: this is especially critical for battery
powered products.
(d) The amount of RAM and ROM space on chip.
(e) The number of I/O pins and timers on the chip.
(f) How easy it is to upgrade to higher performance or lower
power consumption versions.
(g) Cost per unit: this is important in terms of final product in
which a microcontroller is used.
The second criterion depends on how easy it is to develop
products around it.
12
3.4 8051 MICROCONTROLLER
Each 8051 device has some amount of data Ram built in the
device for internal processing. This area is used for stack operations
and temporary storage of data. This bus architecture is supported with
on-chip peripheral functions like I/O ports, timers/counters, versatile
serial communication port.
13
Cou
nte
Rxd
r
CHAPTER 4
CIRCUIT DIAGRAM
14
4.1 CIRCUIT DESCRIPTION
4.1.1 MICROCONTROLLER:
15
circuitry comprises of 10 micro farads (C6) and a resistor (R5)
of 8.2k ohms.
• Pin 31 (EA\VPP) is tied to VCC for internal program
execution.
• The crystal oscillator (11.0592MHz) is connected across pin 18
and pin19.
• Pin 1 (port 1.0) is connected to the output (pin 3) of the IR
receiver (TSOP 1356).
• Pin 3 (port 1.2) is connected to the Chip Enable input (pin 2) of
the DTMF generator (UM95089).
• Port 2 of the microcontroller is used to drive the stepper motor
using ULN 2803.
4.1.2 555TIMER:
16
• The output of 555timer at pin 3 which is connected to the
Infrared emitting diode (TSAL 6200).
4.1.3 INFRARED EMITTING DIODE (TSAL 6200):
17
demodulated output signal can directly be decoded by a
microprocessor.
• Pin 1 is grounded.
• A capacitor (C3) of 4.7 micro farads connected between pin
1 and pin 2.
• Pin 2 is connected to a supply of +5V through a resistor
(R4) of 1k ohms.
• When there is a proper transmission and reception between
the LED and IR receiver, the output of TSOP 1356 is logic high.
• The carrier frequency should be close to 56 kHz. Whenever
there is no link between IR transmitter and receiver, the output pin
3 of TSOP 1356 will be logic low.
18
Fig 4.2 power supply block diagram
19
CHAPTER 5
COMPONENTS USED IN THE PROJECT
AND THEIR DESCRIPTION
20
5.1 MICROCONTROLLER
5.1.1 Description of AT89S52
21
• Low Power Idle and Power Down Modes
• Watchdog Timer
• Dual Data Pointer
• Power-Off Flag
• Fast Programming Time
• Flexible ISP programming(Byte and Page mode)
In addition, the AT89C52 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.
22
Fig 5.1.2 Pin diagram of 8052
23
24
Fig 5.1.3 Block diagram of 8052
• VCC
Pin 40 provides Supply voltage to the chip. The voltage source
is +5v.
• GND.
Pin 20 is the grounded
• Port 0
Port 0 is an 8-bit open drain bidirectional I/O port from pin 32
to 39. 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 may also be configured to be the multiplexed low-order
25
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
from pin 1 to 8. 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
below
• Port 2
Port 2 is an 8-bit bidirectional I/O port with internal pull-ups
from pin 21 to 28. 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.
26
Port 2 emits the high-order address byte and fetches from
external program memory and during accesses to external data
memory that use 16-bit addresses (MOVX @ DPTR). In this
application it uses strong internal pull-ups when emitting 1s. During
accesses to external data memory (that use 8-bit addresses (MOVX @
RI), Port 2 emits the contents of the P2 Special Function Register. Port
2 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
from pin 10 to 17. 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 also serves the functions of various
special features of the AT89C51 as listed below:
• RST
Pin 9 is the Reset input. It is active high. Upon applying a high
pulse to this pin, the microcontroller will reset and terminate all
27
activities. A high on this pin for two machine cycles while the
oscillator is running resets the device.
• ALE/PROG
Address Latch Enable output pulse for latching the low byte of
the address during accesses to external memory. 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.
• PSEN
Program Store Enable is the read strobe to external program
memory. When the AT89C52 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
28
receives the 12-volt programming enable voltage (VPP) during Flash
programming, for parts that require 12-volt VPP.
• XTAL1
Input to the inverting oscillator amplifier and input to the internal
clock operating circuit.
• XTAL2
Output from the inverting oscillator amplifier.
Oscillator Characteristics
XTAL1 and XTAL2 are the input and output, respectively, of
an inverting amplifier which can be configured for use as an on chip
oscillator, as shown in Figure 5.3. 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 as
shown in Figure 5.4.
29
Figure 5.1.5 External Clock Drive Configuration
TIMERS
o Timer 0 and 1
Timer 0 and Timer 1 in the AT89S52 operate the same way as
Timer 0 and Timer 1 in the AT89S51.
o 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. 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 5.2. Timer 2 consists of
two 8-bit registers, TH2 and TL2. In the Timer function, the TL2
30
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.
Interrupts
The AT89S52 has a total of six interrupt vectors: two external
interrupts (INT0 and INT1), three timer interrupts (Timers 0, 1, and 2),
31
and the serial port interrupt. These interrupts are all shown in Figure
5.5
32
Table 5.4 Interrupts Enable Register
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
33
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. It should be noted that
when idle 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.
Table 5.5 Status Of External Pins During Idle and Power Down Mode
34
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
must agree with the current logic level at that pin in order for the
device to function properly.
35
Therefore these emitters are ideally suitable as high performance
replacements of standard emitters. The transmitter usually is a battery
powered handset. It should consume as little power as possible, and
should be strong as possible to achieve an acceptable control distance.
FEATURES:
• Extra high radiant power and radiant intensity and high
reliability
• Low forward voltage
• Suitable for high pulse current operation
• Peak wavelength = 940nm
• Good spectral matching to Si photo detectors
APPLICATIONS:
• IR remote control units with high power requirements
• Free air transmission systems
• Infrared source for optical counters and readers
• IR source for smoke detector
5.2.2 IR RECEIVER
36
Many different receiver circuits exists on the market. The most
important selection criteria are the modulation frequency used and the
availability in you region.
This signal is amplified and limited by the first two stages. The limiter
acts as an AGC circuits to get a constant pulse level, regardless of the
distance to the hand set.
As you can see only the AC signal is sent to the Band Pass
Filter. The B.P.F is tuned to the modulation of the handset unit.
Common frequencies range from 30 kHz to 60 kHz in consumer
electronics. The next stages are a detector, integrator and comparator.
The purpose of these three blokes is to detect the presence of the
37
modulation frequency. If the modulation frequency is present, the
output of the comparator will be pulled low.
38
Figure 5.2.3 Block diagram of TSOP 1356
FEATURES:
• Phone detector and preamplifier in one package
• Internal filter for PCM frequency
• TTL and CMOS compatibility
• Output active is low
• High immunity against ambient light
• Continuous data transmission possible
39
5.3 555 TIMER
A 555 timer IC is most versatile and highly reliable linear IC. It
is used for generating accurate time delay or oscillations. SIGNETICS
corporation first introduce the device SE\NE 555. This device is
available as 8 pin metal can, 8 pin mini DIP. The SE 555 is
designed for the operating temperature range from -55 degree
centigrade to +125 degree centigrade while the NE 555 operates on a
range from 0 degree centigrade to 70 degree centigrade. The NE
555 timer operates on +5v to +18v power supply. It has adjustable
duty cycle from micro seconds to hours. It has highly current output. It
can source or sink 200mA. It is compatible with both TTL and CMOS
logic circuits.
40
The complementary signal of the flip-flop is taken as output of
the 555 (pin no 3). The reset pin prevents the flip-flop from working.
Hence in most applications reset pin is connected to supply voltage.
41
5.3.2 PIN DIAGRAM OF 555 TIMER
• Ground (Pin 1)
• Trigger (Pin 2)
This pin is the input to the lower comparator and is used to set
the latch, which in turn causes the output to go high.
• Output (Pin 3)
• Reset (Pin 4)
This is used to reset the latch and return the output to a low
state. The reset is an overriding function. When not used connect to
V+.
42
• Control (Pin 5)
Allows access to the 2/3V+ voltage divider point when the 555
timer is used in voltage control mode. When not used it is connected to
ground through a 0.01 uF capacitor.
• Threshold (Pin 6)
• Discharge (Pin 7)
• V+ (Pin 8)
This connects to VCC and the Philips data book states the
ICM7555 CMOS version operates 3V - 16V DC while the NE555
version is 3V - 16V DC. Note comments about effective supply
filtering and bypassing this pin below under "General considerations
with using a 555 timer" The 555 can be connected as monostable
multivibrator and astable multivibrator mode.
43
which results the capacitor starts discharging through R2 and
discharge transistor Q1. When the voltage across equal’s 1\3Vcc
comparator2 output resets the flip-flop and output goes high, again the
above cycle repeats.The time during which the capacitor charges from
1\3Vcc to 2\3Vcc is equal to the time the output is high and is given by
TC = 0.69 (RA+RB) C
Td = 0.69RB*C
T = TC +Td = 0.69(RA+2RB) C
D = (RA+RB)\(R1+2RB)
44
5.4 STEPPER MOTOR
45
Fig 5.4.1 Rotor diagram
46
positioning without the need of position feedback sensors when
compared to other motors.
Smaller the step angle, greater the number of steps per revolution and
higher the resolution or the accuracy of positioning obtained. The step
angles can be as small as 0.72˚ or as large as 90˚. The motor speed is
measured in steps per second.
47
synchronism with the command pulses, when the pulse rate is high ,the
shaft rotation seems continuous.
48
A stepper motor's shaft has permanent magnets attached to it.
Around the body of the motor is a series of coils that create a magnetic
field that interacts with the permanent magnets. When these coils are
turned on and off, the magnetic field causes the rotor to move. As the
coils are turned on and off in sequence the motor will rotate forward or
reverse.
49
CHAPTER 6
PROJECT DESCRIPTION
50
PROJECT DESCRIPTION
51
• Your local phone can be used for normal use by using a DPDT
switch. So you need not use a separate telephone line for this
device controlling.
• There is no risk of false switching.
52
CHAPTER 7
FLOWCHART
53
FLOWCHART
#include<reg51.h>
sbit ir=P2^0;
sbit buzzer=P0^7;
stepper();
delay(unsigned int);
unsigned char i;
main()
buzzer=0;
while(1)
if(ir==0)
buzzer=1;
stepper();
buzzer=0;
54
else
buzzer=0;
stepper()
for(s=0;s<14;s++)
for(z=0x01;z<0x0a;z=z*2)
P3=z;
delay(5);
for(s=0;s<14;s++)
55
for(z=0x08;z>0x00;z=z/2)
P3=z;
delay(5);
for(i=0;i<time;i++)
for(j=0;j<1275;j++);
56
CHAPTER 8
RESULTS AND CONCLUSION
57
RESULTS
The above picture is the photo of the project kit that we created for our
project. It displays a model of an automatic door opening system
using IR sensors. It picturizes the following parts namely: power
supply, sensors, microcontroller board, driving circuit and the stepper
motor.
58
CONCLUSION
ADVANTAGES
59
References:
60
8. Raj Kamal,”Microcontrollers
Architecture,programming ,Interfacing and system
Design,pearson edition, 2005
9. www.knowledgebase.com
10. www.alldatasheets.com
61
APPENDIX
62
SOURCE CODE
ORG 000H
MOV P1,#0FFH
HERE:JB P1.0,HERE
MOV P2,#11H
CALL DELAY
MOV P2,#22H
CALL DELAY
MOV P2,#44H
CALL DELAY
MOV P2,#88H
CALL DELAY
MOV P2,#00H
CALL DELAY
CALL DELAY
63
CALL DELAY
CALL DELAY
MOV P2,#88H
CALL DELAY
MOV P2,#44H
CALL DELAY
MOV P2,#22H
CALL DELAY
MOV P2,#11H
CALL DELAY
SJMP HERE
DELAY:
MOV R1,#255
RET
END
64