Documente Academic
Documente Profesional
Documente Cultură
MINI PROJECT REPORT Submitted by: ADHIL MUBARAK AFEEFA KUNH MOHAMMED BIPIN.M NASWIHA.T to the University Of Calicut in partial fulfillment of the requirement for the award of the degree of BACHELOR OF TECHNOLOGY in APPLIED ELECTRONICS AND INSTRUMENTATION ENGINEERING
MAY 2012
ACKNOWLEDGEMENT
First of all we thank the almighty Lord for giving all the confidence and ability to achieve this dream. We would also like to take this opportunity to thank a few who were closely involved in the completion of our project. We are indebted to all sources that helped us in working out this project at each step of its progress. We sincerely thank Mr. K.P Mohandas, head of the department, applied electronics and instrumentation, for the valuable help provided to us. We are also grateful to our project coordinators Mr. Vijilesh, Mr. Yasar Arafat, Mrs. Shruty and Mr. Hamza of applied electronics and instrumentation for their valuable suggestions and proper guidance for completion of our project. We also express our gratitude to all our teachers and friends for motivating us with constant encouragement and cooperation.
ABSTRACT
In this competitive world and busy schedule human cannot spare time to perform his daily activities manually. The most common thing that he forgets to do is switching OFF the lights wherever they are not required. This project is a standalone automatic room light controller with visitor counter. The main aim of the project is to control the lighting in a room depending upon lighting that is present in the room. Use of embedded technology makes this closed loop feedback control system efficient and reliable
TABLE OF CONTENT
1.
INTRODUCTION ....................................................................................................... 5 1.1 1.2 Project Definition ............................................................................................... 5 Project Overview ................................................................................................ 5
2.
BLOCK DIAGRAM AND ITS DESCRIPTION ...................................................... 6 2.1 2.2 Basic Block Diagram ......................................................................................... 6 Block Diagram Description ................................................................................ 7
3.
CIRCUIT DIAGRAM AND ITS DESCRIPTION ................................................... 9 3.1 3.2 Circuit Diagram:.................................................................................................. 9 Circuit Diagram Explanation: ........................................................................... 10
4.
HARDWARE DESIGN & DESCRIPTIONS ......................................................... 11 4.1 4.2 4.3 4.4 Hardware Design:.............................................................................................. 11 Procedure Followed While Designing : ............................................................ 11 List of Components : ......................................................................................... 12 Description of Components .............................................................................. 12
5. 6. 7. 8. 9.
SOFTWARE DESIGN .............................................................................................. 20 TESTING AND RESULTS ....................................................................................... 40 FUTURE EXPANSION ............................................................................................ 41 APPLICATION, ADVANTAGES & DISADVANTAGES ................................... 42 BIBILOGRAPHY ...................................................................................................... 43
1. INTRODUCTION
1.1 Project Definition
Project title is AUTOMATIC ROOM LIGHT CONTROLLER WITH VISITOR COUNTER . 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.
Enter
Enter Sensor Signal Conditioning
Exit
Exit Sensor
Signal Conditioning
Power Supply
A T 8 9 C 5 1
Relay Driver
Light
LCD display
2.2
controller is shown in the above figure. Mainly this block diagram consists of the following essential blocks. 1. 2. 3. 4. 5. Power Supply Entry and Exit sensor circuit AT 89C51 micro-controller Relay driver circuit 7-segment display and LCD display
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.
3. 89C51 Microcontroller :
The AT89C51 is a low-power; high-performance CMOS 8-bit microcomputer with4K bytes 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 industry-standard MCS-51 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 chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. Dept. of Applied Electronics & Instrumentation 7 MES College of Engineering
U2
7805 3
LCD1
LM016L VO
GND
D3
VI
R4
1k
C4 D4
1000mF
C5
VSS VDD VEE
1mF
D6
LED
RS RW E 4 5 6
TRAN-2P2S
C1 U1
19 33pf XTAL1 P0.0/AD0 P0.1/AD1 18 P0.2/AD2 XTAL2 P0.3/AD3 P0.4/AD4 P0.5/AD5 33pf 9 P0.6/AD6 RST P0.7/AD7 P2.0/A8 39 38 37 36 35 34 33 32 21 22 23 24 25 26 27 28 10 11 12 13 14 15 16 17
X1 C2
11.0592MHz
7 8 9 10 11 12 13 14
D5
1 2 3
D D D D D D D D
0 1 2 3 4 5 6 7
Phase
Neutral
C3
10mf
P2.1/A9
R2
10k
29 30 31
U3
Relay
1 2 3 4 5 6 7 COM 1B 2B 3B 4B 5B 6B 7B ULN2003A 1C 2C 3C 4C 5C 6C 7C 9 16 15 14 13 12 11 10
RL1
12V
1 2 3 4 5 6 7 8
Relay
IR1 IR2
Bulb
PORT2
R1
4.7K
9 8 7 6 5 4 3 2 1
R5 R3
47E 4.7K
R6
47E
IR1
IR2
Q1 RP1
RESPACK-8 220E NPN
D1
LED
Q2
NPN
D7
LED
Working
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 AT89C51 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.
10
Microcontroller AT89C51
Relay
LCD Display
Photo transistors
7-Segment Display Infrared LEDS Fig. 4.1: Snap of the entire circuit
12
The AT89C51 is a low-power, high-performance CMOS 8-bit microcomputer with 4KBytes 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 industry-standard MCS-51 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 chip, the Atmel AT89C51 is a powerful microcomputer which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89C51 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, onchip oscillator, and clock circuitry. In addition, the AT89C51 is designed with static logic for operation from 0Hz to 24Mz 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 contents but freezes the oscillator, disabling all other chip functions until the next interrupt or hardware reset.
FEATURES: Compatible with MCS-51 Products 4K Bytes of In-System Reprogrammable Flash Memory Endurance: 1,000 Write/Erase Cycles Fully Static Operation: 0 Hz to 24 MHz Three-level Program Memory Lock 128 x 8-bit Internal RAM 32 Programmable I/O Lines Two 16-bit Timer/Counters Six Interrupt Sources Programmable Serial Channel Low-power Idle and Power-down Modes
13
4.4.2 Phototransistor :
Like diodes, all transistors are light-sensitive. Phototransistors are designed specifically to take advantage of this fact. The most-common variant is an NPN bipolar transistor with an exposed base region. Here, light striking the base replaces what would ordinarily be voltage applied to the base -- so, a phototransistor amplifies variations in the light striking it. Note that phototransistors may or may not have a base lead (if they do, the base lead allows you to bias the phototransistor's light response).
Fig. 4.4: Infrared LED An IR LED, also known as IR transmitter, is a special purpose LED that transmits infrared rays in the range of 760 nm wavelength. Such LEDs are usually made of gallium arsenide or aluminum gallium arsenide. They, along with IR receivers, are commonly used as sensors. The appearance is same as a common LED. Since the human eye cannot see the infrared radiations, it is not possible for a person to identify whether the IR LED is working or not, unlike a common LED. To overcome this problem, the camera on a cellphone can be used. The camera can show us the IR rays being emanated from the IR LED in a circuit 5mm LED & has a blue transparent lens Specifications:- Forward Current Dept. of Applied Electronics & Instrumentation 14 MES College of Engineering
(If): 50mA max - Peak forward current (Ip): 1.2A- Forward Voltage (VF): 1.2V @ 20mA - Reverse Voltage (VR): 5V max- Power Dissipation (P.d): 100mW max - Viewing Angle: 30- Peak Spectral Wavelength(IR): 940nm @ 20mA * Spectral Bandwidth (DI): 50nm@20mA- Material: GaAs
Fig. 4.5: LCD display LCDs are more energy efficient and offer safer disposal than CRTs. Its low electrical power consumption enables it to be used in battery-powered electronic equipment. It is an electronically modulated optical device made up of any number of segments filled with liquid crystals and arrayed in front of a light source (backlight) or reflector to produce images in color or monochrome. The most flexible ones use an array of small pixels
Fig. 4.6: Transformer Dept. of Applied Electronics & Instrumentation 15 MES College of Engineering
A transformer is a device that transfers electrical energy from one circuit to another through inductively coupled conductorsthe transformer's coils. A varying current in the first or primary winding creates a varying magnetic flux in the transformer's core and thus a varying magnetic field through the secondary winding. This varying magnetic field induces a varying electromotive force (EMF), or "voltage", in the secondary winding. This effect is called inductive coupling. If a load is connected to the secondary, current will flow in the secondary winding, and electrical energy will be transferred from the primary circuit through the transformer to the load. In an ideal transformer, the induced voltage in the secondary winding (Vs) is in proportion to the primary voltage (Vp) and is given by the ratio of the number of turns in the secondary (Ns) to the number of turns in the primary (Np) as follows: Vs/Vp=Ns/Np By appropriate selection of the ratio of turns, a transformer thus enables an alternating current (AC) voltage to be "stepped up" by making Ns greater than Np, or "stepped down" by making Ns less than Np.
4.4.6 IC - ULN2003APG :
Fig. 4.7: IC-ULN2003APG The ULN2003APG/AFWG Series are highvoltage, highcurrent Darlington drivers comprised of seven NPN Darlington pairs. All units feature integral clamp diodes for switching inductive loads. Applications include relay, hammer, lamp and display (LED) drivers. The suffix (G) appended to the part number represents a Lead (Pb)-Free product.
16
Features:
Output current (single output): 500 mA max High sustaining voltage output: 50 V min Output clamp diodes Inputs compatible with various types of logic Package Type-APG: DIP-16pin Package Type-AFWG: SOL-16pin
Features:
Common Anode
0.52 Inch Digit Height Continuous Uniform Segments Low power Requirement Excellent Characters Appearance High Brightness & High Contrast Wide Viewing Angle
17
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
18
A single pole dabble 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. Diode D2 is the standard diode on a mechanical relay to prevent back EMF from damaging Q3 when the relay releases. LED L2 indicates relay on.
19
5. SOFTWARE DESIGN
5.1 FLOW CHART
Start
Turn ON Relay
Counter Incremented
Counter Decremented
Counter Set to 0
20
1.
If the sensor 1 is interrupted first then the microcontroller will look for the sensor2.And if it is interrupted then the microcontroller will increment the count and switch on the relay, if it is first time interrupted.
2.
If the sensor 2 is interrupted first then the microcontroller will look for the sensor 1. And if it is interrupted then the microcontroller will decrement the count.
3.
When the last person leaves the room then counter goes to 0 and that time the relay will turn off. And light will be turn off.
21
5.2
PROGRAM
#include<REGX51.h> #include<stdio.h> #include<string.h> /*----------------PIN Declarations----------------------------------*/ #define LCD_BUS sbit Select sbit sbit sbit sbit sbit sbit LCD_E Relay first second IR1 IR2 = = = = P1^1; P1^2; P1^4; P1^3; = = P1^5; P1^6; //LCD Enable LCD_RS P0 = P1^0; //LCD Register
/*-----------------Global Variables----------------------------*/ char lu[17]; int i,j,count=0,count1 = 0,flag1 = 1,flag2 =1; /*-------------Function Declarations----------------------*/ void lcdinit(); void data2lcd(unsigned char ); void disp_msg(); message int disp_num(unsigned char,unsigned char); void delay(); generate 5ms void delay_s(); //to generate 1s //to display number //to //to initialize lcd //commands to lcd //to display
22
23
24
25
26
disp_num(count1,0x8D); delay_s();delay_s();delay_s(); } if(IR2 == 1) { if(count <= 0) { count = 0; count1 = count; } else { count--; count1 = count; } count1 = count; disp_num(count1,0x8D); delay_s();delay_s();delay_s();
27
delay_s(); } else if((count <= 0) && (flag2 == 1)) { Relay = 1; flag1 = 1;flag2 = 0;
delay_s(); }
delay(); } check();
28
/*delay for 5ms*/ void delay() { TH0=0Xfd; TL0=0XE8; TR0=1; while(TF0==0); TR0=0; TF0=0; } //LOAD VALUE OF TH0 //LOAD VALUE OF TL0 //START TIMER //WAIT TO SET TF0 //CLEAR TR0 //CLEAR TF0
/*-----------------LCD---------------------------*/ void lcdinit() { LCD_BUS=0x38; data2lcd(0); LCD_BUS=0x0c; data2lcd(0); LCD_BUS=0x01; data2lcd(0); LCD_BUS=0x80; data2lcd(0); }
29
30
for(y=0;y<p;y++) { LCD_BUS=pos; data2lcd(0); num[y]=num[y]&0x0f; num[y]=num[y]|0x30;//ascii conversion LCD_BUS=num[y]; data2lcd(1); pos--; } } void zero2() { first = 0; second = 1; P2 = 0x81;
31
delay(); delay();
32
delay(); delay(); }
void six1() {
33
delay(); delay(); }
34
35
delay(); delay(); } else if(count == 10) { zero1(); one2(); delay(); delay();delay();delay(); delay();delay();delay();
36
37
38
39
40
7. FUTURE EXPANSION
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.
41
Disadvantages
o It is used only when one single person cuts the rays of the sensor hence
it cannot be used when two person cross simultaneously. o Separate enter and exit doors are required
42
Website
www.8051projects.info www.datasheets4u.com www.8051.com
43