Automatic Room Light Controller P
Automatic Room Light Controller P
VISITOR COUNTER
Submitted by
Tapan Kharsel
(2221320052) Tapas Kumar
Barik (2221320053) Titan
Kumar Barik (2221320054)
Tushar Kanta Mallick
(2221320056)
For the
Session 2024/25
DEPARTMENT OF ELECTRICAL ENGINEERING
Principa
Principa External Examiner
ll
AIET,
BBSR
Declaration
The fear of theft and burglary always annoys many people. When lock
and keys become less safe, one can seek the help of electronic security systems.
Such a portable security system is described here.
This electronic setup auto activated whenever the intruder enters to the
unauthorized no entry area. It auto activate the landline number and redial the last
dialed number from the conventional telephone. All we need is to do minor
changes to activate this telephone as it works as to become auto dialer circuit.
Thus whenever the intruder enters to the area, it activates the sensor circuit
of either sound activation or infrared light beam obstruction circuit, the redial
circuit become active and give a ring tone to the receiving end. It may be a mobile
phone or any landline phone or even police control room.
INDEX
CHAPTERCONTENTPAGE NO.
1. INTRODUCTION........................................................................1
3. SCHEMATICDIAGRAM&CIRCUITDESCRIPTION.............6
4. LIST OF COMPONENTS………………………………….. 10
5. DESCRIPTIONOFCOMPONENTS…………………………... 11
5.1 DescriptionofComponents
7. PROJECT PROGRAM...............................................................18
8. FUTURE EXPANSION……………………………………. 26
1.2Project Overview:-
1
The microcontroller does the above job. It receives the signals from the sensors,
and this signal is operated under the control of software which is stored in ROM.
MicrocontrollerAT89S52 continuously monitor the Infrared Receivers, When any object
pass through the IR Receiver's then the IR Rays falling on the receiver are
obstructed, this obstruction is sensed by the Microcontroller.
2
2.1 Blockdiagram:-
3
2.2Block Diagram Description:-
The basic block diagram of the bidirectional visitor counter with automatic light controller
is shown in theabovefigure. Mainlythisblockdiagramconsists of
thefollowingessentialblocks.
1. Power Supply
2. EntryandExitsensorcircuit
3. AT 89S52 micro-controller
4. Relaydrivercircuit
1. Power Supply:-
Here we used +12V and +5V dc power supply. The main function of this
block is to provide the required amount of voltage to essential circuits. +12voltage is
given. +12V is given to relay driver. To get the +5V dc power supply we have used
here IC 7805, which provides the +5V dc regulated power supply.
This is one of the main parts of our project. The main intention of this block is
to sense the person. For sensing the person and light we are using the light dependent
register (LDR). By using this sensorand its related circuitdiagram we can count the
persons.
3. 89S52 Microcontroller:-
4
4. Relay Driver Circuit:-
This block has the potential to drive the various controlled devices. In this
block mainly we are using the transistor and the relays. One relay driver circuit we are using
to control the light. Output signal from AT89S52 is given to the base of the transistor,
which we are further energizing the particular relay. Because of this appropriate device is
selected and it do its allotted function.
5
CIRCUIT DESCRIPTION;-
6
This circuit diagram shows
a 555 timer IC, configured to function as a basic actable multivibrator.The stabl
emultivibratorgenerates squarewave, the period of which is determined by the circu
it external to IC 555. Theastable multivibrator does not require any external trigger
to change the stateof the output. Hence the name free running oscillator. The time
during whichthe output is either high or low is determined by the two resistors and
a capacitor which are externally connected to the 555 timer.
In this circuit, a negative pulse applied at pin 2 triggers an internal flip-flop that
turns off pin 7's discharge transistor, allowing C1 to charge up throughR1. At the same time,
the flip- flop brings the output (pin 3) level to 'high’. When capacitor C1 as charged up to
about 2/3 Vcc, the flip-flop is triggered once again, this time making the pin 3 output 'low'
and turning on pin 7's discharge transistor, which discharges C1 to ground. This circuit,
in effect, produces a pulseat pin 3 whose width t is just the product of R1 and C1,
i.e., t=R1C1.
7
3.2 Receiver circuit:-
8
The IR transmitter will emit modulated 38 kHz IR signal and at the
receiver we use TSOP 1738 ( Infrared Sensor). The output
goes high when there is an interruption and it return back to low
after the time period determined by the capacitor and resistor in the
circuit i.e. around 1 second. CL100 is to trigger theIC555 which is
configured as monostable multivibrator. Input is given to the Port 1of the
microcontroller. Port 0 is used for the 7-Segment display purpose. Port 2 is used
for the Relay Turn On and Turn off Purpose.LTS 542 (Common Anode)
is used for 7-Segment display and that time Relay will get voltage and triggered,
so light will get voltage and it will turn on and when counter will be 00
and at that time Relay will be turned off. Reset button will reset the
microcontroller.
9
LIST OF COMPONENTS
1. Microcontroller – AT89S52
2. IC – 7805
3. Sensor – TSOP 1738 (Infrared Sensor)
4. Transformer – 12-0-12, 500 mA
5. Preset – 4.7K
6. Disc capacitor – 104,33pF
7. Reset button switch
8. Rectifier diode – IN4148
9. 9.Transistor – BC 547,
2N2222 10.7-Segment Display
10
5.1 Description of Components;-
1.Microcontroller AT89S52:-
FEATURES:-
1. 8 KB Reprogrammable flash.
2. 32 Programmable I/O lines.
3. 16 bit Timer/Counter—3.
4. 8 Interrupt sources.
5. Power range: 4V – 5.5V
6. Endurance : 1000 Writes / Erase cycles
7. Fully static operation: 0 Hz to 33 MHz
8. Three level program memory lock
9. Power off flag
10.Full duplex UART serial channel
11.Low power idle and power down modes
12.Interrupt recovery from power down modes
13.256 KB internal RAM
14. Dual data pointer
11
2.TSOP1738 (INFRARED SENSOR)
Description:-
The TSOP17.. – Series are miniaturized receivers for infrared remote control systems.
PIN diode and preamplifier are assembled on lead frame, the epoxy package is designed as
IR filter. The demodulated output signal can directly be decoded by a microprocessor.
TSOP17... is the standard IR remote control receiverseries, supporting
allmajortransmission codes.
Features:-
12
3. 555 (TIMERIC):-
-
Description:-
-
The LM555 is a highly stable device for generating accurate
time delays or oscillation. Additional terminals are provided for triggering or
resetting if desired. In the time delay mode of operation, the time is precisely
controlled by one external resistor and capacitor. For actable operation as an
oscillator, the free running frequency and duty cycle are accurately
controlled with two external resistors and one capacitor. The circuit may
be triggered and reset on falling waveforms, and the output circuit can
source or sink up to 200mA or drive TTL circuits
Features:
1. Directreplacementfor SE555/NE555
2. Timingfrom microseconds through hours
3. Operatesinbothastableandmonostablemodes
4. Adjustable duty cycle
5. Output cansource or sink 200 mAOutput and supply TTL compatible
13
6. Temperature stability better than 0.005% per °C
7. Normally on and normally off output
8. Available in 8-pin MSOP package
Applications:-
1. Precision timing
2. Pulse generation
3. Sequential timing
4.LTS542 (7-SegmentDisplay)Description:
The LTS 542 is a 0.52 inch digit height single digit seven-segment display.
This device utilizes Hi-eff. Red LED chips, which are made from GaAsPon Gap substrate,
and has a red face and red segment.
Features:
1. Common Anode
2. 0.52 InchDigit Height
3. Continuous Uniform Segments
14
4. Lowpower Requirement
5. Excellent Characters Appearance
Description:-
Features:-
1. Output Current up to 1A
2. Output Voltages of 5, 6, 8, 9,10, 12,15, 18, 24V
3. Thermal Overload Protection
4. Short Circuit Protection
15
6 RELAY CIRCUIT:-
A single pole dabble throw (SPDT) relay is connected to port RB1 of the
microcontroller through a driver transistor. The relay requires 12 volts at a current of
around 100ma, which cannot provide by the microcontroller. So the driver transistor is
added. The relay is used to operate the external solenoid forming part of a locking
device or for operating any other electrical devices. Normally there lay remains off.
As soon as pin of the microcontroller goes high, the relay operates. When the relay
operates and releases. Diode D2 is the standard diode one mechanical relay to
prevent back EMF from damaging Q3 when the relay releases.
16
FLOW CHART :-
17
● If the sensor 1 is interrupted first then the microcontroller will look for
the sensor 2, and if it is interrupted then the microcontroller will increment
the count and switch on the relay, if it is first time interrupted.
● When the last person leaves the room then counter goes to 0 and
that time the relay will turn off, and light will be turned off.
18
INCLUDE reg_51.pdf
SEN1 EQU
P1.0 SEN2 EQU
P1.1
NUMB1: DS 1
NUMB2: DS 1
NUMB3: DS 1
VISITOR: DS 1
STACK DATA 3FH
ORG
JMP 00H ; Reset
MAIN
20
MOV VISITOR,#00H
MOV SPEED,#00H
MOV COUNT,#00H
MOV VALUE_1,#15H
MOV VALUE_2,#15H
CLR DIS1
CLR DIS2
MOV VALUE_1,#00H
MOV VALUE_2,#00H
SETB SEN1
SETB SEN2
UPP: JNB SEN1,UP_COUNT
JB SEN2,UPP
22
AJMP UPP
UP_COUNT:
SETB LIGHT
INC VISITOR
MOV A,VISITOR
CJNE A,#99,UPPS
MOV VISITOR,#98
JNB SEN1,$
CALL DELAY
JB SEN2,$
CALL DELAY
JNB SEN2,$
CALL DELAY
AJMP UPP
UPPS: MOV R2,VISITOR
MOV R1,#00H
MOV R3,#00D
MOV R4,#00D
MOV R5,#00D
MOV R6,#00D
MOV R7,#00D
CALL HEX2BCD
MOV VALUE_2,R3
MOV VALUE_1,R4
JNB SEN1,$
CALL DELAY
JB SEN2,$
CALL DELAY
JNB SEN2,$
CALL DELAY
AJMP UPP
;**************************************************
HEX2BCD:
MOV B,#10D
MOV A,R2
DIV AB
MOV R3,B ;
MOV B,#10 ; R7,R6,R5,R4,R3
DIV AB
MOV R4,B
MOV R5,A
CJNE R1,#0H,HIGH_BYTE ; CHECK FOR HIGH BYTE
SJMP ENDD
HIGH_BYTE:
MOV A,#6
ADD A,R3
MOV B,#10
DIV AB
MOV R3,B
23
ADD A,#5
24
ADD A,R4
MOV B,#10
DIV AB
MOV R4,B
ADD A,#2
ADD A,R5
MOV B,#10
DIV AB
MOV R5,B
CJNE R6,#00D,ADD_IT
SJMP CONTINUE
ADD_IT:
ADD A,R6
CONTINUE:
MOV R6,A
DJNZ R1,HIGH_BYTE
MOV B, #10D
MOV A,R6
DIV AB
MOV R6,B
MOV R7,A
ENDD: RET
;*********************************************************************
******
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
; 7 SEGMENT DISPLAY ROUTINE
;&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&
DISP:
MOV R2,SPEED
CJNE R2,#00H,AAS1
CLR DIS_A
CLR DIS_B
CLR DIS_C
CLR DIS_D
CLR DIS_E
CLR DIS_F
SETB DIS_G
RET
AAS1: CJNE R2,#01H,AS2
CLR DIS_B
CLR DIS_C
SETB DIS_A
SETB DIS_D
SETB DIS_E
SETB DIS_F
SETB DIS_G
RET
AS2: CJNE R2,#02H,AS3
CLR DIS_A
CLR DIS_B
CLR DIS_D
CLR DIS_E
CLR DIS_G
25
SETB DIS_C
26
SETB DIS_F
RET
AS3: CJNE R2,#03H,AS4
CLR DIS_A
CLR DIS_B
CLR DIS_C
CLR DIS_D
CLR DIS_G
SETB DIS_E
SETB DIS_F
RET
AS4: CJNE R2,#04H,AS5
CLR DIS_B
CLR DIS_C
CLR DIS_F
CLR DIS_G
SETB DIS_A
SETB DIS_D
SETB DIS_E
RET
AS5: CJNE R2,#05H,AS6
CLR DIS_A
CLR DIS_C
CLR DIS_D
CLR DIS_F
CLR DIS_G
SETB DIS_B
SETB DIS_E
RET
AS6: CJNE R2,#06H,AS7
CLR DIS_A
CLR DIS_C
CLR DIS_D
CLR DIS_E
CLR DIS_F
CLR DIS_G
SETB DIS_B
RET
AS7: CJNE R2,#07H,AS8
CLR DIS_A
CLR DIS_B
CLR DIS_C
SETB DIS_D
SETB DIS_E
SETB DIS_F
SETB DIS_G
RET
AS8: CJNE R2,#08H,AS9
CLR DIS_A
CLR DIS_B
CLR DIS_C
CLR DIS_D
27
CLR DIS_E
CLR DIS_F
28
CLR DIS_G
RET
AS9: CJNE R2,#09H,AS10
CLR DIS_A
CLR DIS_B
CLR DIS_C
CLR DIS_D
CLR DIS_F
CLR DIS_G
SETB DIS_E
RET
AS10: CJNE R2,#15H,AS11 ;symbol for -
SETB DIS_A
SETB DIS_B
SETB DIS_C
SETB DIS_D
SETB DIS_E
SETB DIS_F
CLR DIS_G
RET
AS11: CJNE R2,#16H,AS12 ;switch off all disp
SETB DIS_A
SETB DIS_B
SETB DIS_C
SETB DIS_D
SETB DIS_E
SETB DIS_F
SETB DIS_G
RET
AS12: MOV SPEED,#00H
AJMP DISP
;**********************************************************
; INTRRUPT ROUTINE TO REFRESH THE DISPLAY
;**********************************************************
REFRESH:
PUSH PSW ; save current registerset
MOV PSW,#RB1
PUSH ACC
INC COUNT
MOV R4,COUNT
QA1: CJNE R4,#01H,QA2
MOV SPEED,VALUE_1
SETB DIS1
CLR DIS2
CALL DISP
AJMP DOWN
QA2: CJNE R4,#02H,QA3
MOV SPEED,VALUE_2
CLR DIS1
SETB DIS2
CALL DISP
AJMP DOWN
29
QA3: MOV COUNT,#01H
MOV R4,COUNT
30
AJMP QA1
DOWN: MOV TL0,#0FFH
MOV TH0,#0F0H
POP ACC
POP PSW
RETI
;**********************************************************
DELAY:
MOV R1,#4FH
REP2: MOV R2,#0FFH
REP1: NOP
DJNZ R2,REP1
DJNZ R1,REP2
RET
;**********************************************************
END
31
FUTURE EXPANSION:-
2. By modifying this circuit and using two relays we can achieve a task
of opening and closing the door.
32
ADVANTAGES & DISADVANTAGES & APPLICATION,
Advantages:-
1. Lowcost
2. Easyto use
3. Implementinsingledoor
Disadvantages:-
1. It is used only when one single person cuts the rays of the sensor hence it cannot be used
when two personcrosssimultaneously.
Application:-
1. Forcountingpurposes
2. Forautomaticroomlight control
33
Reference Books
1. Programmingin ANSIC: EBALAGURUSAMY
2. The8051microcontrollerand embeddedsystems: MUHAMMADALIMAZIDI
3. JANICEGILLISPIEMAZIDI
4. The8051microcontroller: KENNETHJ. AYALA
Website
1. www.datasheets4u.com
2. www.8051.com
34