Professional Documents
Culture Documents
Room Autosssssssssssssssssssssssss
Room Autosssssssssssssssssssssssss
Room Autosssssssssssssssssssssssss
FACULTY OF ENGINEERING
A MICROCONTROLLER-BASED
ROOM AUTOMATION SYSTEM
By
Hansveersing MUNGROO
ID: 0912292
PROJECT SUBMITTED AS PART FULFILLMENT
FOR AWARD
OF
BEng(Hons) MECHATRONICS
UNIVERSITY OF MAURITIUS
PROJECT/DISSERTATION DECLARATION FORM
Name:
Student ID:
Programme of Studies:
Module Code/Name:
Title of Project/Dissertation:
Name of Supervisor(s):
Declaration:
In accordance with the appropriate regulations, I hereby submit the above dissertation for
examination and I declare that:
(i) I have read and understood the sections on Plagiarism and Fabrication and
Falsification of Results found in the Universitys General Information to
Students Handbook (20. /20.) and certify that the dissertation embodies the
results of my own work.
(ii) I have adhered to the Harvard system of referencing or a system acceptable as per
The University of Mauritius Referencing Guide for referencing, quotations and
citations in my dissertation. Each contribution to, and quotation in my
dissertation from the work of other people has been attributed, and has been cited
and referenced.
(iii)I have not allowed and will not allow anyone to copy my work with the intention of
passing it off as his or her own work.
(iv) I am aware that I may have to forfeit the certificate/diploma/degree in the event that
plagiarism has been detected after the award.
(v) Notwithstanding the supervision provided to me by the University of Mauritius, I
warrant that any alleged act(s) of plagiarism during my stay as registered student
of the University of Mauritius is entirely my own responsibility and the
University of Mauritius and/or its employees shall under no circumstances
whatsoever be under any liability of any kind in respect of the aforesaid act(s) of
plagiarism.
Signature:
Date:
ii
ACKNOWLEDGEMENTS
This project has been realised by the continuous help and support of many people. First,
I would like to thank my project supervisor, Mr V. Oree for his encouragement,
precious guidance and patience during the course of my final year project.
iii
ABSTRACT
Room automation is the inhabited expansion of home automation. It is automation of a
room and home activities. Room automation might comprise lighting control, heating,
ventilation and air-conditioning appliances and other systems, to grant comfort, energy
efficiency, security systems and ease of use. This project outlines the design and
implementation of a Microcontroller-based room automation system. Its main
objectives are to design an automated system that will control various parameters and to
improve the energy efficiency of a room.
Four sensors were implemented in the room (Motion, smoke, light and temperature) as
input devices to monitor different parameters like: Occupancy of the room, heavy
smoke in case of fire, day and night, amount of natural light present inside the room, the
prevailing temperature in the room. A microcontroller is activated with signals from the
electrical/electronic circuitry of the respective sensors. In this system a PIC16F877A
microcontroller was used to control the following output devices: a fan, a buzzer, a LED
and two stepper motors for two blinds mechanism. The microcontroller was
programmed in MikroBasic language before it was used to perform the required tasks.
iv
DC : Direct Current
AC: Alternating Current
LED: Light Emitting Diode
LDR: Light Dependent Resistor
PIR: Passive Infrared
K: kilo
Mm: Millimetres
Nm: Newton meter
V: Volts
N: Newton
TABLE OF CONTENTS
INTRODUCTION ................................................................................................ 1
1.1
1.1.1
1.2
1.3
Project Justification......................................................................................... 3
1.4
1.5
Methodology .................................................................................................. 4
1.6
2.2
2.2.1
2.2.2
2.3
2.3.1
2.3.2
2.3.3
Temperature Sensors.............................................................................. 15
2.3.4
2.3.5
Controllers ............................................................................................. 19
2.3.6
Lamps .................................................................................................... 22
2.3.7
Motor .................................................................................................... 24
2.3.8
3.2
3.3
Calculation of the maximum torque required for the blind to start rotating .... 33
3.4
3.4.1
3.4.2
3.4.3
3.4.4
3.4.5
Controller .............................................................................................. 35
3.4.6
3.4.7
3.4.8
Motor .................................................................................................... 38
3.4.9
4.2
4.3
4.3.1
4.3.2
4.4
4.5
Freewheel ..................................................................................................... 48
4.6
Transmission Mechanism.............................................................................. 49
4.7
Finishing ....................................................................................................... 50
4.8
Safety ........................................................................................................... 50
5.2
5.3
Interface between the outside Light Sensor and the Microcontroller .............. 52
iii
5.4
5.5
5.6
5.7
5.8
Interface between the Microcontroller and the output devices Buzzer and LED
56
5.8.1
LED....................................................................................................... 56
5.8.2
Buzzer ................................................................................................... 57
5.9
6
Microcontroller ............................................................................................. 59
6.2
7.1.1
7.1.2
7.2
7.2.1
7.2.2
7.2.3
7.2.4
7.2.5
7.3.1
7.3.2
CONCLUSION ................................................................................................... 70
iv
8.1
8.2
REFERENCES ........................................................................................................... 72
APPENDIX A ............................................................................................................ 75
APPENDIX B ............................................................................................................. 93
LIST OF TABLES
Table 1.1: Energy consumption for major consumers ................................................... 3
Table 2.1: Various types of sensors ............................................................................ 17
Table 2.2: Types of Electric Motors ............................................................................ 24
Table 3.1: Selection of materials for construction of the room ..................................... 32
Table 3.2: Selection of lamp........................................................................................ 38
Table 3.3: Hybrid bipolar stepper motor specifications ................................................ 39
Table 7.1:Outputs of the PIR Motion Sensor ............................................................... 66
Table 7.2: The output voltage of the input light intensity ............................................. 67
LIST OF FIGURES
Figure 1.1: A complete Home Automation system [1] ................................................... 1
Figure 1.2: General block diagram of the whole system ................................................ 5
viii
1.0 Introduction
INTRODUCTION
1.0 Introduction
Home automation has been a feature of science fiction writing for many years, but has
only become practical since the early 20th century following the widespread
introduction of electricity into the home, and the rapid advancement of information
technology. The emergence of electrical home appliances began between 1915 and 1920
and the decrease in domestic servants meant that households needed cheap, mechanical
replacements. Ideas similar to modern home automation systems originated during the
World's Fairs of the 1930s [2]. With the invention of the microcontroller, the cost of
electronic control fell rapidly. Remote and intelligent control technologies were adopted
by the building services industry and appliance manufacturers worldwide, as they offer
the end-user easier accessibility and greater control of their products. During the 90s
home automation rose to prominence.
1.1.1
Home automation is a modern technology that modifies your home to perform different
sets of tasks automatically. Today, automation technology is gaining more recognition
among people not just for home modification but in industrial and business sectors too.
Home automation technology is constantly improving its flexibility by incorporating
modernized features to satisfy the increasing demands of people.
When it comes to home automation, there are a few steps that must be followed in
order to implement the home automation technology effectively. First, the automation
needs should be planned. For example, if the overall objective is to improve your
security system, then a checklist all its requirements is required before starting the
automation process accordingly. If - lighting units are suspected to consume a large
amount of energy then they could be automated to avoid unnecessary waste of
electricity. Such a step would provide comfort, security and save power. Home
automation technology is growing drastically and its demand is increasing in a wide
range of sectors. In this project, home automation has been considered. For
convenience, a single room encompassing the main appliances has been used [3] [4].
1.0 Introduction
feasible to install a proper home automation system. However, theft is one of the main
problems faced by most home-owners in the country. Most houses in Mauritius do not
possess a complete security system. In addition, cases of fires due to carelessness are
rising at a high rate nowadays. Hence, residential buildings are vulnerable to such acts.
Energy consumption by the domestic sector has also been on the rise in the last decade,
from 491.9 GWh in 2000 to 710.7 GWh in 2010 [5].
Category
Number of
Average
Energy
Annual
consumers in
annual
consumption
energy
growth rate
2000 (GWh)
growth rate
1995-2000
Domestic
288520
3.4 %
491.9
(89.1 %)
Commercial
27831
7008
3.3 %
374.8
293
1.5 %
485.8
323652
8.24 %
(35.4 %)
4.4 %
21.4
(0.1 %)
Total
10.0 %
(27.3 %)
(2.2 %)
Others
7.7 %
(35.8 %)
(8.6 %)
Industrial
1995-2000
8.0 %
(1.6 %)
3.3 %
21.4%
(100.0 %)
8.0 %
(1.6 %)
Furthermore, a huge amount of elderly and disabled persons have great difficulties in
moving around in their houses every day. Most of the time they need caregivers or
institutional care. In this context, a complete home automation will be of a great help.
1.3
Project Justification
Affordable:
1.0 Introduction
Home automation process does not require a huge big investment. A proper planning
during the construction phase will allow considerable savings for automation.
Easier operating and controlling of the technology due to its simple procedures that are
easy to learn and implement. It maintains human comfort without human intervention.
Enhanced performance:
Proper wiring and computer control are the important factors that determine the
effective performance of the automation technology. Usually, home automation systems
that are installed by professional installers are reliable and perform effectively without
causing frequent failures.
One of the important aspects of home automation technology is its ability to enhance
the security features of the home without requiring much change in the architecture. For
example, motion detector can be used to detect even the slightest movements around
homes without the need for wandering.
Energy savings:
1.5 Methodology
Sensors are used to monitor various parameters present in the room. The output from
the sensors is signal-conditioned and processed by a microcontroller. Accordingly,
actuators are activated by the microcontroller to adjust the various settings inside the
room.
Light sensors, placed inside and outside the room monitor continuously the lighting
level of the room. They command through the microcontroller the opening and closing
4
1.0 Introduction
of a blind mechanism as well as the bulb light intensity so as to maintain an acceptable
lighting level. Optimizing the use of natural light at the expense of artificial light result
in considerable savings in terms of electricity consumption. In addition, a motion sensor
is used to detect occupancy in the room and that same sensor will activate and
deactivate the whole system. To ensure user comfort within the room, temperature
should be maintained at a convenient level. For this purpose, a temperature sensor is
used to monitor the temperature and subsequently activate the required actuators
through the microcontroller. Security in the room is implemented through a smoke
detector to sense the presence of smoke and therefore, to notify the occupant of the
room of any danger.
1.6
Outline of project
1.0 Introduction
Chapter 3 provides an overview on how each component is used and their
importance.
Chapter 4 covers the mechanical design of the blind mechanism. The room is
designed in such a way to satisfy all the desired specification.
Chapter 5 discusses the way the electrical devices and the controller of the system
are interfaced with all the electronic circuitry and also the mounting of the circuits.
Chapter 6 revolves around the software design of the controller.
Chapter 7 includes the testing and results after the hardware and software
implementation have been completed.
Chapter 8 outlines the achievements, difficulties and limitations of the project.
Eventually, the last part focuses on how of the project can be improved.
The rest of the report comprises of appendices concerning data sheets of
components and the software coding.
LITERATURE REVIEW
One of the main objectives of this project is to implement an automation system which
is both efficient and low cost. In order to design a system that can achieve these
objectives, a comprehensive literature review has been performed on the key aspects of
the subject such as existing home automation systems and their implementation
strategies. In addition, this chapter is focused on the collection of information
concerning the different components of the Room Automation system, including
sensors and controllers.
2.1
System Description
Finally, all the actuators are controlled by an ATMELs AT89S52 microcontroller with
respective input sensors [9].
The disadvantages of the system are:
The ATMELs AT89S52 microcontroller is quite tough to use and two controllers
were used in this project when it could be been optimized to use only one.
10
11
13
14
2) Non-contacting method
Non-contact (Infrared) temperature sensing reads temperature by intercepting a part of
the infrared energy emitted by an object or substance and detecting its intensity. It is
used to sense temperature of solids and liquids but cannot be used on gases due to their
transparent nature.
Advantages of non-contact temperature sensors are:
16
Emissivity variations
Types of
Description
Diagram
sensor
Platinum
RTD
platinum
wire
or
pattern
is
method
features
high
Bi-Metal
Thermometer
Glass
Thermometer
mercury or alcohol.
(mercury,
alcohol)
17
goes
up,
the
applied
Electronics,
cars,
for
Home
and
OA
Measuring
infrared
radiations
Thermometer
are
non-contact-type
thermometer.
They are more expensive than ionization detectors but are easier to use.
2.3.5 Controllers
A controller is a device that processes data from inputs and actuates the required
outputs.
Two main types of controllers that may be considered for this project are:
1) Programmable Logic Controller(PLC)
2) Microcontrollers
19
Advantages of PLC:
It is flexible.
Disadvantages of PLC:
Applications that perform only one job, is not efficient in the use of PLC.
PLC is not considered necessary when applied to individual systems that do not
need to change wiring [22].
2.3.5.2 Microcontrollers
PIC Microcontrollers are the most commonly used microcontrollers nowadays. A PIC
microcontroller is a processor with built-in memory and RAM and can be used to
control devices [23].
Modern Science and technology have brought different types of PIC Microcontrollers
which have different specifications.
21
2.3.6 Lamps
A lamp is a device that provides illumination. There are different types of lamps
available nowadays. Below is discussed the various types of lamps that could be
considered as possible options for this project.
2.3.6.1 Incandescent Lamps
The incandescent lamp provides light by heating to incandescence a filament made of
tungsten. The incandescent lamp has the very significant drawback in that it converts
about only 10% of the electrical energy into light, the remaining 90% being lost as heat.
However, the incandescent lamp has got some advantages:
It is cheap.
Disadvantages of LEDs:
Electric Motors
DC Motors
AC Motors
Other Motors
Shunt Motor
Induction Motors
Stepper Motor
Synchronous Motor
Brushless DC Motor
Series Motor
Reluctance Motor
Hysteresis Motor
Compound Motor
Universal Motor
2.3.7.1 DC Motors
A DC motor is an electric motor that runs on direct current electricity. It can be powered
from batteries, solar cells or similar cell based energy sources. It is classified according
to the armature and filed coils. DC motors consist of five different types namely, shunt,
separately excited, series, permanent magnet and compound motor.
Advantages of DC motors:
Disadvantages of DC Motors:
Brush wear- Since they need brushes to connect the motor winding. Brush wear
occurs, and it increases dramatically in low-pressure environment.
Spark from the brushes may cause explosion if the environment contain
explosive materials.
Radiofrequency noise from the brushes may interfere with nearby T.V set or
electronic devices.
24
Resonance effect which occurs at lower speeds and the decreasing torque with
increasing speed [26] [27] [28].
25
It is durable.
It is easy to clean.
It acts as insulator.
26
In this chapter, a quick review is given elaborating on how each component is used and
what are the important features that are considered for their selection. A final design of
the prototype is also presented in this chapter, which has been drawn to scale using
Auto Cad 2010. The different components used in the microcontroller-based room
automation system are grouped into either mechanical or electronics and the evaluation
of each component is provided.
The major components needed to build the prototype mechanical part are:
Sheets of plywood (5mm thickness)
Iron rods
Stepper Motor
Gears
Iron chains
Wooden sticks
Sensors
1) Motion Detector
2) Light Sensor
3) Temperature Sensor
4) Smoke Detector
PIC Microcontroller
OLIMEX board
27
The roof is built in a V-shaped so that part of the electronic circuitry can be
implemented inside. The fixing of the sheets is done with nails and screws. Moreover, to
28
A vertical blind mechanism is preferred in this project. The reason behind this selection
is discussed in further details in section 3.4.10.
29
A stepper motor is chosen for some specific reasons for this automated room. A concrete
illustration of the reasons is provided later in this chapter section 3.4.8.
The stepper motor is connected to a freewheel, which was designed and manufactured
in the university mechanical workshop. A comprehensive and detailed illustration of the
process used is given in chapter 4 section 4.5. The freewheel and the stepper motor are
connected through a coupling mechanism, which is also described in chapter 4 section
4.4.
30
Whenever the stepper motor is switched ON, it produces a rotary motion which in turn
is transferred to the freewheel via the coupling. The freewheel is connected to other
freewheels by means of an iron chain. Therefore, when the motor rotates, the blind
either closes or opens. Eventually, these steps form part the mechanical section of the
Microcontroller-Based Room Automation System project.
The electrical section of this project consists of the different sensors: Motion,
Temperature, Smoke and Light sensors. In addition to these sensors an OLIMEX
board, a PIC Microcontroller and 2 Stepper Motors are used.
A comprehensive review on how the various sensors perform their respective tasks is
provided in system description in section 2.3 in chapter 2.A PIC Microcontroller is a
processor with built in memory, EEPROM, RAM, timers, analogue comparators. It can
be programmed to interact to the outside world. In this project, a program is fed to a
microcontroller to control various parameters like lighting, temperature and motion in a
room. The microcontroller regulates the voltage and current of the power supply,
preventing damage to it (which is very sensitive to high current surges). The OLIMEX
board can be connected to a PC via the RS232 port for testing or for programming
purposes without the need for a microcontroller programmer. A bipolar stepper motor
driver is essential to run the motor in the required stepping mode and in the proper
direction. Upon programming the stepper motor driver, the step mode, step rate and the
direction of the stepper motor are controlled.
31
Plywood
Iron Sheet
Aluminium
Materials
Plywood
Iron
Aluminium
Sheet
Availability
++
Cost
++
--
Malleability
Weight
++
++
Tensile Strength
++
Durability
++
Results
32
Key:
++ : Appropriate
- : Bad
-- : Not suitable
Upon analysing the features of table 3.1, a direct conclusion is reached that Plywood is
the most appropriate material for the construction of the room, with 8+. The second best
alternative is aluminium with its light weight, long durability and high tensile strength.
Furthermore, the automated room was entirely mounted with plywood while aluminium
was used for the manufacturing of the freewheel.
3.3 Calculation of the maximum torque required for the blind to start
rotating
The force required for the blind to start rotating was measured by the means of a spring
balance. The mass required for the latter to move was found to be 2.8 kg. The radius of
the freewheel is 0.03 m. The torque was obtained by using the equation:
T=Fxr
Where: T The calculated torque.
F The force required for rotation.
r The radius of the freewheel.
Using the equation: w = m x g, the weight is obtained. The weight here
corresponds to the force required to start the rotation.
Where: m mass required.
g Acceleration due to gravity (9.81 m/s)
Weight, w = m x g
= 2.8 x 9.81
= 27.47 N
Torque, T = F x r
= 27.47 x 0.03
= 0.824 Nm
33
It must be sensitive.
34
Ionization and photoelectric smoke detectors are both effective smoke sensors (as
referred to in section 2.3.4), as they have both passed the same certification test as UL
(A global independent safety science company) smoke detectors [13].
However, in this project, the photoelectric smoke detector has been selected, as it
responds more quickly to smouldering fires. The photoelectric detector can lead to rapid
condensation on the circuit board by steam or high humidity thus sounding the alarm. In
addition, back-up batteries may be used for photoelectric detectors.
3.4.5 Controller
In this project, a PIC Microcontroller has been preferred. PIC Microcontrollers are
special types of processor chips that are very small and versatile due to their
programmable nature. They are preferred to PLCs as they are very practical and easy to
use in homes. The PIC Microcontroller will act as the brain of the Automated Room.
The appropriate PIC Microcontroller selected is the PIC 16F877A microchip. This is
because it has the following properties:
35
4 I/O ports each with 8 inputs/outputs and 1 I/O port with 3 inputs/outputs
(Total: 35 ports available satisfying the requirements)
36
It regulates the voltage and current of the power supply, preventing damage to
the microcontroller which is very sensitive to high current surges.
The development board can be connected to a PC via the RS232 port for testing
or for programming purposes without the need for a microcontroller
programmer.
It saves energy.
Incandescent lamp
Fluorescent lamp
37
Characteristics
Incandescent
Fluorescent
lamp
lamp
Starting of lamp
++
Energy saving
--
++
Easily Dimmed
++
++
Available
in
low
voltage ratings
Cost
Results
From table 3.2, it can be deduced that fluorescent lamps have a better energy saving
system. However, as the fluorescent lamps are not readily available in low voltages
ratings, an incandescent lamp was selected in this project. The incandescent lamp
requires no extra equipment to be dimmed as dimming is simply achieved by varying
the applied voltage.
3.4.8 Motor
Following the detailed review on electrical motors in section 2.3.7, a bipolar stepper
motor was selected for this project. It will be used to transmit rotary motion to the blind
mechanism. The selected motor should be having the following characteristics:
The calculated maximum torque required being 0.824 Nm, a stepper motor
having a minimum torque of 0.9 Nm is required.
Low Cost
38
Current rating
2.8 A
Frame size
56.4 mm x 56.4 mm
Holding torque
1.01 Nm
Number of wires
0.83
Shaft diameter
6.35 mm
Shaft length
19 mm
Step angle
1.8
Voltage rating
2.3 V
It is Microcontroller based.
It can do full and half stepping modes 1/4, 1/8, 1/16,1/64 and 1/128 microstepping modes.
3.4.10 Blinds
Upon analysing the different types of window blinds that exist in section 2.3.8 in
chapter 2, the vertical type has been selected in this project as it offers numerous
advantages over the horizontal type. Some advantages are listed below:
41
This chapter deals with the mechanical structure of the Automated Room. A description
of the manufacture of the different parts which form part of the mechanical structure is
given in a step-by-step descriptive manner. Most of the work was done in the
Mechanical Workshop of the University of Mauritius.
Room Construction
Motor Coupler
Freewheel
Transmission Mechanism
42
After having made all the constituent parts according to their required dimensions, the
room is assembled as in Figure 4.1 by making use of nails and screws. Wooden sticks
are used to solidify every corner and to make the room stand firm.
43
44
45
A metal rod of diameter 16 mm as shown in figure 4.5 was used to manufacture the
coupler. The metal rod was machined on a lathe as shown in figure 4.6 to the required
diameter and cut for the required length. A hole was drilled corresponding to the motor
shaft diameter and shaft length, so that the latter fits in the coupler. Another hole was
drilled perpendicular to the axis of the circular rod so that a screw can be fitted to hold
the shaft tightly to the coupler. The other end was machined to about 8 mm diameter
and then was fitted into the freewheel. Two bolts were used to tighten the coupler into
the freewheel.
46
Cutting tool
Turning Chuck
Coupler
Figure 4.6: Turning Chuck
47
4.5 Freewheel
The freewheel was constructed with aluminium as this material is light, resistant to
tension, easily available and relatively cheap. The freewheel was designed as depicted
in Figure 4.8.
Number of teeth = 16
Distance between 2 teeth= 10 mm
External diameter = 50 mm
Internal diameter = 8 mm
Figure 4.8: Design of freewheel
48
4.7 Finishing
The automated room was built with plywood. Normally plywood is brown in color. For
aesthetic purposes, wallpapers were stuck on the outside surfaces of the. Wallpapers
also allow all markings and scratches made on the plywood during the mounting stage
to be covered.
4.8 Safety
Safety is the first and foremost aspect that was considered while working in the
workshop. There are many fundamental rules and regulations that must be followed to
avoid countless problems. The following safety measures were followed during the
implementation phase:
Lab coat was worn in order to avoid interference with working machines.
50
51
5.3 Interface between the outside Light Sensor and the Microcontroller
An LDR is used outside the room is used to monitor day and night. Figure 5.3 shows the
interface between the LDR and the PIC 16F877A.
52
Figure 5.4: Interface of the inside light sensor to a dimmer and a bulb
54
Figure 5.6: Circuit connecting the KT-5196 stepper motor driver to the microcontroller and the
motor.
55
5.8 Interface between the Microcontroller and the output devices Buzzer
and LED
In this part, one signal from the input sensor enables the microcontroller to actuate two
ports namely portC.0 and portC.1 respectively.
5.8.1 LED
Figure 5.8 shows the circuit connecting the microcontroller and an LED. PortC.0 from
Figure 5.8 is connected to a 1 K resistor which limits the current reaching the LED.
When portC.0 is activated high, the LED is switched on.
56
5.8.2 Buzzer
The circuit used to switch a buzzer is shown in Figure 5.9. The buzzer is connected to a
+ 5 V DC relay. The latter is connected across a +12 V DC supply. When portC.1 is
actuated, a current passes through the 1 K resistor thus energising the relay. As a
result, it sounds the 12 volt buzzer.
57
58
SOFTWARE DEVELOPMENT
In this chapter the program required to operate the microcontroller is developed. The
microcontroller receives signals from the various sensors connected to it. The program
allows the microcontroller to analyse these inputs and to make decisions accordingly so
as to actuate the appropriate output devices connected to it. The logical processes
involved in the programs are illustrated by means of flowcharts.
6.1 Microcontroller
The microcontroller PIC16F877 was programmed in Mikrobasic language using
Mikrobasic complier. The main function of the microcontroller, which is the brain of
the system, is to continuously read various parameters like temperature and intensity of
natural light from the surrounding sand then actuate the corresponding output device on
the basis of its program.
59
Start
Motion
Sensor
NO
Is PIR
sensor=1?
Yes
End
When the system is powered, the motion sensor, that is the PIR checks occupancy of the
room. If the microcontroller detects a high signal at its input port PortB.0, it indicates
that there is a presence in the room. The microcontroller will then output high signals at
PortC.0 and PortC.1 to flash an LED sound a buzzer respectively. Hence, the whole
system will begin to function. If the PIC16F877A does not read a value of 1 from its
input port, it is understood that there is no occupancy. Therefore, the program is looped
to start again until a value of 1 is detected.
Figure 6.2 shows a flowchart of the Temperature sensor.
60
Temperat
ure
sensor
Is it 30 C?
No
Yes
Turn Fan ON
End
From figure 6.2, when the system starts functioning, the temperature sensor will sense
and read the temperature in the room. This value will be fed to PortA.0 of the
microcontroller, which verifies whether it is above 30 C. If yes, the microcontroller
will send a high signal to PortC.6 to switch on a fan. The microcontroller then continues
to monitor the temperature value until it falls under 30 C when the output signal at
PortC.6 reverses to switch off the fan. The process then restarts.
Figure 6.3 shows a flowchart of the outside light sensor.
61
Outside
Light
sensor
NO
Yes
Is it day?
NO
Close Blinds
Yes
NO
Is limit
switch= 1?
Do not actuate
motor
Yes
Is Limit
switch=1?
Do not actuate
motor
Open Blinds
End
Assume that the outside light sensor is powered on as shown in Figure 6.3 during the
night. The microcontroller will read whether it is day or night at its PortB.1. If it is day,
a limit switch will sense the position of the blinds before actuating the motor. If the
limit is pressed, the motors will not be actuated. But, if it is not pressed the motor will
be powered on, thus, opening the blinds.
62
63
8.0 Conclusion
This chapter illustrates how the automated room is tested for its efficiency and
consistency. The chapter comprises of three major sections: Mechanical, Electrical and
Software testing. Each section gives an overview of how the respective design is tested.
It also includes all the problems encountered while implementing and the possible
techniques used to solve or minimize problem that may be encountered in the operation.
At the same time, modifications were carried out to meet the objectives that were put
forward at the start of the project.
7.1.2 Problems Encountered
The power transmission metal chain was not moving smoothly. Tendencies to slip off
the track were frequent.
The possible causes were:
The chain was not tight enough between the two extremes.
Solution used:
The metal chain was greased.
64
8.0 Conclusion
65
8.0 Conclusion
7.2.2 PIR Motion sensor circuit
After the mounting of the circuit as illustrated in section 5.2 of this report, the latter was
tested by supplying a voltage of + 5 V to the V+ pin of the sensor. The sensor gave the
following outputs as shown in table 7.1.
Supply voltage = +5 V
Output Voltage
During Occupancy
4.99 V
No Occupancy
000.2 mV
Figure 7.2 shows the output voltages when the sensor was tested for non-occupancy and
occupancy respectively. It can therefore be concluded that, the Passive Infrared motion
detector circuit was successfully implemented and the results obtained reflected the
objectives.
Non-Occupancy
Occupancy
66
8.0 Conclusion
multimeter. Then, when the LDR was covered, a voltage of + 296.9 mV was recorded.
Figure 7.3 shows the readings on the multimeter while the tests were performed.
Output voltage/ V
Maximum
0.42
1.61
Medium
2.05
3.42
Minimum
4.58
These values were input in a dimmer connected to a light bulb. Therefore, with
reference to these values input to the dimmer, the light bulb was dimmed. It was
therefore concluded that, the circuit worked correctly and met the objectives put
forward at the beginning of the project.
67
8.0 Conclusion
7.2.5 Implementation and Testing of the Stepper Motor Driver and Stepper
Motor Circuits
Once the stepper motor driver circuit has been implemented, it was tested by supplying
the appropriate voltage to the driver board and the motor. In addition, it was also tested
to verify if proper connections had been done as indicated in the datasheet. Figure 7.4
shows how the motor was connected to the driver board.
In freestanding mode, the motor was started to rotate and changed direction of rotation
whenever a voltage of + 5V was input in the DIR port. Thus, it can be established that
the stepper motor was well connected to the stepper driver board and it was operating in
proper circumstances. Lastly, it can be concluded that the connections were properly
done.
7.2.6 Problems Encountered
All the circuits implemented were working as expected when they were tested alone.
However, some difficulties were faced while connecting the wires. They were easily
broken when connecting to a PCB board. Moreover, while welding some were burnt.
The problems were solved before proceeding to the next step.
68
8.0 Conclusion
many corrections had to be made to the initial program, the PIC Simulator IDE result
was positive and the program was operating as expected.
Indeed, it can be concluded that the mechanical structure, circuitry and PIC program
were well-designed and implemented. All the aims set at the beginning of the project
were attained to a satisfactory level.
69
8.0 Conclusion
CONCLUSION
project
consisted
of
all
the
three
components
namely
mechanical,
electrical/electronic and software design required for a Mechatronics final year project.
The three parts were designed based on the knowledge and skills acquired during the
four years of the course. Finally, all the steps were followed and the three parts were
integrated together to implement the project.
8.0 Conclusion
The system can be implemented using a wireless network. In other words, in this
project all sensors are connected to the microcontroller with wires. The same
concept can be developed with a wireless system such that the sensors and
actuators will communicate with the microcontroller wirelessly.
The system used in this project is in automatic mode. Hence, if the occupant
decides to open the blinds at night or close the blinds during the day he/she will
not be able to do so. Therefore, the system can be made to shift from automatic
to manual mode.
The speed of the fan can be controlled according to the temperature recorded.
That is, below 20C the fan is made off, at 21C the latter is operated in low
mode, at 25C the fan is switched in medium mode and lastly at 30C the fan is
operated at its high speed mode.
71
REFERENCES
[1] Alsaggaf sons co ltd, Home Automation, http://www.alsaonline.com/english/,
Dec 03 2012 [Dec 03 2012].
[2] Wikipedia, The free encyclopedia, Home Automation,
http://en.wikipedia.org/wiki/Home_automation, Nov 09 2012 [Nov 09 2012].
[5] L.F. Cheung kai Suet, Sale of electricity by tariff, Digest of energy and water
statistics-2010, vol 13, p 54, table 4.7,
http://www.gov.mu/portal/goc/cso/report/natacc/energy10/energy.pdf.
[8] Mohamad Ridhwan bin mohamed rodzi, Home automation using x-10 technology,
bachelor degree electrical engineering, university Malaysia Pahang, Nov 2008.
[9] International Journal of Advanced computer science and applications, Vol.1, No.6,
Dec 2012.
[10] Charles k. Furr, What is a light sensor, http://www.wisegeek.com/what-is-alight-sensor.htm, 11 December 2012 [14 Jan 2013].
72
74
Appendices
APPENDIX A
Technical key features and specification of Velleman DC controlled Dimmer Kit
Velleman DC Controlled Dimmer Kit
Key features
The Velleman DC Controlled Dimmer Kit uses a low DC voltage (0 to 10V DC) to
adjust the light brightness of incandescent, fluorescent, or halogen light bulbs.
Use your computer to control your light dimmer application
Suitable for advanced users only
Light dimmer has simple brightness control by means of a DC circuit voltage
Light dimmer has optically isolated adjustment input
Pre-set adjustment for full brightness
Halogen lighting in combination with a conventional transformer
Soft start feature to ensure lamp longevity
Transformer protection in case of defective light sources
Light dimmer LED status indication
Dimensions 89(L) x 76(W) x 40(D)mm
Velleman K8064
75
Appendices
Technical specification
Light dimmer voltage
Adjustment current
Suppression
of
interference
Operating voltage
radio
and
0 to 12V DC max.
2.25mA at adjustment voltage of 12V
max.
TV EN55015
110 - 125V or 230 - 240V AC (50/60Hz)
76
Appendices
Specification of Buzzer
77
Appendices
Technical Data sheet of KT-5196 Bipolar Motor Driver
78
Appendices
79
Appendices
80
Appendices
81
Appendices
Technical Data sheet of LDR Norps 12
82
Appendices
83
Appendices
Bipolar Stepper Motor Data sheet
84
Appendices
85
Appendices
86
Appendices
87
Appendices
88
Appendices
Technical Datasheet for Thermistor 103
89
Appendices
90
Appendices
91
Appendices
92
Appendices
APPENDIX B
MikroBasic Programming Codes
Program Smart_House
Appendices
PortD.7=0
y=1
j=1
h=1
end sub
94
Appendices
PortD.7=0
end sub
main:
Intcon=0
ADCON1 =$80
95
Appendices
delay_ms(1000)
PortD.0=1
PortD.1=1
delay_ms(1000)
PORTD.0=0
PORTD.1=0
x=1
y=0
End if
If (PORTB.1=1) and (PORTB.0=1) and (y=0) ' signal from LDR day'
Then
Opening_of_blinds
End if
If (PORTB.2=1) and (PORTB.1=1) and (PORTB.0=0) and (j=1) 'signal limit switch and
PIR, No OCCUPANCY'
Then
Closing_of_Blinds
End if
temp_sensor=Adc_Read(0)
If (Temp_sensor>Temp) and (PORTB.0=1)
Then
PORTC.0=1
96
Appendices
else
PORTC.0=0
End if
goto main
end.
97
98