Automatic Room Light Controller With Visitor Counter(1)

download Automatic Room Light Controller With Visitor Counter(1)

of 31

description

Automatic room light controller

Transcript of Automatic Room Light Controller With Visitor Counter(1)

ROOM LIGHT CONTROLLER WITH VISITOR COUNTERSubmitted by

INTRODUCTIONThis 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 COMPONENT1. 8051 Microcontroller

2. Relay3. Ir sensor pair

4. Op amp 5. Power SupplyBLOCK DIAGRAM

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 cost-effective 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 theroom 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.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, high-performance 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 8051Features8051803180528032

ROM4k0k8k0k

RAM128128256256

Timers2233

I/O pins32323232

Serial port1111

Interrupt sources6677

Intel allows other manufacturers to and markets any version of 8051 depending upon the speed and on-chip 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 on-chip 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 : 00H 7FH

Four register bank : 00H 1FH

Bit addressable area : 20H 2Fh

General purpose area : 30H 7Fh

SFR address space : 80H FFHINSTRUCTION SET OF uC-8051

full instruction set includes :i.Airthemetic Instructions

ii. Logical Instructions

iii. Branching Instructions

iv. Data movement Instructions.

AIRTHEMATIC INSTRUCTIONS :

MNEMONICSOPERANDSBYTES/CYCLES

ADD

SUBB

ADDCA, Rn

A, direct

A, @Ri

A, #data1/1

2/1

1/1

2/1

INC

DECA

Rn

direct

@Ri1/1

1/1

2/1

1/1

MUL

INC

DIV

DADPTR

AB

AB

A1/2

1/4

1/4

1/1

LOGICAL INSTRUCTIONSMNEMONICSOPERANDSBYTES/CYCLES

ANL

OR

XRLA, Rn

A, direct

A, @Ri

A, #data

Direct, A

Direct,#data

C, bit

C, /bit1/1

2/1

1/1

2/1

2/1

3/2

2/2

2/2

CLR

CPLA

C

Bit1/1

1/1

2/1

RL, RLC

RR,RRC

SWAPA

(FOR ALL)1/1

1/1

1/1

1/1

SET

CLR

CLPC

C

bit1/1

1/1

2/1

DATA TRANSFER INSTRUCTIONSMNEMONICSOPERANDSBYTES/CYCLES

MOVA, Rn

A, direct

A, @Ri

A, #data

Rn A,

Rn, direct

Rn, #data

direct, A

direct, Rn

direct, direct

direct, @Ri

direct, #data1/1

2/1

1/1

2/1

1/1

2/2

2/1

2/1

2/2

3/2

2/2

3/2

MOV

MOV@Ri, A

@Ri, direct

@Ri, #data

DPTR,#data16

C, bit

bit, C1/1

2/2

2/1

3/2

2/1

2/2

MOVXA, @DPTR

@DPTR, A

A, @Ri

@Ri, A1/2

1/2

1/2

1/2

MOVCA, @A+DPTR

A, @A+PC1/2

1/2

PUSH

POPdirect

direct2/2

2/2

XCHA, Rn

A, direct

A, @Ri1/1

2/1

1/1

XCHDA, @Ri1/1

BRANCHING INSTRUCTIONC

MNEMONICSOPERANDSBYTES/CYCLES

JC,JNC

JB,JNB,JBC

JN,JNZ

LJMP,AJMP

SJMP

JMPrel

bit, rel

rel

addr16/11

rel

@A+DPTR2/2

3/2

2/2

3,2/2

2/2

1/2

LCALL,ACALL

RET, RETIaddr16/11

--3,2/2

1/2

CJNE

DJNE

NOPA,direct,rel

A,#data,rel

Rn,#data,rel

@Ri,#data,rel

Rn,reL

direct,rel

--3/2

3/2

3/2

3/2

2/2

3/2

1/1

ABOUT PROJECTIntroduction 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 micro-controllers.

-: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 descriptionWe 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

OPAMP

POWER SUPPLY

LCD

8051 MICROCONTROLLER

IR SENSOR PAIR

RELAY