You are on page 1of 33

NSS COLLEGE OF ENGINEERING PALAKKAD, KERALA 678 008

Mini Project report on AUTOMATIC ROOM LIGHT CONTROL WITH VISITORS COUNTING

Guided By:
Mrs.ANJALI.S.NAIR LECTURER Dept. I & C

Project team:
ASWATHY.K KARTHIKA.M.MENON NEETHU.K KARTHIK.S ANEESH BABU.S

DEPARTMENT OF INSTRUMENTATION AND CONTROL ENGINEERING 2011

NSS COLLEGE OF ENGINEERING PALAKKAD-678 008

DEPT. OF INSTRUMENTATION AND CONTROL ENGINEERING

CERTIFICATE

This is to certify that this is the bonafide record of the mini project report titled AUTOMATIC ROOM LIGHT CONTROL WITH VISITORS COUNTING done by ASWATHY.K , KARTHIKA.M.MENON , NEETHU.K , KARTHIK.S , ANEESH BABU.S in the partialfulfilment of the requirement s for the award of Bachelor of Technology (B.Tech) in instrumentation and control engineering in the year 2011 as a part of their curriculum.

Guided By:

Staff in charge

Head of the Dept.:

Mrs.Anjali.S.Nair Lecturer

Shri.Anish.M.N Lecturer( SS)

Dr.Sitalekshmi Amma

ACKNOWLEDGEMENT
We express our sincere gratitude to our guide Mrs.Anjali.S.Nair,Lecturer, Department of Instrumentation and Control, for constantly urging us to come with innovative ideas and also for her valuable guidance and encouragement for the fulfilment of the Mini project. We would like to take this opportunity to thank Mr.Anish.M.N , Lecturer( SS) ,Dept. of Instrumentation and Control ,our mini project in charge for his cooperation and support for helping us complete this successfully in time. We also express sincere feelings of gratitude for Dr.B.Sitalekshmi Amma , Head of the Department , Instrumentation and Control , all our teachers who patiently cleared our queries and provided us with valid assistance. We are thankful to our friends for their whole-hearted cooperation during the preparation & presentation of the mini project. Last but not the least we wish to express our gratitude to God Almighty for his abundant blessings without which this mini project would not be successful.

ASWATHY.K KARTHIKA.M.MENON NEETHU.K KARTHIK.S ANEESH BABU.S

ABSTRACT
Project title is AUTOMATIC ROOM LIGHT CONTROL WITH VISITOR COUNTING

The objective of this project is to make a controller based model to count number of persons visiting particular room and accordingly light up the room. Here we can use sensor and can know present number of persons. In todays world, there is a continuous need for automatic appliances with the increase in standard of living, there is a sense of urgency for developing circuits that would ease the complexity of life.

Also if at all one wants to know the number of people present in room so as not to have congestion. This circuit proves to be helpful.

CONTENTS
INTRODUCTION BLOCK DIAGRAM AND DESCRIPTION COMPONENT LIST CIRCUIT DIAGRAM CIRCUIT EXPLANATION FLOW CHART PROGRAMMING THE MICROCONTROLLER PCB LAYOUT ESTIMATED COST DATA SHEETS CONCLUSION BIBLIOGRAPHY

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 AT89C52 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

BLOCK DIAGRAM AND DESCRIPTION


EXIT

Enter Sensor

Signal Conditioning

A T

Exit Sensor

Signal Conditioning

8 9
ENTER

Relay Driver

Light

C 5 2

Power Supply

5 2

DESCRIPTION The basic block diagram of the bidirectional visitor counter with automatic light controller is shown in the above figure. Mainly this block diagram consist of the following essential blocks. Power Supply Entry and Exit sensor circuit AT 89c52 micro-controller Relay driver circuit

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. +12 voltage 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.

2. Enter and Exit Circuits:This is one of the main part of our project. The main intention of this block is to sense the person. For sensing the person and light we are using the Infrared sensors.By using this sensor and its related circuit diagram we can count the persons.

3. 89C52 Microcontroller:It is a low-power, high performance CMOS 8-bit microcontroller with 8KB of Flash Programmable and Erasable Read Only Memory (PEROM). The device is manufactured using Atmels high-density nonvolatile memory technology and is compatible with the MCS-51TM 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 Flash on a monolithic hip, the Atmel AT89C52 is a powerful Microcontroller, which provides a highly flexible and cost effective solution so many embedded control applications.

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 AT89C52 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.

COMPONENT LIST
1. MICROCONTROLLER-AT89C52 2. IN4007 DIODES 3. CAPACITORS 4. TSOP IR SENSORS 5. IR TRANSMITTERS 6. TRANSISTORS 7. RESISTORS 8. VOLTAGE REGULATOR 7805 9. 555 TIMERS 10.SEVEN SEGMENT DISPLAY 11.RELAY 12.TRANSFORMER 13.CRYSTAL OSCILLATOR 14.POT 15.LED

CIRCUIT DIAGRAM

CIRCUIT EXPLANATION
CIRCUIT DESCRIPTION:
There are two main parts of the circuits. 1. Transmission Circuits (Infrared LEDs) 2. Receiver Circuit (Sensors)

1. Transmission Circuit:

Transmitter circuit

This circuit diagram shows how a 555 timer IC is configured to function as a basic Astable multivibrator. Here pin 7 of discharging transistor Q1 is connected to the junction of R1 and R3. When the power supply Vcc is connected,the external timing capacitor charges towards Vcc with a time constant(R1+R3)C.During this time the output is high.When the capacitor voltage is equal to 2/3Vcc, transistor Q1 will be on and capacitor begins to discharge through R3 and transistor Q1 with a time constant R3C. The output will be low at that time. During the discharge of

timing capacitor, as it reaches 1/3Vcc, the situation will inverse that is capacitor begins to charge again. IR Transmission circuit is used to generate the modulated 36 kHz IR signal. The IC555 in the transmitter side is to generate 36 kHz square wave. Adjust the preset in the transmitter to get a 38 kHz signal at the o/p. around 1.4K we get a 38 kHz signal. Then you point it over the sensor and its o/p will go low when it senses the IR signal of 38 kHz.

2.Receiver Circuit:

The IR transmitter will emit modulated 38 kHz IR signal and at the receiver we use TSOP1738 (Infrared Sensor). The output goes high when the 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 the IC555 which is configured as monostable multivibrator. A monostable multivibrator is a timing circuit that changes state once triggered, but returns to its original state after a certain time delay. It got its name from the fact that only one of its output states is stable. It is also known as a 'one-shot'.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 through R1. 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 pulse at pin 3 whose width t is just the product of R1 and C1, i.e., t=R1C1. Input is given to the Port 1 of 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 that time Relay will be turned off. Reset button will reset the microcontroller.

FLOW CHART

PROGRAMMING THE MICROCONTROLLER


void table(); void display(); void hex_to_decimal(); unsigned char count,x,y,hund,ten,one,temp,i,z; void main(){ P0 = 0X01; // CLEAR DISPLAY P0.F7 =1; //DISPLAY CTRL M P2.F6=1; //DISPLAY CTRL L P1 = 0XFF; //P1.0 & P1.1 INPUT P2.F7 =0; //LIGHT delay_ms(1000); count=0; i=count; hex_to_decimal(); delay_ms(1000); delay_ms(1000); delay_ms(1000);

//---------------------------------------------------------------------while(1){ if(count <1){ p2_7_bit=0; } else { p2_7_bit=1; } display(); if(p1_0_bit==0){ delay_ms(10); while(p1_1_bit==1){ delay_ms(2); display(); } count++; if(count > 99)count =0; i = count; hex_to_decimal(); while(p1_0_bit==0){ delay_ms(10); display(); } while(p1_1_bit==0){ delay_ms(10);

display(); } for(z=0;z<100;z++) display(); } //********************************************************************** if(p1_1_bit==0){ delay_ms(10); while(p1_0_bit==1){ delay_ms(2); display(); } if(count < 1)count =1; count--; i = count; hex_to_decimal(); while(p1_1_bit==0){ delay_ms(10); display(); } while(p1_0_bit==0){ delay_ms(10); display(); } for(z=0;z<100;z++) display(); } } } //---------------------------------------------------------------------------//-----------subroutine------------------------------------------------------//--------------------------------------------------------------------------void hex_to_decimal(){ hund=i/100; temp=i%100; i=temp; ten=i/10; one=temp%10; x=ten; table(); ten=y;; x=one; table();

one=y; } void table(){ if(x ==0)y=1; if(x==1)y=103; if(x==2)y=18; if(x==3)y=34; if(x==4)y=100; if(x==5)y=40; if(x==6)y=8; if(x==7)y=99; if(x==8)y=0; if(x==9)y=32; } void display(){ p2_6_bit=0; p0 =ten; p0_7_bit=1; delay_us(400); p0_7_bit=0; p0 =one; p2_6_bit=1; delay_us(400); }

PCB LAYOUT

ESTIMATED COST
1. 89C52 MICROCONTROLLER 2. SEVEN SEGMENT(2) 3. 555 TIMER(4) 4. TSOP IR SENSOR(2) 5. POT(4.7K)2 6. TRANSFORMER(12V/500mA) 7. IC 7805 VOLTAGE REGULATOR 8. CRYSTAL (11.05MHz) 9. RELAY(12V) 10.CAPACITORS(15) 11.IN4007 DIODE(4) 12.TRANSISTORS(6) 13.RESISTANCES(24) 14.IC BASE(5) 15.AC WIRE 16.2PIN WIRE CONNECTION(4) 17.IR LED(2) 18.PCB 19.LED(4) Rs 60 Rs 20 Rs 20 Rs 36 Rs 4 Rs55 Rs8 Rs10 Rs10 Rs18 Rs2 Rs23 Rs36 Rs16 Rs15 Rs20 Rs6 Rs500 Rs 4

TOTAL

RS 863

DATA SHEETS
TSOP1738 (INFRARED SENSOR)

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 receiver series, supporting all major transmission codes. Features: Photo detector and preamplifier in one package Internal filter for PCM frequency Improved shielding against electrical field disturbance TTL and CMOS compatibility Output active low Low power consumption High immunity against ambient light

Continuous data transmission possible (up to 2400 bps) Suitable burst length .10 cycles/burst

Block Diagram:

Block Diagram of TSOP 1738

Application Circuit:

LTS 542 (7-Segment Display)

Description: A seven-segment display may have 7, 8, or 9 leads on the chip. Usually leads 8 and 9 are decimal points. The figure below is a typical component and pin layout for a seven segment display.

Features:

Common Anode 0.52 Inch Digit Height Continuous Uniform Segments Low power Requirement Excellent Characters Appearance High Brightness & High Contrast Wide Viewing Angle

Voltage Regulator 7805


The Digilab board can use any power supply that creates a DC voltage between 6and 12 volts. A 5V voltage regulator (7805) is used to ensure that no more than 5V is delivered to the Digilab board regardless of the voltage present at the J12 connector (provided that voltage is less than 12VDC). The regulator functions by using a diode to clamp the output voltage at 5VDC regardless of the input voltage excess voltage is converted to heat and dissipated through the body of the regulator. If a DC supply of greater than 12V is used, excessive heat will be generated, and the board may be damaged. If a DC supply of less than 5V is used, insufficient voltage will be present at the regulators output.

The KA78XX/KA78XXA series of three-terminal positive regulator are available in the TO-220/D-PAK package and with several fixed output voltages, making them useful in a wide range of applications. Each type employs internal current limiting, thermal shut down and safe operating area protection, making it essentially indestructible. If adequate heat sinking is provided, they can deliver over 1A output current. Although designed primarily as fixed voltage regulators, these devices can be used with external components to obtain adjustable voltages and currents.

Features: Output Current up to 1A Output Voltages of 5, 6, 8, 9, 10, 12, 15, 18, 24V Thermal Overload Protection Short Circuit Protection Output Transistor Safe Operating Area Protection

RELAY CIRCUIT:

Relay

A single pole double 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 the relay remains off. As soon as pin of the microcontroller goes high, the relay operates. When the relay operates and releases.

555 TIMER IC
The 555 timer IC is an integrated circuit chip used in a variety of timer, pulse generation and oscillator applications. The IC design was proposed in 1970 by Hans R. Camenzind and Jim Ball. After prototyping, the design was ported to the Monochip analogue array, incorporating detailed design by Wayne Foletta and others from Qualidyne Semiconductors. Signe tics (later acquired by Philips) took over the design and production, and released the first 555s in 1971. The full part numbers were NE555 (commercial temperature range, 0 C to +70 C) and SE555 (military temperature range, 55 C to +125 C). As with most parts of the era, these were available in both high-reliability metal can (T package) and inexpensive epoxy plastic (V package) packages. Thus the full part numbers were NE555V, NE555T, SE555V, and SE555T. It has been hypothesized that the 555 got its name from the three 5 k resistors used within .The part is still in widespread use, thanks to its ease of use, low price and good stability. As of 2003, it is estimated that 1 billion units are manufactured every year. The circuit arrangement of the 555 is said to be even more common, being incorporated in the charge pump of many single-voltage Flash and other electrically-erasable ICs.

Depending on the manufacturer, the standard 555 package includes over 20 transistors, 2 diodes and 15 resistors on a silicon chip installed in an 8-pin mini dual-in-line package (DIP-8) The 555 has three operating modes:

Monostable mode: in this mode, the 555 functions as a "one-shot" pulse generator. Applications include timers, missing pulse detection, bounce free switches, touch switches, frequency divider, capacitance measurement, pulse-width modulation (PWM) Astable free running mode: the 555 can operate as an oscillator. Uses include LED and lamp flashers, pulse generation, logic clocks, tone generation, security alarms, pulse position modulation and so on. Bistable mode or Schmitt trigger: the 555 can operate as a flip-flop, if the DIS pin is not connected and no capacitor is used. Uses include bounce free latched switches.
USAGE The connection of the pins is as follows:
PIN 1. 2. 3. 4. 5. 6. 7. 8. NAME GND TRIG OUT RESET CTRL THR DIS V+, VCC PURPOSE Ground, low level (0 V) OUT rises, and interval starts, when this input falls below 1/3 VCC. This output is driven to +VCC or GND. A timing interval may be interrupted by driving this input to GND. "Control" access to the internal voltage divider (by default, 2/3 VCC). The interval ends when the voltage at THR is greater than at CTRL. Open collector output; may discharge a capacitor between intervals. Positive supply voltage is usually between 3 and 15 V.

MONOSTABLE MODE In the monostable mode, the 555 timer acts as a one-shot pulse generator. The pulse begins when the 555 timer receives a signal at the trigger input that falls below a third of the voltage supply. The width of the output pulse is determined by the time constant of an RC network, which consists of a capacitor (C) and a resistor (R). The output pulse ends when the charge on the C equals 2/3 of the supply voltage. The output pulse width can be lengthened or shortened to the need of the specific application by adjusting the values of R and C. The output pulse width of time t, which is the time it takes to charge C to 2/3 of the supply voltage, is given by Where t is in seconds, R is in ohms and C is in farads.

Astable mode In astable mode, the 555 timer puts out a continuous stream of rectangular pulses having a specified frequency. Resistor R1 is connected between VCC and the discharge pin (pin 7) and another resistor (R2) is connected between the discharge pin (pin 7), and the trigger (pin 2) and threshold (pin 6) pins that share a common node. Hence the capacitor is charged through R1 and R2, and discharged only through R2, since pin 7 has low impedance to ground during output low intervals of the cycle, therefore discharging the capacitor.

In the astable mode, the frequency of the pulse stream depends on the values of R1, R2 and C:

The high time from each pulse is given by

And the low time from each pulse is given by

Where R1 and R2 are the values of the resistors in ohms and C is the value of the capacitor in farads. To achieve a duty cycle of less than 50% a diode can be added in parallel with R2 towards the capacitor. This bypasses R2 during the high part of the cycle so that the high interval depends only on R1 and C.

BISTABLE MODE In bistable mode, the 555 timer acts as a basic flip-flop. The trigger and reset inputs (pins 2 and 4 respectively on a 555) are held high via Pull-up resistors

while the threshold input (pin 6) is simply grounded. Thus configured, pulling the trigger momentarily to ground acts as a 'set' and transitions the output pin (pin 3) to

Vcc (high state). Pulling the

reset input to ground acts as a 'reset' and transitions

the output pin to ground (low state). No capacitors are required in a bistable configuration. Pins 5 and 7 (control and discharge) are left floating. SPECIFICATIONS These specifications apply to the NE555. Other 555 timers can have different specifications depending on the grade (military, medical, etc). Supply voltage (VCC) 4.5 to 15 V Supply current (VCC = +5 V) 3 to 6 mA Supply current (VCC = +15 V) 10 to 15 mA Output current (maximum) 200 mA Maximum Power dissipation 600 mW Power Consumption (minimum operating) 30 mW@5V, 225 mW@15V Operating temperature 0 to 70 C

CONCLUSION
The cicuit has been soldered to the PCB and found to be working. By using this circuit and proper power supply we can implement various applications Such as fans, tube lights, etc. By modifying this circuit and using two relays we can achieve a task of opening and closing the door. This circuit is used for counting purposes and for automatic room light control. Advantages of this circuit are Low cost , Easy to use, can implement in single door. The main drawback of this cicuit is , it is used only when one single person cuts the rays of the sensor hence it cannot be used when two person cross simultaneously.

BIBLIOGRAPHY
1. 2. 3. 4. 5.
6.

8051 Microcontroller and embedded Design Kenneth J Ayala www.8051.com www.atmel.com www.keilsoftware.com Programming in ANSI C: E BALAGURUSAMY The 8051microcontroller and embedded systems: MUHAMMAD ALI MAZIDI
JANICE GILLISPIE MAZIDI

You might also like