Anda di halaman 1dari 31

ROOM LIGHT CONTROLLER WITH VISITOR COUNTER

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

A BRIEF INTRODUCTION TO 8051 MICROCONTROLLER


When we have to learn about a new computer we have to familiarize about the machine capability we are using, and we can do it by studying the internal hardware design (devices architecture), and also to know about the size, number and the size of the registers. A microcontroller is a single chip that contains the processor (the CPU), non-volatile memory for the program (ROM or flash), volatile memory for input and output (RAM), a clock and an I/O control unit. Also called a "computer on a chip," billions of microcontroller units (MCUs) are embedded each year in a myriad of products from toys to appliances to automobiles. For example, a single vehicle can use 70 or more microcontrollers.
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

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.

The hardware is driven by a set of program instructions, or software. Once

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.

STANDERD FEATURES OF THE 8051


8-BIT data path and ALU. On chip flash memory. 5K X 8ROM- Program memory. 128 X 8RAM- Data memory. Multiple 16-BIT timer/counter. Full duplex UART (serial port). On chip clock oscillator.

32 I/O pins. Six interrupt sources.

FAMILY MEMBERS OF uC 8051


Features 8051 ROM 4k RAM 128 Timers 2 I/O pins 32 Serial port 1 Interrupt sources 6 8031 0k 128 2 32 1 6 8052 8k 256 3 32 1 7 8032 0k 256 3 32 1 7

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.

BLOCK DIAGRAM OF uC 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 1 pins (1 - 8) : i/o pins Contains internal pull-ups.

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.

PSEN (pin 29 ) :- Program store enable

Active low input. Used while accessing external memory Connected to OE pin of external ROM.

ALE -- (pin 30 ) :- Address latch enable


Active high. Used for de-multiplexing the address & data by connecting G pin of the 74LS373.

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.

VCC (pin 40)

GND (pin 20)

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.

Internal data memory


Lower 128 bytes Four register bank Bit addressable area : 00H 7FH : 00H 1FH : 20H 2Fh

General purpose area SFR address space

: 30H 7Fh : 80H FFH

INSTRUCTION SET OF uC-8051


full instruction set includes : i.Airthemetic Instructions ii. Logical Instructions iii. Branching Instructions iv. Data movement Instructions.

AIRTHEMATIC INSTRUCTIONS :
MNEMONIC S OPERANDS BYTES/CYCLES

ADD SUBB ADDC INC DEC

A, Rn A, direct A, @Ri A, #data A Rn direct @Ri DPTR AB AB A

1/1 2/1 1/1 2/1 1/1 1/1 2/1 1/1 1/2 1/4 1/4 1/1

MUL INC DIV DA

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

CLR CPL RL, RLC RR,RRC SWAP SET CLR

C C

CLP bit 2/1 DATA TRANSFER INSTRUCTIONS


MNEMONIC S OPERANDS BYTES/CYCLES

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

@Ri, A @Ri, direct @Ri, #data


DPTR,#data16 C, bit bit, C

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, @DPTR @DPTR, A A, @Ri @Ri, A

MOVC PUSH POP XCH

A, @A+DPTR

A, @A+PC direct direct A, Rn A, direct A, @Ri A, @Ri

XCHD

BRANCHING INSTRUCTIONC
MNEMONICS OPERANDS BYTES/CYCLES

JC,JNC JB,JNB,JBC JN,JNZ LJMP,AJMP

rel bit, rel rel addr16/11

2/2 3/2 2/2 3,2/2

SJMP JMP LCALL,ACAL L RET, RETI CJNE

rel @A+DPTR addr16/11 -A,direct,rel A,#data,rel Rn,#data,rel @Ri,#data,re l

2/2 1/2 3,2/2 1/2 3/2 3/2 3/2 3/2 2/2

DJNE Rn,reL direct,rel NOP --

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.

Tools used in project


This project programming is developed in assembly language. The other main tools which we have used in this project are listed below:1. 8051 Burner:-

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.

-:TECHNOLOGY PLATEFORM: It uses 8-bit 8051 microcontroller.

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

Anda mungkin juga menyukai