Micro Controller Based Room Light Controller

35
PROJECT REPORT ON MICROCONTROLLER BASED ROOM LIGHT CONTROLLER SUBMITTED BY KARTHIK MADANGOPAL NIVEDITHA KONDA ABHIJEET JADHAV GUIDED BY MR BADODEKAR DEPARTMENT OF ELECTRONICS ENGINEERING JAWAHAR EDUCATION SOCIETY’S

Transcript of Micro Controller Based Room Light Controller

Page 1: Micro Controller Based Room Light Controller

PROJECT REPORT ON

MICROCONTROLLER BASED ROOM LIGHT CONTROLLER

SUBMITTED BYKARTHIK MADANGOPAL

NIVEDITHA KONDAABHIJEET JADHAV

GUIDED BYMR BADODEKAR

DEPARTMENT OF ELECTRONICS ENGINEERING

JAWAHAR EDUCATION SOCIETY’S

ANNASHEB CHUDAMAN PATIL COLLEGE OF ENGINEERING

KHARGHAR, NAVI MUMBAI

2009-2010

Page 2: Micro Controller Based Room Light Controller

ACKNOWLEDGEMENT

It is indeed a matter of great pleasure and proud privilege to present this project of

“AUTOMATIC ROOM LIGHT CONTROLLER ”

The completion of the project work is a milestone in the student’s life and its

execution is inevitable in the hands of guide. We are highly indebted to ‘MR. H. S.

BADODEKAR’ invaluable guidance and wish to record our deep sense of

gratitude and appreciation for giving form and substance to this report. It is due to

his enduring efforts, patience and enthusiasm, which has given a sense of direction

and purposefulness to this project and ultimately made it a success.

We would like to render our sincere thanks to Mr. V. N. PAWAR, Head of

Department, Electronics and staff members for their co-operation.

We would also like to thank our principal ‘ Mr. D. G. BORSE’ for providing us

ample laboratory facilities and rendering help whenever required.

Last but not the least we wish to thank the non-teaching staff and our friends who

have helped us all the time in one way or the other for completion of this project.

Page 3: Micro Controller Based Room Light Controller

PREFACE

We have great pleasure in presenting our project “MICROCONTROLLER BASED ROOM LIGHT CONTROL ”. As it was the first mini project by us, we did face some difficulties but it was a great learning experience for us. We had the theory in our earlier two years of engineering but in third year we could apply it.

For easy understanding of our project we have begun the report with the detailed introduction of the infrared light. Also report contains circuit diagram and explanation of security system and autoswitch and finally datasheets.

Page 4: Micro Controller Based Room Light Controller

INDEX

1. INTRODUCTION

2. PROBLEM DEFINITION

3. BLOCK DIAGRAM

4. CIRCUIT DESCRIPTION

5. EXPLANATION

6. PCB LAYOUT

7. SOFTWARE IMPLEMENTATION

8. APPLICATIONS

9. FUTURE SCOPE

10. BIBILOGRAPHY

Page 5: Micro Controller Based Room Light Controller

INTRODUCTION

Man has come a long way in terms of development over a period

of time. In the olden days man used kerosene lamps and hand-held fans

in his house. The invention of electricity was a major breakthrough in

technology, which has enabled man to simplify many jobs. After the

invention of electricity came the electric lamp and the electric fan.

After the invention of electricity came the age of AUTOMATION,

in which most operations were automated. Human labour was

substituted by machines in most places. Continuous attempts are still

being made to dilute man’s role in most processes.

We through this project want to bring the advantages of

technology into the homes of people by automating their households

and to provide a solution to prevent wastage of electricity and thus help

in overcoming the problem of scarcity of electricity. Our project is

designed to detect direction of person entering into the room or leaving

the room. In our project we have written program for up & down

counter which is also displayed on seven segment display. If number of

persons present in a room is equal to zero then all lights & fan will get

OFF automatically thus saving power.

Page 6: Micro Controller Based Room Light Controller

PROBLEM DEFINITION

Design an “Automatic Room Light Controller with Visitor Counter ”

using 8051 . It should perform the following actions:-

1) It should count the number of persons in the room and display it on

the seven segment display.

2) When a person enters the room the counter should be automatically

incremented by one.

3) When a person leaves the room the counter should be automatically

decremented by one.

4) As long as there is somebody in the room the light in the room

should remain switched ON and should only be switched OFF when all

the persons in the room go out.

Page 7: Micro Controller Based Room Light Controller

BLOCK DIAGRAM

MICRO CONTROLLER:

The 8051 is the original member of the MCS-51 family, and is the

core for all MCS-51 devices.

Features of 8051:

1. It is a 8-bit CPU.

2. It has 4KB ROM on chip (i.e. program memory).

3. 128 bytes RAM on chip (i.e. Data memory).

Page 8: Micro Controller Based Room Light Controller

4. It can address 64KB of program memory.

5. It can address 64KB of data memory.

6. It has two 16-bit counter / Timer.

7. It has 32 I/O lines (four 8-bit I/O ports)

8. Full featured serial port.

9. It has Powerful 111-instructions instruction set.

PSEN:

Program Store Enable. It is Read Strobe to external Program Memory.

(Activated twice in each m/c cycle)

XTAL 1 and XTAL 2:

It has On-Chip clock generator (3 to 24MHz )

2 pins are provided for external crystal connections.

MEMORY:

Internal ROM (4-KB) is used to store program, hence called Program

Memory. Internal RAM (128Bytes) is used to store data or to read data;

hence this memory is called as Data Memory.

The 8051 can address external memory if internal program or data

memory is not sufficient. When used to address external memory, two

ports (P0 and P2) provide the memory addressing. This reduces the

number of I/O ports, but makes a memory flexible device.

Page 9: Micro Controller Based Room Light Controller

Port 3

Port 3 is an 8-bit bi-directional I/O port with internal pull-ups.

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 8051 as

listed below:

Port 3 Pin Alternate Functions

P3.0 RXD (serial input port)

P3.1 TXD (serial output port)

P3.2 INT0 (external interrupt 0)

P3.3 INT1 (external interrupt 1)

P3.4 T0 (timer 0 external input)

P3.5 T1 (timer 1 external input)

P3.6 WR (external data memory write strobe)

P3.7 RD (external data memory read strobe)

Port 3 also receives some control signals for Flash programming and

verification.

Page 10: Micro Controller Based Room Light Controller

RESET CIRCUIT

Reset circuit is designed with RC & NOT gate. Reset switch is

connected in parallel to capacitor. Whenever switch is pressed positive

pulse is applied to reset pin of micro controller which is level

operating. When it is high microcontroller gets reset and program gets

initialized.

RELAY DRIVER

The driver circuit is used to drive the motor. Microcontroller can

not provide sufficient current to driver relay, hence there is a need of

driver circuit. With the help of this driver circuit current level is very

much boosted. This boosted current is used to drive a motor.

2N2222/SL100 transistor is used for boosting current & resistors are

used for current limiting in order to protect the transistor. This current

helps for getting high torque in motors.

Relays are used as a switch. There are two types of relays namely

cabinet mount & PCB mount. Cabinet mount is very much bigger in

size as compared to PCB mount. Also it occupies more space compare

to PCB mount.

Considering such advantages we have selected PCB mount relay

in our project. PCB mount relay is an electrically isolated mechanically

Page 11: Micro Controller Based Room Light Controller

coupled. In relay there are two contacts normally open & normally

closed & a common terminal. Initially the relay is in normally closed

position before the voltage is applied. Once the voltage is applied the

relay switch is normally in closed position. This is because relay gets

magnetized and the current starts flowing through normally closed

position due to which the motor moves in clockwise direction and

similarly the motor moves in the anticlockwise direction with help of

relay.

IR SENSOR

Why Infrared?

Interference Free Audio: The transmission medium for infrared is

a modulated carrier of harmless invisible light ( Fig. 1) instead of

Radio or Audio signals. It is immune to outside interference. No

operator licensing is required for use of infrared systems.

Easy Installation: IR products are compact and lightweight. Both

transmitters and emitters feature a broad range of mounting hardware

options for simple, economical installation. Unlike induction loop

systems, no floor work or seating rearrangement is necessary .

Page 12: Micro Controller Based Room Light Controller

Flexibility: Infrared systems are offered in permanent installation and

portable use, plus several receiver models, some suitable for use with

hearing aids.

No Interference: An infrared signal is contained within the room in

which it is used, so even adjacent rooms may use identical infrared

systems without interference among them .

Broad Coverage: Infrared light behaves much like visible light..

With reflections from light-coloured walls, ceilings, and other surfaces,

a receiver can see the signal without a direct line-of-sight to the

emitter. The receiver's ultra wide-angle "Fish-Eye" lens captures direct

or reflected signals from almost any direction (Fig 2.)

Universality: The same receivers can be used in most courtrooms

that use IR systems with the same frequencies.

How it works:-

An Infrared system comprises of three sections: The Transmitter, the

emitter (sometimes both combined in one unit), and the receiver. The

transmitter imparts the audio signal onto a subcarrier signal which the

Page 13: Micro Controller Based Room Light Controller

emitter will convert into infrared light. The receiver decodes the

infrared signal to retrieve the original audio.

The critical elements of the Infrared link are the optical components:

The transmitting infrared light-emitting diode (IR-LED) and its

counterpart, the IR light-sensitive receiving diode. IR-LEDS are

subjected to rigorous quality control inspection and are carefully

selected for maximum life. They will last years longer than

conventional IR-LEDS.

To achieve a usable radiated power level, The IR-LEDS are used in

multiple arrays. Their light output is amplitude modulated by one or

more frequency-modulated sub carriers (typically 2.3 MHz for single

channel wide band systems and 2.3 MHz and 2.8 MHz for two channel

systems). Each Channel's Audio Signal Frequency-modulates its

particular sub carrier (Fig. 3.).

Two transmission modes are available: Wideband, for one or two

channels of high fidelity audio or narrowband, for upto 32 channels

with a 50 to 8,000 Hz response; suitable for communications (fig. 4).

The advantages of infrared systems are fully realized in applications

where different audio programs are required in adjacent rooms, such as

Court Houses. Each room can be equipped with one SME IR Court

Room System without interference among them. No frequency

coordination is required as with radio frequency systems. The same

receiver can be used in any Court Room.

Page 14: Micro Controller Based Room Light Controller

CIRCUIT DESCRIPTION

We are using two IR. Sensors for detecting interrupts of human when he enters into

the room or exit from room. The sequence is important to decide in or out entry.

This is decided with the help of software.

IR detection circuit is based on transistor driver circuit. IR receiver diode is

connected to base of transistor in reverse bias condition when IR light (rays) is

falling on IR sensor it offers low resistance and hence base gets grounded.

Transistor remain in off condition, so collector voltage is high when IR rays gets

interrupted due to human being base current flows through base emitter and

transistor becomes ON and collected voltage drops to Zero.

This is given to microcontroller. These are active low signal.

We are controlling relay to switch ON/OFF load/light transistor driver circuit is

used for relay. We can connect 230V / AC operated load to relay.

We display number of persons present in a room on two seven segment display

single 330 ohm resistor is connected in series with display.

Page 15: Micro Controller Based Room Light Controller

PCB LAYOUT (COMPONENT SIDE)

Page 16: Micro Controller Based Room Light Controller

PCB LAYOUT (SOLDER SIDE)

Page 17: Micro Controller Based Room Light Controller

WORKING:

We are using microcontroller 8051. IC 8051 is OTP (one time

programming) it is having ROM (Read Only Memory). 8051 is having

EEPROM (Electrically erasable programmable read only memory) this

memory can reprogram many time. Thus for development process 8051

is used.

This Microcontroller is having four ports, each port is having 8

I/O line. This IC is pin programmable. i.e. individual pin can be

configured for I/P or O/P. where as micro-processor is port

programmable. Microcontroller 8051 port 3 is also used for special

function such as timer, interrupt & for serial communication which we

can also use as common I/O line. Microcontroller port 0 is having open

collector O/P. So we have to connect external collector resistor from

each port pin. So we are using SIL (Serial n line package) resistor.

Which is eight resistor banks and one pin is common which we have to

connect to +ve supply. Thus it saves space on PCB and make

instrument compact.

Normal requirement for any microcontroller is clock & reset

circuit, clock is generated with the help of crystal; we can use 3 MHZ

to 20 MHz crystal with 33pF capacitor to ground.

Page 18: Micro Controller Based Room Light Controller

Reset circuit is designed with RC network and push button

switch. RC network is called as power ON reset circuit. Whenever

power supply is switched on reset pin will get positive pulse, IC will

get reset and program will get initialized. For manual reset push button

switch is connected parallel to capacitor.

IR sensor circuit is designed with transistor driver circuit which

is connected in common emitter mode. O/P is taken from collector,

collector resistor is approximately 1Kohm, and base biasing resistor is

of 47Kohm. IR sensor is connected in reverse bias condition. It offers

high resistance so base current flows through base emitter and

transistor gets ON so collector voltage is low. When IR rays are falling

on IR sensor it will offer low resistance, and base will get ground so

transistor will get OFF and collector voltage will become high.

In normal case IR rays are falling on IR sensor and collector

voltage is high. When IR rays get interrupted by any obstacle; collector

voltage will become low. LED with current limiting resistor is

connected parallel to collector resistor so it will glow even when

transistor is ON. i.e. whenever rays get interrupted.

Relay driver circuit is designed with transistor driver circuit.

Transistor is having three states: cut-off, active & saturation. In cut-off

or saturation it acts as switch and in active region it act as amplifier.

Here we are using it as a switch. When O/P of microcontroller is

high; base current will flow through base biasing resistor of 2K2 and

Page 19: Micro Controller Based Room Light Controller

transistor will get ON. And when O/P is low transistor will be OFF and

hence relay connected to collector and supply will also become

ON/OFF. Operating voltage of relay may be 6, 9 or 12V DC but we can

connect any operation voltage load to contact as per rating of relay

contact.

We are using 7 segment displays with BCD to seven segment

decoder IC 7447. Current limiting resistor is connected in series to the

display which will decide the brightness of LED.

Our project will detect entry or exit of person and accordingly it

will increment or decrement the counter value respectively on the

display. Thus it will show the total number of persons present in a

room.

Two IR sensor circuit is used to detect sequence, which will

decide entry or exit of person. When number of persons preset in a

room become zero relay will get OFF and hence the light will turn

OFF.

Page 20: Micro Controller Based Room Light Controller

APPLICATIONS

1) This project is implemented in temples like Tirupathi, Pali, etc. to

count the number of devotees in the temple.

2) It can be used in industries to count the number of processed

products.

3) It can be used in parking areas to count the number of vehicles

and the number of vacant parking spaces available for parking.

4) It is used in most offices, shopping malls and airports to count the

number of persons within.

5) It can also be used as counter in shopping malls to count the

number of goods purchased by the customer.

6) Instead of using a room light, if we use an alarm in the system,

this project gets modified into a Burglar Alarm System.

Page 21: Micro Controller Based Room Light Controller

ADVANTAGES

Low power consumption.

Life of load increases.

Maintenance work is less.

Cost is less.

More reliable.

Page 22: Micro Controller Based Room Light Controller

DISADVANTAGES

1) It should be used to count only one particular type of items.

e.g. In this situation, the counter is counting number of persons

entering or leaving the room. But when any object is brought into the

room or moved out of the room then the counter is automatically

incremented or decremented which gives false results.

2) Simultaneously, two or more persons cannot enter or leave the room

as they will be counted as one single person, thus giving false results.

3) As two pairs of transmitters and receivers are used, failure of any

one results into failure of the system working.

Page 23: Micro Controller Based Room Light Controller

RESULT

The project ”AUTOMATIC ROOM LIGHT CONTROLLER WITH

VISITOR COUNTER” using microcontroller is reliable circuit that

takes over the task of controlling the room lights as well as 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 anyone leaves

the room then the counter is decremented by one. The light will be only

switched OFF until all persons in the room go out. The total number of

persons inside the room is also displayed on the seven segment display.

Page 24: Micro Controller Based Room Light Controller

BIBLOGRAPHY

The 8051 Microcontroller

-By Kenneth Ayala.

www.seattlerobotics.org/encoder/sep97/basics.html

-For some of the tradeoffs in choosing a particular

Microcontroller.

http://en.wikibooks.org/wiki/Embedded_Systems/

8051_Microcontroller -For the collective reference to the

MCS-51 family of microcontrollers.

http://en.wikipedia.org/wiki/Intel_8051

-For the 8051 reference notes

www.google.co.in

-Images for various components and their description.