Building Automation System
Building Automation System
Building Automation System
Abstract
With the advancement of technology things are becoming simpler and easier for us. The
automatic systems are preferred over manual system. This project focus on building
automation system (BAS) that provides an automatic improving and controlling features
to control several typical devices in building automatically , rather than manual means .
It also facilitates interaction among different electrical home appliances devices. Here in
our project we write a code and circuit diagram for temperature control system, automatic
light control system and door security system, on single PIC16f877A microcontroller
while for the software implementation, Micro C PRO for PIC has been used to interface
with the hardware. To implement this project it requires a less cost for initial investment.
This project successfully achieved main objective which enables us to automate devices
in an efficient way and to save energy in a single room until simulation.
Undertaking
We certify that project work titled building automation system is our own work. Where
material has been used from other sources it has been properly acknowledged referred.
Acknowledgement
We give a great heart full thanks to almighty GOD for giving us strength and health from
beginning till now. Next we express our deepest gratitude to our advisor inst.
TALEGETA .M for his guidance to follow right way in our project work and his
unlimited advice .our appreciation and thanks also goes to our electrical and computer
engineering department team members for their emotional support , valuable information
and coordinal support throughout the year that they had given to us. We went to express
our deepest tanker for our family and friends for their support by providing what we
needand words can’t express our gratitude for all they have support us in our way
Table Contents
Abstract ............................................................................................................................. I
Acknowledgement ............................................................................................................ iii
Table of figure ............................................................................................................... vii
List of table ....................................................................................................................viii
1.2. Significant of the project ........................................................................................... 2
1.3. Statement of problem ............................................................................................... 2
1.4. Objective of the project............................................................................................. 2
1.4.1. General objective ............................................................................................... 2
1.4.2. Specific Objective .............................................................................................. 3
1.5. Scope of the project .................................................................................................. 3
1.6. Limitation of the project ........................................................................................... 3
1.7. Outlines of the project .............................................................................................. 3
2.2. Features of building automation system ...................................................................... 5
2.2.1. Automatic light control ....................................................................................... 5
2.2.2. Door security system .......................................................................................... 7
2.2.3.Temprature control system for single room ............................................................ 8
2.3. Components that we use in this project ....................................................................... 9
2.3.1. Hard ware component......................................................................................... 9
2.3.2. Software used .............................................................................................. 17
Chapter three................................................................................................................... 20
3. Design of project .......................................................................................................... 20
3.1. Design procedure ................................................................................................... 20
3.1.1. Design for automatic light control ...................................................................... 20
3.1.2. Design for temperature control system................................................................ 22
3.1.3. Design for door security system ......................................................................... 24
Chapter four .................................................................................................................... 27
4. Result and discussion.................................................................................................... 27
4.1. Simulation result of Automatic Light Control (ALC) .................................................. 27
4.2. Simulation result for Temperature Control System ..................................................... 31
4.3. Simulation result for Door Security System ............................................................... 33
Chapter five .................................................................................................................... 38
5. Conclusion and Rrecommendation ................................................................................. 38
Table of figure
Figure 1. LM35 connection .............................................................................................. 10
Figure 2. 3*4 keypad connection ...................................................................................... 13
Figure 3.pin connection of PIC16f877A ............................................................................ 14
Figure 4.16x2 LCD ......................................................................................................... 15
Figure 5. block diagram for automatic light control ............................................................. 21
Figure 6.flow chart for automatic light control ................................................................... 21
Figure 7. block diagram for temperature control system ...................................................... 23
Figure 8.flow chart of temperature control ......................................................................... 23
Figure 9.block diagram for door security system................................................................. 25
Figure 10. Flow chart for automatic door security system .................................................... 26
Figure 11.result 1 for automatic light control ..................................................................... 27
Figure 12.result 2 for automatic light control ..................................................................... 28
Figure 13.result for automatic light control ........................................................................ 29
Figure 14.result 4 for automatic light control ..................................................................... 30
Figure 15.result 1for temperature control ........................................................................... 31
Figure 16.result 2 for automatic light control ..................................................................... 32
Figure 17.result 1 result 1 for door security system ............................................................. 33
Figure 18.result 2 for door security system ........................................................................ 34
Figure 19.result 3 for automatic door security system.......................................................... 35
Figure 20.result 4 automatic door security system............................................................... 36
Figure 21.result 5 for automatic door security system.......................................................... 37
List of table
Table 1. Pin description of 16x2 LCD ............................................................................... 15
Table 2.pin description ULN2003A .................................................................................. 42
Table 3.pin description of PIC16f877A ............................................................................. 44
Chapter one
1. Introduction
1.1. Background
Building automation system provides an automatic control of the condition of indoor and
outdoor environments. Now a day, human have risen up their living standard due to rapid
economic expansion and development, a lot of buildings were built for educational
leisure and business purposes. All these buildings need modern control system in order to
make the building achieve their requirement. They require easy and modern system those
are building automation system in all these building for each single room.
The core application areas of building automation system cover several objectives;
however only three of them are discussed and are on our target to achieve in this project.
These three core areas are listed below and discussed.
One of the most critical sensitive tasks under building automation system is safety and
security. It is very essential to keep on checking private zone where some specific
employees are only allow to enter. This access is controlled by using keypad.
When the temperature is high so we get fan in many office and room this fan is on all the
day with high and low temperature and sometimes they forget to off this fan , due to this
the fan is not reliable or life span is short and there may be loss of power. To solve this
problem we design fan control system automatically.
In one office there is an equipment that is cost and to replace them it takes more time, but
usually we hear that those equipment lost and borrow by somebody, so to solve this
problem the office must be secure , due to this we design door security system to make
the room or office more secure.
The second chapter summarizes literature review and history of building automation
system. The third chapter explains design methodology, description of block diagram
and flow chart of the systems briefly and some component used.
Chapter two
2. Literature review
2.1. History of building automation system
The term building automation system loosely used refers to any electrical control system
that is used to control a building heating , cooling , and ventilation system (HVAC)
modern building automation system can also control indoor and outdoor lighting as well
as security , fire alarms and basically everything else that is electrical in building on
either ac or dc wiring.
It is centralize system, network of hard ware and software which monitor and control the
environment in commercial, industrial and institutional facilities while managing various
building system. Automation system ensures operational performance of facility as well
as comfort and safety building occupants. Typically such control systems are installed in
new building.
Someone switches on lights at the start and at the end of the day. other more sophisticated
building (few of them ) implement some sort of automatic control of lighting making this
It is obvious that more effective control we apply to lights in a building the more
comfortable. we will make it for people who spend a good part of their lives tree and of
course the more energy efficient we make the building itself with all benefits related to it
, reduction in electricity bill , maintenance budget , carbon foot print etc.
Lighting needs vary with the intended use (for example lighting offices , corridors ,
cubicles and training rooms) and characteristics of the area (such as room size and shape ,
ceiling height and availability of natural lights) most building condition more than one
type of lighting control system . On/off operation is an area where many designed create
a un workable lighting scheme.
In our project we control light for single room. Our project is different from previous one
in that explained above is it control the light by sensing the number of people entering the
room and leaving the room. When the person enter in to the room it senses and on the
lights automatically by its own. This project is different from thee other project by it uses
the reserve switch which means when the person have no interest to on the light or if
The oldest known mechanical functioning lock was an Egyptian door lock used about
2000BC, made of wood and fastened vertically on the door post, the wooden block
contained moveable pins or “pin tumblers” that dropped by gravity into openings in the
cross piece of “bolts” and locked the door. It was operated by a wooden key with pegs
that raised the number of tumblers sufficiently to clear the bolt so that it could be pulled
back. The major disadvantage with it is that it was wholly made of wood. The Romans
made an improvement on this by fabricating the first metal locks which was later
improved by Robert Barson, an English man in 1778 and Linus Yale Jnr an American in
1861. The Yale lock consists of essentially a cylindrical plug placed in an outer barrel.
The plug is rotated and in turn moves the bolt of the lock by means of a cam. The inserted
key raises five pins of different sizes into corresponding holes in the plug.
The most common form of cylindrical lock used in homes is the so-called night latch,
operated from a key from outside and a knob from inside. In the 20th century, as machine
tools and manufacturing methods became more sophisticated, locks were produced,
which are either key operated (opened) or keyless. In the late 20thcentury,
electromechanical locks were developed to trip electrical circuit as seen in automobile
ignitions. Other keyless locks include remote controlled lock, “security card” operated
and electroniccs [3].
Nowadays, the usage of fan is controlled manually bypressing on the switch button. This
non-innovative featuremakes it unable to turn on automatically according totemperature
changes. So, an automatic temperature controlsystem technology is applied for the
switching purpose inthis circuit. Due to its advantages, many projects focusing on
automatic temperature control system application indifferent fields will gain the benefits.
For examples, anautomatic temperature controller for multielement arrayhyperthermia
systems,multi-loop automatic temperaturecontrol system design for fluid dynamics ,
automatic temperature control for transport airplanes , design of automatictemperature-
control circuit module in tunnel microwaveheating system , automatictemperature and
humidity control system using airconditioning in transformer substation and so
forth.There is also a case study of automatic temperature controlsystem on diagnosable
discrete event system design. This project proposes an invention of temprature control
system for a single rom. It has an automation operation by usinga microcontroller. It uses
a unique design. This is to enhance its functionality to become more efficient and
effective for hot weather condition. The circuit provides a comfort for human’s life,
especially for hot city. It really helps to solve the problem of handicapped personwhen to
switch on the fan.[4]
We can observe different works in temperature control system applied previously.
Temperature control for cooking system that is for stove applied in 2011 in Malaysia by
NORTHRAN .J a Malaysian university student. His method control the stove
temperature by using temperature sensor that senses the condition of stove and it takes
possible measure when temperature of stove going above or below specified value. This
In our project we also control the temperature this project is different from the above we
have seen is it control the temperature for single room. We control the room temperature
when the temperature is above 27 degree centigrade. In this system we use the
temperature sensor which senses the temperature and give signal to micro controller. This
system is different because it does not need any keypad the temperature sensor sense the
temperature and the fan on or off by its own and also when the person does not need the
fan or the temperature is become low degree centigrade there is heater that we proposed
to do.
2. Temperature sensor
3. IR sensor
5. Motor driver
6. Relay
7. Relay driver
8. Keypad
Infrared light is electromagnetic radiation with a wave length longer than that of visible
light s measured from nominal edge of visible red light, at 0.7 micrometers, and
extending conventionally to 300 micrometers. These wave length correspond to a
frequently range of approximately 1 to 430 THZ, and included most of thermal radiation
The output voltage of a LM35 is proportional to the temperature in Celsius. LM35 sensor
is interfaced with microcontroller to measure room temperature vs. of the LM35 are
given to 5V and vout pins are given to AN0.
2. Relay
A relay is electromagnetic switch, which activated when a small current is passed through
its coil. The interesting fact is that a small current is capable for turning on secondary
circuit which works on a much larger current. There are varieties of relay available in
A relay consists of an electromagnet (coil), a switch, and a spring. The spring holds the
switch in one position until there is a current passed through the coil and then the
magnetic field is generated by the coil which moves the position of the switch.
Anyhow, it can be activated by a very small amount of current but the switch can handle
a lot of current.
The important part of relay is the coil. The coil makes the relay as an electromagnetic
switch. The principle of electro magnet is when a current carrying conductor induces a
magnetic field .if the conductor is covered around an iron core, the iron core becomes
magnetized. This is called electromagnet. The same principle is applied for relay too.
When a current pass via the relay coil the elector magnet is set up ad pulls one switch
contact away from other.
Motor driver is used to control motor through microcontroller. We use in this project
ULN2003A integrated motor driver. It is used as a motor driver. It provides logic to
control direction of motor. It is assembled in a 16 pin lead plastic package. This has 4
center pins connected together.
2. Relay driver
A relay driver is a high voltage and high current. It contains seven open collector pairs
.with common emitted. A pair is an arrangement of two bipolar transistors. It belongs to
family of ULN200x series of integrated circuit. These integrated circuit are used when
driving wide range of load and are used as relay drivers, display drivers, line driver etc. it
also commonly used while diving steeper motor.
3. 3x4 keypads
The 12 keys keypad is widely used in many applications, some of those are: telephones
and ATM machines. There are many different types of keypads and the keypad which
would be explained here would a matrix method in order to find which key is pushed.
This keypad does not have pins for Vdd or Vgnd, which means it does not require a direct
connection to a voltage source to perform its task. Also this keypad has 7-pins and each
pin would represent a row or a column. As this keypad has 12 key, it has 3 columns and
for rows. The mount of the keypad is as seen in which shows the dimension and pins
location.
The keypad has a 3-columns and 4-rows matrix orientation. If a key is pushed then the
circuit would be shorted for those specific key pins. The short circuit would always be
between a row pin and a column pin. For this specific 96AB2-152-F keypad the rows 1-4
are represented by pins 1-4 and columns 1-3 are represented by pins 5-7. For example
button 1 would be represented by pins 1 and 5, so if a voltage is applied to one of the pins
and a voltammeter is connected to the other pin, when the button is pushed the
voltammeter would read the input voltage.
The main controlling unit of proposed system is microcontroller. The main features of
microcontroller that is particularly PIC16F877A is discussed here. A microcontroller
consists of a powerful CPU tightly coupled with memory (RAM , ROM , EPROM),
various I/O feature such as serial port , portal port , timer/ counter ,interrupt controller ,
data requisition interface , analog to digital converter, digital to analog converter
everything integrated to single silicon chip . It does not mean that any micro controller
should have all the above features on a single chip.
Liquid crystal display (LCD) is a flat panel display, electronic visual display, or video
display that uses the light modulating properties of liquid crystals. Liquid crystals do not
emit light directly. LCDs are available to display arbitrary images (as in a general-
purpose computer display) or fixed images which can be displayed or hidden, such as
preset words, digits, and 7-segment displays as in a digital clock. They use the same basic
technology, except that arbitrary images are made up of a large number of small pixels,
while other displays have larger elements.
A 16x2 LCD means it can display 16 characters per line and there are 2 such lines. In this
LCD each character is displayed in 5x7 pixel matrix. This LCD has two registers,
namely, Command and Data. The command register stores the command instructions
10 DB3
11 DB4
8 bit data pins
12 DB5
13 DB6
14 DB7
15 Backlight VCC(5v) LED+
16 Backlight ground(0v) LED-
B. Register select:
It decides either command code register is selected or data register is selected. If Rs꞊0, it
will select the command register to send command to the LCD otherwise data register
will be selected.
This input pin is used to determine either data is going to write on the LCD to read from
it. If R∕W꞊1 means data regarding while R∕W꞊0 data is going to be write on LCD
D. Enable:
In order to latch in information presented to its data pin, enable (E), pin is used; high low
pulse must be applied to the e pin for latching purpose.
Information is sent to read through data bus depending up on to registers gives selection
pin status, as described earlier. ASCI code is sent to either command or display the data.
Different command codes are used to perform different tasks.
For example: if button `8' is pushed the microcontroller would set the first row to low,
then detect if an input goes low, which none would because `8' is connected to row 3
which is high and then the shorted output between column 2 and row 3 would still be
high. Then the microcontroller will reset row 1 to high and set row 2 to low, which would
not change any input. Then, the microcontroller would reset row 2 to high and set row 3
to low, and try to detect if one of the columns inputs is low, which the 2nd column would
be low, because when `8' is pressed column 2 would be shorted with row 3 and since row
3 is low, and column 2 is connected to it and to a pull up resistor, the resistor would pull
the voltage away from the pin of column 2 which makes the microcontroller detects a low
input in column 2 when row 3 is set to low, then it would now that `8' is pressed.
2.3.2.2. MIKRO C
Chapter three
3. Design of project
We construct, design and develop block and circuit diagram to automatic light control,
temperature control system and door security system, on a single PIC16f877A by using
PROTUS. The software is developed by having flowchart and specifying the condition to
be implemented in MIKROC. The code is written on the PIC16F877A to integrate all
features that is to be included in the building automation system.
To develop the building automation system circuit; electronic equipment such as sensors
(IR sensor, temperature sensor), capacitor, LCD, motor driver, transistor and
microcontroller are used. Comparison and discussion of the result from design with
expected result is done and the suggested model is justified with direction of future work
is clearly pointed out in this methodology and finally the project report is written
including PROTEUS simulation output results.
LCD
interface
IR PIC16F877A
sensor
Switch
Start
Yes No
While
loop
Yes No No
Count+
Count--
+
Count>0
Count>0
Light off
Light on Light on
The LCD will display number of people who are entering and leaving the room and state
of lights, whether the lights on /off. In case at which some problems happen for instance
when the sensor or microcontroller fail to operate and if a person wants to operate the
lights manually the reserved switch are used to make light turn off.
Temperature
sensor
LCD
PIC16F877A
Cooling
fan
Start
Read
temperature
If T>27
No Yes
Fan on
Fan off
Let the temperature value is 27 degrees centigrade, the micro controller understand this
temperature as a 56.
In this system we have ensured a safe locking system. From outside the lock would not
be visible but this in built locking system ensures security. This lock can be opened and
closed with the help of a password which we will give using a keypad. The door will
open or close only if the password is correct else it will remain in its original state. The
lock cannot be broken because to the person standing outside can just see closed door and
not the lock as it is in built. The password is given with the help of controller and can
change by simply making a small change in program and then the program in controller.
LCD
First, microcontroller which is interfaced with LCD display a word which says press
*key. If this when we press the key(*) button , the microcontroller sends display
information to the LCD display as enter password and after we enter a password the LCD
displays that the password is reset which is “password set”, when we enter the reset
password Furthermore, the microcontroller sends the command signal to motor driver to
rotate the motor driver integrated circuit to rotate the motor in particular direction such
that the door opens at the same time LCD display DOOR OPENS after some time of
delay, and then door starts closing from command it gets from microcontroller and after
door closed LCD displays DOOR CLOSED after ensuring the door is closed it go back
again to start.
If the people attempts may be forget the password by using the reset password he or she
can create their own password, so this enables the system or password is not steal by
others. Sometimes some systems like this use only or sold with password which set by
Start
Set password
Wrong
password
Delay
Password
set
DOOR
OPEN
DOOR
CLOSED
Chapter four
LCD1
LM016L
C1 +12v
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
22pf
X1
CRYSTAL
C2
U1
22pf 13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1 +12v
35
RB2
2 36
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
+5v RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
+5v RC0/T1OSO/T1CKI
8 16
9
RE0/AN5/RD RC1/T1OSI/CCP2
17 L1
RE1/AN6/WR RC2/CCP1 12V
10 18
RE2/AN7/CS RC3/SCK/SCL
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
RD1/PSP1
RD2/PSP2
21 Q1
22 2N2369
RD3/PSP3
27
RD4/PSP4
R3 RD5/PSP5
28
10k 29
RD6/PSP6
30
RD7/PSP7
R4
10k PIC16F877A
LCD1
LM016L
C1 +12v
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
22pf
X1
CRYSTAL
C2
U1
22pf 13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1 +12v
35
RB2
2 36
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
+5v RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
+5v RC0/T1OSO/T1CKI
8 16
9
RE0/AN5/RD RC1/T1OSI/CCP2
17 L1
RE1/AN6/WR RC2/CCP1 12V
10 18
RE2/AN7/CS RC3/SCK/SCL
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
RD1/PSP1
RD2/PSP2
21 Q1
22 2N2369
RD3/PSP3
27
RD4/PSP4
R3 RD5/PSP5
28
10k 29
RD6/PSP6
30
RD7/PSP7
R4
10k PIC16F877A
Lamp glow
Counter decrement by 1
LCD1
LM016L
C1 +12v
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
22pf
X1
CRYSTAL
C2
U1
22pf 13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1 +12v
35
RB2
2 36
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
+5v RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
+5v RC0/T1OSO/T1CKI
8 16
9
RE0/AN5/RD RC1/T1OSI/CCP2
17 L1
RE1/AN6/WR RC2/CCP1 12V
10 18
RE2/AN7/CS RC3/SCK/SCL
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
RD1/PSP1
RD2/PSP2
21 Q1
22 2N2369
RD3/PSP3
27
RD4/PSP4
R3 RD5/PSP5
28
10k 29
RD6/PSP6
30
RD7/PSP7
R4
10k PIC16F877A
Counter zero
LCD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q1 RL1
2 26 BC547 12V
VOUT RC7/RX/DT
19
RD0/PSP0
20
RD1/PSP1
3 LM35 21
RD2/PSP2
22
RD3/PSP3
27
RD4/PSP4 +12v
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7
PIC16F877A
2.The LM35 senses the temperature which is greater than room temperature, during this
time the LCD displays the amount of temperature read by the sensor and also sends a
command to activate the fan in order to rotate it to maintain the room temperature.
LCD1
LM016L
+5v
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
R1
10k
U1
13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1
35
RB2 +12v
2 36
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5
5 39
RA3/AN3/VREF+ RB6/PGC
6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT R2
U2 RC0/T1OSO/T1CKI
15 R3
1 8 16 10k
RE0/AN5/RD RC1/T1OSI/CCP2 10k
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
23
37.0 RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
RC6/TX/CK
25 Q1 RL1
2 26 BC547 12V
VOUT RC7/RX/DT
19
RD0/PSP0
20
RD1/PSP1
3 LM35 21
RD2/PSP2
22
RD3/PSP3
27
RD4/PSP4 +12v
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7
PIC16F877A
LCD1
LM016L
C1 RP1
1
22pF 2
VDD
VSS
VEE
3
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
4
U1 5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
X1 13
OSC1/CLKIN RB0/INT
33 6
CRYSTAL 14 34 7
OSC2/CLKOUT RB1
35 8
RB2
2 36
C2 RA0/AN0 RB3/PGM
3 37 RESPACK-7
RA1/AN1 RB4
4 38
RA2/AN2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SP0
20
3
RD1/PSP1
21
RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
+5v
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
9
1
1B
COM
1C
16
D 0 #
2 15
2B 2C
3 14
3B 3C
4 13 0.00
4B 4C
5 12
5B 5C
6 11
6B 6C
7 10
7B 7C
ULN2003A
Chapter five
In automatic light control system we conclude that the design of automatic light control
system is to decrease power consumption by light and ensure the time availability of
equipment because in building large amount of energy used from each office , house. So
we use light automatically it save that energy.
Automatic temperature control systems fulfill the desire area in this project. By automatic
temperature control system we maintain the temperature of environment by comparing
room temperature automatically by using fan system. This system generally use their
environment effectively and efficiently and able to user recreate their environment.
Automatic door security system provides the desire area which is security and safety. In
this system the manufacturer sell the system with reset password this enables that the user
set their own password and use this password. This enables to user able to open the door
when he/she forget the password and it protect the password from theft.
The major purpose of designing and implementation this controlling strategy is to save
energy which is the most important phase, because in many power plant or process and
manufacturing plants large amount of energy is used.Generally, the overall Building
Automation System is meets it objectives by the developed program MIKRO C and
circuit diagram by PROTEUS. The operation is functioning accordingly and smoothly
following the procedure taken. The circuit has fulfilled the main objectives, which are
automatic light control, fan control system and door security system according to the
desire.
5.2 Recommendations
We strongly recommend that these projects should be used at commercial as well as
domestic levels not only to save energy but also to provide safe security system and make
life easy.
References
[1].http://www.ecnweb.com/mag/electric.lighting control/index seen at May 2016 at 9
o’clock
ABBREVATION
ADC……………………………Analog Digital Converter
APPENDIX A
APPENDIX B
APPENDIX C
Circuit diagram for automatic light
LCD1
LM016L
C1 +12v
VDD
VSS
VEE
RW
RS
D0
D1
D2
D3
D4
D5
D6
D7
E
1
2
3
4
5
6
7
8
9
10
11
12
13
14
22pf
X1
CRYSTAL
C2
U1
22pf 13 33
OSC1/CLKIN RB0/INT
14 34
OSC2/CLKOUT RB1 +12v
35
RB2
2 36
RA0/AN0 RB3/PGM
3 37
RA1/AN1 RB4
4 38
RA2/AN2/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4
U1 5
1
2
3
4
5
6
7
8
9
10
11
12
13
14
X1 13
OSC1/CLKIN RB0/INT
33 6
CRYSTAL 14 34 7
OSC2/CLKOUT RB1
35 8
RB2
2 36
C2 RA0/AN0 RB3/PGM
3 37 RESPACK-7
RA1/AN1 RB4
4 38
RA2/AN2/VREF-/CVREF RB5 +5v
5 39
+5v RA3/AN3/VREF+ RB6/PGC
22pF 6 40
RA4/T0CKI/C1OUT RB7/PGD
7
RA5/AN4/SS/C2OUT
15
RC0/T1OSO/T1CKI
8 16
RE0/AN5/RD RC1/T1OSI/CCP2
9 17
RE1/AN6/WR RC2/CCP1
10 18
RE2/AN7/CS RC3/SCK/SCL
23
RC4/SDI/SDA
1 24
MCLR/Vpp/THV RC5/SDO
25
RC6/TX/CK
26
RC7/RX/DT
19
RD0/PSP0
20
1
RD1/PSP1
21
RD2/PSP2
22
RD3/PSP3
RD4/PSP4
27
+5v
A 1 2 3
28
RD5/PSP5
29
RD6/PSP6
30
RD7/PSP7 B 4 5 6
PIC16F877A
C 7 8 9
U2
9
1
1B
COM
1C
16
D 0 #
2 15
2B 2C
3 14
3B 3C
4 13 +88.8
4B 4C
5 12
5B 5C
6 11
6B 6C
7 10
7B 7C
ULN2003A
APPENDIX D
Program code for each system
1. Code for automatic light control system
int TO ,str , people=0, ADCON ,FF;
int sw , light=0, counter=0;
int txt[10],txt1[10];
int n,m;
ADC_Init(); // Initialize ADC module with default settings
//LCD module connection;
sbit LCD_RS at RB2_bit;
sbit LCD_EN at RB3_bit;
sbit LCD_D4 at RB4_bit;
sbit LCD_D5 at RB5_bit;
sbit LCD_D6 at RB6_bit;
sbit LCD_D7 at RB7_bit;
sbit LCD_RS_Direction at TRISB2_bit;
sbit LCD_EN_Direction at TRISB3_bit;
sbit LCD_D4_Direction at TRISB4_bit;
sbit LCD_D5_Direction at TRISB5_bit;
sbit LCD_D6_Direction at TRISB6_bit;
sbit LCD_D7_Direction at TRISB7_bit;
//end LCD module connection
unsigned char op;
void main() {
porta=0;
portb=0;
portc=0;
TRISB=0X00; //PORTb are out put(LCD)
}
void code_read(){
delay_ms(20);
pwd[0]=eeprom_read(0x00);
delay_ms(20);
pwd[1]=eeprom_read(0x01);
delay_ms(20);
pwd[2]=eeprom_read(0x02);
delay_ms(20);
pwd[3]=eeprom_read(0x03);
delay_ms(20);
}
void code_write(){
delay_ms(20);
eeprom_write(0x00,txt[0]);
delay_ms(20);
eeprom_write(0x01,txt[1]);
delay_ms(20);