Submitted by
INTRODUCTION
This Project Automatic Room Light Controller with Visitor Counter using Microcontroller is a reliable circuit that takes over the task of controlling the room lights as well us counting number of persons/ visitors in the room very accurately. When somebody enters into the room then the counter is incremented by one and
the light in the room will be switched ON and when any one leaves the room then the counter is decremented by one. The light will be only switched OFF until all the persons in the room go out. The total number of persons inside the room is also displayed on the seven segment displays. 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. Microcontroller AT89S52 continuously monitor the Infrared Receivers, When any object pass through the IR Receiver's then the IR Rays falling on the receivers are obstructed this obstruction is sensed by the Microcontroller.
MAIN COMPONENT
1. 8051 Microcontroller 2. Relay 3. Ir sensor pair 4. Op amp 5. Power Supply
BLOCK DIAGRAM
8051 MICROCONT ROLLER POWER SUPPLY
OPAMP
LCD
IR SENSOR PAIR
RELAY
Description of Microcontroller:
89s52: The AT89S52 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory. The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with in-system programmable Flash on a monolithic chip, the Atmel's AT89S52 is a powerful microcontroller which provides a highly-flexible and costeffective solution to many embedded control applications. The AT89S52 provides the following standard features: 8K bytes of Flash, 256 bytes of RAM, 32 I/O lines, Watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. 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 con-tents but freezes the oscillator, disabling all other chip functions until the next interrupt.
familiar with hardware and software, the user can then apply the microcontroller to the problems easily. The pin diagram of the 8051 shows all of the input/output pins unique to microcontrollers:
persons in the room go out. The total number of persons inside the room is also displayed on the seven segment displays. The microcontroller does the above job. It receives the signals from the sensors, and this signal is operated under the control of software AT89S52 which is stored in ROM. the Microcontroller continuously monitor
Infrared Receivers, When any object pass through the IR Receiver's then the IR Rays falling on the receivers are obstructed this obstruction is sensed by the Microcontroller.
MICROCONTROLLER
8051
8051-MICROCONTROLLER
Developed by Intel corporation in year 1981 It was called as a system on a chip. Intel refers to it as MSC-51 now.
DISCRIPTION:The AT89S51 is a low-power, highperformance CMOS 8-bit microcontroller with 4K bytes of In-System Programmable Flash memory. The device is manufactured using Atmels high-density non-volatile memory technology and is compatible with the industry-standard 80C51 instruction set and pin-out. 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 In-System Programmable Flash on a monolithic chip, the Atmel AT89S51 is a powerful microcontroller which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S51 provides the following standard features: 4K bytes of Flash, 128 bytes of RAM, 32 I/O lines,
Watchdog timer, two data pointers, two 16-bit timer/counters, a five-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S51 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 con-tents but freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset.
Intel allows other manufacturers to and markets any version of 8051 depending upon the speed and onchip ROM. There are more then 50 companies like ST, TI, SIEMENS, WINBONDS etc. marketing micro-controller base on Intel-8051.
PIN DIAGRAM:-
-: PIN DISCRIPTION:-
Port 0 - pins (32 - 39) : Input/output pins. Required external pull-up register of 10 k ohm. Used as I/O port and higher address byte.
Prot 2 pins (21 - 28) : i/o pins Contains internal pull-ups.. Used as I/O port and higher address byte
Prot 3 pins (10 - 17) : i/o pins Contains internal pull-ups. Alternate function to provide signal such as interrupts.
Active low input. Used while accessing external memory Connected to OE pin of external ROM.
EA ( pin 31) : Active low input. To excess external ROM it must be connected to GND.
XTAL1 & XTAL2 (pins 18 & 19): Provide electric field to quartz oscillator for oscillations.
RESET ( pin 9) : Active high input. Terminates all activities of microcontroller. Set PC to 0000h. Requires minimum 2 machine cycles.
CRYSTAL CONNECTIONS
The capacitor C1 & C2 are of 33 pF each. It provides clocks to 8051 for its operations. As described above XTAL1 and XTAL2 are connected to pin no 18 and 19 of controller and pin 20 is grounded.
-:MEMORY ORGENIZATION:-
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 AT89S51, if EA is connected to VCC, program fetches to addresses 0000H through FFFH are directed to internal memory and fetches to addresses 1000H through FFFFH are directed to external memory.
Data Memory :The AT89S51 implements 128 bytes of onchip RAM. The 128 bytes are accessible via direct and indirect addressing modes. Stack operations are examples of indirect addressing, so the 128 bytes of data RAM are available as stack space.
AIRTHEMATIC INSTRUCTIONS :
MNEMONIC S OPERANDS BYTES/CYCLES
1/1 2/1 1/1 2/1 1/1 1/1 2/1 1/1 1/2 1/4 1/4 1/1
LOGICAL INSTRUCTIONS
MNEMONICS OPERANDS BYTES/CYCLES
ANL OR XRL
A, Rn A, direct A, @Ri A, #data Direct, A Direct,#data C, bit C, /bit A C Bit A (FOR ALL)
1/1 2/1 1/1 2/1 2/1 3/2 2/2 2/2 1/1 1/1 2/1 1/1 1/1 1/1 1/1 1/1 1/1
C C
MOV
A, Rn A, direct A, @Ri A, #data Rn A, Rn, direct Rn, #data direct, A direct, Rn direct, direct direct, @Ri direct, #data
1/1 2/1 1/1 2/1 1/1 2/2 2/1 2/1 2/2 3/2 2/2 3/2
MOV
1/1 2/2 2/1 3/2 2/1 2/2 1/2 1/2 1/2 1/2 1/2 1/2 2/2 2/2 1/1 2/1 1/1 1/1
MOV MOVX
A, @A+DPTR
XCHD
BRANCHING INSTRUCTIONC
MNEMONICS OPERANDS BYTES/CYCLES
3/2 1/1
ABOUT PROJECT
Introduction to project
This project is developed for people who are interested in automation of homes, offices, halls, etc. This technology is currently under a great progress. This project is just an image of device automation using embedded technologies.
This project use embedded technology in which we use 8051 micro-controller with different electronics components. This project will control lights of a room. It will switch in the lights automatically as a person enters into the room and switch them as all people left the room.
In further modification of this project we can control the more devices like fan, ac and many more by slight changes like controlling of the temperature of a room by this project by using temperature controlled fan/ac.
The 8051 burner is a Microcontroller IC programmer for AT89S51/52 ICs. 2. 8051 IDE:The 8051 IDE combines a text editor, assembler, and software simulator into a single program. All components that are needed to develop 8051 programs are available and controllable from this single IDE running on Windows 2000 and XP. 3. Keil Compiler:Keil PK51 is a complete software development environment for classic and extended 8051 microcontrollers.
Programming is accomplished by 8051IDE which is an assembly language interface. We used optocouplers as sensors. Seven segments are used as display device.
Hardware description
We have used many different electronics components into this project like Microcontroller (AT89S52), seven-segments, LEDs, sensors, relays, optocouplers, different resistances. There is the description of some of the major components:1. Micro-controller:In this project AT89S52 is used. The AT89S52 is a CMOS 8-bit microcontroller with 8K bytes of in-system programmable Flash memory & is compatible with the industry-standard 80C51 instruction set and pin out. The on-chip Flash allows the program memory to be reprogrammed in-system or by a conventional non-volatile memory programmer.
3. Segment display:It is the most common type of display used in embedded system. It has seven leds in it one for each segment. They are commonly used in Calculators, micro-waves, stereos, VCRs, TV and many more household applications. They can be viewed from 8 meters. We use 2 seven segments as display device.
These seven segments are of two types:1. Common anode 2. Common cathode Each seven-segment display is an individual light emitting diode. A diode is made up of a p-n junction with has a basic property to allow the current to flow only in one direction. 4. RELAYS:A relay is an electrically operated switch. It is also called electromechanical switch made up of electro-magnets and allows one circuit to switch to a
second circuit which can be completely separated from first. We have used one relay switch operating at 12v. 5. CRYSTAL OSCILLATOR:A simplified schematic of the oscillator circuit used in this project is shown in the previous section. It pins are connected to 18 & 19 pins of uC. The value of capacitors is 33pF. 6. RESISTORS & CAPICITORS:In this project multiple valued resistors and capacitors are used. Hare is the details of resistors :6 register of 2.2 k ohm (in different ckts.) 10 register of 1 k ohm (for LED connections) 2 resistors of 330 ohm (for optocouplers) 1 capacitor of 10pf (across pin 9) Some pictures of resistors and capacitors:-
Circuit diagram