Sie sind auf Seite 1von 110

UNIVERSITY OF MAURITIUS

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

Project Supervisor: Mr. V.OREE


Date submitted: 04/04/2013

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.

I would also like to thank Mr Goinsamy Murday of services section, Mr N. Sujeebun of


the Microprocessor lab, Mr Rioux of the Robotics lab, Mr Bhanji, Mr M. Ramsorrun
and Mr K. Seetohul of the Mechanics workshop for their valuable advice, tremendous
help and assistance.

I wish to express my gratitude towards my family for their encouragements, confidence


and supports in many ways. Last but not least, I am grateful to my friends Kow,
Aneesh, Jaydesh, Nox, Poynen, Ashveer, Moushin, Trou and many other friends for
their help.

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.

The mechanical, electrical/electronic and software parts were tested individually


followed by the assimilation and testing of the entire system. The system is operational
according to the objectives put forward at the beginning of the project.
.

iv

LIST OF SYMBOLS AND ABBREVIATIONS

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

Introduction to Home automation.................................................................... 1

1.1.1

1.2

Overview of problem ...................................................................................... 2

1.3

Project Justification......................................................................................... 3

1.4

Aims and Objectives ....................................................................................... 4

1.5

Methodology .................................................................................................. 4

1.6

Outline of project ............................................................................................ 5

LITERATURE REVIEW ...................................................................................... 7


2.1

System Description ......................................................................................... 7

2.2

Overview of existing systems.......................................................................... 7

2.2.1

Home Automation using X-10 Technology .............................................. 7

2.2.2

Microcontroller Based Home automation system with security ................ 8

2.3

Importance of Home Automation ............................................................. 2

Components Description ................................................................................. 9

2.3.1

Light sensors ........................................................................................... 9

2.3.2

Motion Detectors ................................................................................... 12

2.3.3

Temperature Sensors.............................................................................. 15

2.3.4

Smoke Sensors ...................................................................................... 18

2.3.5

Controllers ............................................................................................. 19

2.3.6

Lamps .................................................................................................... 22

2.3.7

Motor .................................................................................................... 24

2.3.8

The Blind Mechanism ............................................................................ 25

METHODOLOGY AND DESIGN ..................................................................... 27


3.1

Overview of the methodology and design ..................................................... 28

3.2

Material Selection ......................................................................................... 32


ii

3.3

Calculation of the maximum torque required for the blind to start rotating .... 33

3.4

Selection of components ............................................................................... 34

3.4.1

Light Sensor .......................................................................................... 34

3.4.2

Motion Sensor ....................................................................................... 34

3.4.3

Temperature Sensor ............................................................................... 34

3.4.4

Smoke sensor ......................................................................................... 35

3.4.5

Controller .............................................................................................. 35

3.4.6

OLIMEX Board ..................................................................................... 36

3.4.7

Illuminating device ................................................................................ 37

3.4.8

Motor .................................................................................................... 38

3.4.9

Motor Driver ......................................................................................... 39

3.4.10 Blinds .................................................................................................... 40


4

IMPLEMENTATION OF THE MECHANICAL STRUCTURE ......................... 42


4.1

Mechanical Part ............................................................................................ 42

4.2

Room Construction ....................................................................................... 42

4.3

Blind cloth hanger and blind cloth................................................................. 43

4.3.1

Blind cloth hanger ................................................................................. 44

4.3.2

Blind Cloth ............................................................................................ 44

4.4

Motor Coupler .............................................................................................. 45

4.5

Freewheel ..................................................................................................... 48

4.6

Transmission Mechanism.............................................................................. 49

4.7

Finishing ....................................................................................................... 50

4.8

Safety ........................................................................................................... 50

ELECTRICAL AND ELECTRONIC CIRCUITRY ............................................ 51


5.1

Input/output pins of Microcontroller 16F877 (Figure 5.1). ............................ 51

5.2

Interface of the Motion sensor and the Microcontroller ................................. 51

5.3

Interface between the outside Light Sensor and the Microcontroller .............. 52
iii

5.4

Circuit of the inside Light Sensor .................................................................. 53

5.5

Temperature sensor connected to the Microcontroller ................................... 53

5.6

Circuit connecting the Microcontroller and the Motors ................................. 54

5.7

Circuit linking the PIC 16F877 and a Fan ..................................................... 55

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

Limit Switch ................................................................................................. 58

SOFTWARE DEVELOPMENT ......................................................................... 59


6.1

Microcontroller ............................................................................................. 59

6.2

Software development .................................................................................. 59

TESTING AND RESULTS................................................................................. 64


7.1

Mechanical Testing ....................................................................................... 64

7.1.1

Testing and Observation ........................................................................ 64

7.1.2

Problems Encountered ........................................................................... 64

7.2

Electrical/ Electronic Testing ........................................................................ 65

7.2.1

Implementation and Testing of the Temperature Sensor circuit .............. 65

7.2.2

PIR Motion sensor circuit ...................................................................... 66

7.2.3

Outside LDR Light Sensor Testing ........................................................ 66

7.2.4

Implementation and testing of the Inside LDR Light Sensor .................. 67

7.2.5

Implementation and Testing of the Stepper Motor Driver and Stepper

Motor Circuits ..................................................................................................... 68


7.2.6
7.3

Problems Encountered ........................................................................... 68

Software Testing ........................................................................................... 68

7.3.1

Testing of the whole system with PIC 16F877A Microcontroller ........... 69

7.3.2

Problems Encountered ........................................................................... 69

CONCLUSION ................................................................................................... 70
iv

8.1

Difficulties and limitations ............................................................................ 70

8.2

Future works ................................................................................................. 70

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

Figure 2.1: Photocell ..................................................................................................... 9


Figure 2.2: Light dependent resistor ............................................................................ 10
Figure 2.3: Charged Coupled device ........................................................................... 10
Figure 2.4: Photovoltaic cells ...................................................................................... 11
Figure 2.5: Photo Diode .............................................................................................. 11
Figure 2.6: Proximity Light Sensor ............................................................................. 12
Figure 2.7: Active Infrared Motion Detector ............................................................... 13
Figure 2.8: Dual PIR Coverage Area ........................................................................... 13
Figure 2.9: PIR Sensor ................................................................................................ 14
Figure 2.10: CW wave emission picture ...................................................................... 14
Figure 2.11: Ultrasonic Motion Detector ..................................................................... 15
Figure 2.12: Siemens Sematic S7-400 PLC ................................................................. 20
Figure 2.13: PIC 16F877A Microcontroller ................................................................. 21

Figure 3.1: Different sides and openings of prototype ................................................. 28


Figure 3.2: Exploded view of the prototype ................................................................. 29
Figure 3.3: Blind ......................................................................................................... 30
Figure 3.4: Block diagram of power transmission........................................................ 31
vi

Figure 3.5: Block diagram of light illumination ........................................................... 34


Figure 3.6: Temperature sensor (Thermistor 103) ........................................................ 35
Figure 3.7: Pins description of PIC 16F877A microchip [31] ...................................... 36
Figure 3.8: Development board (OLIMEX) ................................................................ 37
Figure 3.9: Hybrid bipolar stepper motor .................................................................... 39
Figure 3.10: Ocean controls KT-5196 Stepper Motor Driver ....................................... 40
Figure 3.11: Block diagram of cooling system ............................................................ 41
Figure 3.12: 12 volts dc brushless fan ......................................................................... 41

Figure 4.1: Final Design of the room with dimensions ................................................ 43


Figure 4.2: T-shape metal............................................................................................ 44
Figure 4.3: Blind Cloth ............................................................................................... 45
Figure 4.4: Motor and freewheel connected by a coupler ............................................. 46
Figure 4.5: Metal Rod ................................................................................................. 47
Figure 4.6: Turning Chuck .......................................................................................... 47
Figure 4.7: Coupling device with screws ..................................................................... 47
Figure 4.8: Design of freewheel .................................................................................. 48
Figure 4.9: Drilling and cutting of the aluminium sheet ............................................... 49
Figure 4.10: Final Product of freewheel ...................................................................... 49
Figure 4.11: Metal chain connected to freewheel ......................................................... 50

Figure 5.1: Microcontroller 16F877 pins ..................................................................... 51


Figure 5.2: Wiring of PIR sensor to microcontroller .................................................... 52
Figure 5.3: Relevant circuit of LDR sensor connected to microcontroller .................... 52
Figure 5.4: Interface of the inside light sensor to a dimmer and a bulb ........................ 53
Figure 5.5: Thermistor 103 sensor circuit .................................................................... 54
Figure 5.6: Circuit connecting the KT-5196 stepper motor driver to the microcontroller
and the motor. ............................................................................................................. 55
Figure 5.7: Interface of microcontroller to a +12 Vdc fan ............................................ 56
Figure 5.8: Circuit linking the microcontroller and the LED ........................................ 57
Figure 5.9: Interface between the microcontroller and a buzzer ................................... 57
Figure 5.10: Micro-switch ........................................................................................... 58

Figure 6.1: Main flowchart of the system .................................................................... 60


vii

Figure 6.2: Flowchart of Temperature sensor in the system ......................................... 61


Figure 6.3: Flowchart of outside light sensor in the system.......................................... 62

Figure 7.1: Multimeter reading for temperature sensor ................................................ 65


Figure 7.2: Output voltages of PIR sensor ................................................................... 66
Figure 7.3: Voltage output from the Outside LDR ....................................................... 67
Figure 7.4: Stepper Motor connected to Driver Board ................................................. 68
Figure 7.5: The complete circuit.................................................................................. 69

viii

1.0 Introduction

INTRODUCTION

1.1 Introduction to Home automation


It sounds futuristic but today the technological worlds main focus is to automate every
possible thing to take advantage in providing ease in life. Home Automation, also
known as domotics is one among the different types of automations. Home automation
refers to the use of computer and information technology to control home appliances
and features (such as blinds, lighting, ventilation and many others). Systems can range
from simple remote control of lighting through to complex computer or microcontroller
based networks with varying degrees of intelligence and automation. Through the
integration of information technologies with the home environment, systems and
appliances are able to communicate in an integrated manner which results in
convenience, energy efficiency, and safety benefits.

Figure 1.1: A complete Home Automation system [1]

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

Importance of Home Automation

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.2 Overview of problem


In Mauritius, implementation of Room Automation systems in existing residential
buildings today require a drastic and expensive change since the room design and
planning of appliances are not conducive to automation. This implies that it is often not
2

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

Table 1.1: Energy consumption for major consumers [6]

Category

Number of

Average

Energy

Annual

consumers in

annual

consumption

energy

the year 2000

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

Home automation technology is growing drastically and its demand is increasing in a


wide range of sectors. There are many factors that are responsible for home
automation's growing importance. Some important benefits are:

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.

Ease of use and comfort:

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.

Improves the security features:

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:

By controlling temperature and lighting based on the programmed schedules,


automation systems can reduce the energy bills significantly. Now, you can move to
distant places without any worries regarding your energy bills by making use of
automation systems [7].

1.4 Aims and Objectives


To design a reliable home automated system that controls various parameters in
a room. To improve the room security system. To enhance human comfort. To
improve energy efficiency of the room. To minimize expenses in terms of
energy consumption.

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.

Figure 1.2: General block diagram of the whole system

1.6

Outline of project

In chapter 2, a comprehensive review of the literature on existing home automation


projects together with a review of the major components used in the
implementation of the project.

1.0 Introduction
Chapter 3 provides an overview on how each component is used and their
importance.

The selection of the components is done according to the

requirements provided in chapter 2. The specifications of the selected components


are also given.

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.

2.0 Literature Review

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

The actuators in the system are controlled by means of a microcontroller responds


which responds to their respective sensors.
For example: Light sensors monitor the illumination of the room by using a
combination of artificial and natural lights and actuating a blind mechanism
respectively. Moreover, a motion sensor activates and deactivates the whole system, a
temperature sensor actuates a fan and a smoke sensor is used for security purposes. A
motor is used to drive the blind mechanism.

2.2 Overview of existing systems


2.2.1 Home Automation using X-10 Technology
X-10 technology is one of the easiest and most popular ways to automate a home
without re-wiring the house. It is about power line communication using X-10
technology to control any electrical home appliance. X-10 works across home power
lines and is used at a low-bandwidth. It is sorted as a broadcast network. Software
Virtual Basic 6 is used to program the algorithm. Users are able to select which device
they want to control. A microcontroller is used as controller to receive and transmit data
and signals. The project was designed with two sets of the power line communication,
that is, one will operate as a receiver and the other as a transmitter [8].
The disadvantages of the system are:
1) They work with higher voltages like 220 240 volts.

2.0 Literature Review


2) There is often overlapping of frequencies.
3) Knowledge of visual basic 6 is recommended.

2.2.2 Microcontroller Based Home automation system with security


The following features are present in this project:
1) Password based locking system
This system ensures a safe locking system. This lock can be opened and closed with the
help of a password. The door will only open or close if the password is correct, else, it
will remain in its previous state.
2) Counter dependent automatic switching system of room
After unlocking the door, when a person enters the room, a counter is incremented.
During the day, the light will normally remain off but the illumination level is below a
threshold, then lights will automatically switch on. When the person leaves the room,
the counter is decremented until it becomes zero, meaning that the room is vacant,
resulting in the switching system being automatically switched off.
3) Temperature controlled cooling system
Once a person is in the room, the system automatically starts functioning. For example:
If temperature is high, then a fan will switch on by itself.
4) Light sensing system
Light saving system is used in two places: internal and external use. If a person is not at
home or sitting inside the room and it is night, then the lights will automatically switch
on. Moreover, when it is day, the lights will switch off.
5) Fire and smoke sensor
This sensor detects any fire or smoke and accordingly sets an alarm or an indication.

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.

Four power supply units were used.

2.0 Literature Review

2.3 Components Description


A key feature in the implementation of this project is the use of various sensors to
monitor desired conditions in the room. In this section, the existing types of sensors for
monitoring each condition are reviewed and their advantages and disadvantages are
highlighted.
2.3.1 Light sensors
A Light sensor helps in everyday life by detecting and reacting to different levels of
light. A light sensor is a device used to detect the presence of light. There are many
different types of light sensors that can be used in this project, each of which works in a
slightly different way.

2.3.1.1 Photocell or Photo resistor


These are small sensors which change their resistance when light shines over them.
They are used in many consumer products to determine the intensity of light. They are
inexpensive, low-power, easy to use and do not wear out easily. They are made of
calcium-sulphide. Figure 2.1 shows a diagram of a photocell [10] [11].

Figure 2.1: Photocell

Example of a photocell: Light Dependent Resistor (LDR)

2.0 Literature Review


These are inexpensive sensors and are commonly used for gauging and responding to
light intensity. LDR sensors work as automatic switches for different devices. They
form a group known as photo resistors because their resistance increases as light
intensity increases. They are commonly used for the outdoor purposes like streetlamps.
As light intensity increases, resistance increases and turns the light off and vice versa
[11]. Figure 2.2 shows a diagram of an LDR.

Figure 2.2: Light dependent resistor

2.3.1.2 Charged Coupled Device (CCD)


A CCD is an optical sensor used to detect the intensity on the reflected light. These
devices are capable of converting the light into electrical energy with corresponding
intensity. Higher intensity of the light generates higher voltage electric impulse. For
colour scanning, the CCDs are coated with one of the colours Red, Green, and Blue to
register the colour under each filter. A diagram of the CCD is shown in figure 2.3 [12].

Figure 2.3: Charged Coupled device

10

2.0 Literature Review


2.3.1.3 Photovoltaic
Photovoltaic sensors are also known as solar cells. The light sensors respond to light
levels by generating current or voltage and storing it in silicon cells for use as
emergency or alternative energy. In low light situations, photovoltaic sensors do not
generate current. Photovoltaic cells are small and generate low power, but they
commonly come in panels for large amount of current [11]. A diagram of photovoltaic
cells is shown in figure 2.4.

Figure 2.4: Photovoltaic cells

2.3.1.4 Photo Diode


Photo diodes are used in digital technology like cameras, video recorders and remote
controls to detect light levels ranging from infrared to visible spectrum. They respond to
levels of infrared and act as switches. Remote controls for example, transmit different
light levels to the light sensors in your television to perform a task. Photo diodes
respond instantly to slight changes in light and generate a relatively small amount of
current [11]. Figure 2.5 shows a diagram of the sensor.

Figure 2.5: Photo Diode

11

2.0 Literature Review


2.3.1.5 Proximity light sensor
These sensors respond to changes in infrared light to detect motion or proximity to
another object. Proximity sensors help robotic machines navigate obstacles and avoid
bumping into objects. They are also used for devices in vehicles that sound an alarm
when the vehicles are close to bumping into an object. Proximity light sensors are
common in outdoor lights to detect motion for security purposes. Figure 2.6 shows a
diagram of the sensor [11].

Figure 2.6: Proximity Light Sensor

2.3.2 Motion Detectors


A motion detector is a device that detects objects that are moving, for example, people.
A motion detector is often integrated as a component of a system that automatically
performs a task or alerts a user of motion in an area. Motion detectors form a vital
component of security, automated lighting, home control, energy efficiency, and other
useful systems [13].
Todays motion detecting technology uses various combinations of research motion
detecting methods. Five of the most common types of motion detectors which can be
used in this automated room are described in what follows:
2.3.2.1 Active Infrared Motion Detector (IR)
It uses an IR sensor, as well as a source of radiation. The sensor is able to detect
interruptions in the radiation it receives from the radiation source. It means that the
motion sensor is able to detect the signal of the heat energy emitted by an intruder as
there will be a difference of heat energy between the intruder and the constant infrared
scanning activity of the detector, as long as the intruder is in the detection range [14].
The figure 2.7 shows a diagram of the sensor.
12

2.0 Literature Review

Figure 2.7: Active Infrared Motion Detector

2.3.2.2 Passive Infrared Motion Detector (PIR)


PIR motion detectors are the most popular type of motion detecting device. They are the
most inexpensive in their category. A PIR sensor is able to use an optical collection
system in combination with many other different sensing elements. This allows the
sensor to detect any changes that occur in ambient infrared radiation [14]. The figures
2.8 and 2.9 show an illustration of the Dual PIR sensor coverage area and a diagram of a
simple PIR sensor.

Figure 2.8: Dual PIR Coverage Area

13

2.0 Literature Review

Figure 2.9: PIR Sensor

2.3.2.3 Continuous Wave Radar Detector (CW)


CW are sometimes referred as Microwave motion detectors, as they use microwave
signals to emit frequencies to bounce off of the surrounding area. The sensor is able to
detect when there are subtle changes in these frequencies; hence a disruption will be
announced. When an intruder passes the field of a CW motion sensor, he disrupts the
frequency. CW motion detector is more expensive than PIR as they are highly sensitive
and very reliable over long distances than other sensors [14]. Figure 2.10 shows how a
continuous wave radar motion detector emits its waves.

Figure 2.10: CW wave emission picture

14

2.0 Literature Review


2.3.2.4 Ultrasonic Motion Detector
An ultrasonic motion detector is able to use sound energy in order to detect motion in a
specific region. The ultrasonic sound energy is emitted in waves, which are originally
from quartz-crystal transducers. When the sensor detects movement, the sound waves
are disrupted, which triggers the sensor. Ultrasonic motion detectors are used in
automatic doors because they are reliable and easy to install but the main limitation are
that they can be blocked by any material and can be easily disrupted [14]. Figure 2.11
shows a model of the ultrasonic motion detector.

Figure 2.11: Ultrasonic Motion Detector

2.3.2.5 Vibration Motion Detector


Most vibration motion sensors use the piezoelectric effect (the ability of some materials
to generate an electric field) in order to detect motion. Vibration sensors most
commonly use a lever that activates a switch when it detects vibration [15].
2.3.3 Temperature Sensors
Temperature sensors use various technologies but have one thing in common. They all
measure temperature by sensing some change in a physical characteristic due to a
change in temperature [16].
Two ways of sensing temperature are detailed in this section.
1) Contacting method
Contact sensing brings the sensor in physical contact with a substance or object. It can
be used with solids, liquids and gases. Some examples of contact sensing devices are:
Bulb Thermometer, Bi-Metal sensors, Thermocouple, Resistance wire RTD (resistance
temperature detector), Thermistor.
15

2.0 Literature Review

Advantages of contact temperature sensors are:

They are relatively rugged.

They are economical.

They can be used in a wide application range.

They are relatively accurate.

They are simple to apply.

Disadvantages of contact temperature sensors are:

They require physical contact and may damage or contaminate.

They can cause wear on rotary components (slip rings).

Slow to respond relative to non-contact sensing.

Act as a heat sink and alters readings on small objects.

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:

They are relatively rugged.

Remote mounting away from heat source

Ideal for measuring objects in motion.

They do not interfere with process.

They are faster to response (milliseconds compared to seconds for contact


sensing).

They can sense temperature of irregular shaped objects.

They will not deface and infect.

They will not act as a heat sink.

16

2.0 Literature Review


Disadvantages of non-contact temperature sensors are:

They will not measure gas temperatures.

Emissivity variations

Field-of-view (spot size) restrictions

Ambient temperature restrictions

The indicated temperature is affected by environmental conditions (dust, smoke,


etc [17].)

Table 2.1: Various types of sensors [18]

Types of

Description

Diagram

sensor
Platinum

Electric resistance value of a

RTD

platinum

wire

or

pattern

is

changed by a temperature change.


This

method

features

high

accuracy. This is used for precise


temperature control.
Thermocoupl

This is widely used for industrial

temperature control especially for


high temperature.

Bi-Metal

When two different metals are

Thermometer

attached and heated, they warp


because of the different thermal
expansion coefficients.

Glass

Applying thermal expansion of

Thermometer

mercury or alcohol.

(mercury,
alcohol)

17

2.0 Literature Review


Thermistor

This is a kind of RTD. As


temperature

goes

up,

the

resistance value of an element


decreases. (-50 to 350) It is
mainly

applied

Electronics,

cars,

for

Home

and

OA

machines. It is cheap but not as


accurate as platinum RTD.
Infrared

Measuring

infrared

radiations

Thermometer

emanating from substances and


convert them into temperature.
They

are

non-contact-type

thermometer.

2.3.4 Smoke Sensors


A smoke detector is a device that detects smoke, typically as an indicator of fire.
Commercial, industrial and mass residential devices issue a signal to a fire alarm
system, while household detectors, known as smoke alarms, generally issue a local
audible alarm from the detector itself [19].
There are two main types of smoke detectors that can be used in this project, namely
ionization detectors and photoelectric detectors.
2.3.4.1 Ionization Detectors
Ionization detectors have an ionization chamber and a source of ionizing radiation. The
chamber consists of two plates which are separated from each other. The source is alpha
particle. When a battery applies voltage to the plates, one becomes positively charged
and the other one negatively charged. The alpha particles knock electrons from air
atoms causing the positively charged oxygen and nitrogen atoms to migrate towards the
18

2.0 Literature Review


negatively charged plate and the electrons to the positively charged plate causing a
small current to flow. When smoke enters the ionization chamber it neutralizes the ions
and prevent them from reaching the plate. The drop in current between the plates
activates the alarm.
Advantages of Ionization detectors:

They are cheaper.

They respond more quickly to flaming flames.

They are sensitive.

2.3.4.2 Photoelectric Detectors


Photoelectric devices exist in three types:
1) In the first type, smoke can block a light beam, hence reducing the amount of
light reaching the photocell, therefore activating the alarm.
2) In another type, light is scattered by smoke particles onto a photocell, hence
activating the alarm.
3) The final type has a T-shaped chamber with a light emitting diode that projects a
beam of light across the horizontal bar of the T. A photocell found at the bottom
of the T generates a current when there is the presence of light. When there is
smoke, the light beam does not strike the photocell. When smoke particles are
present, the light is scattered and strikes the photocell. When sufficient light
beam hits the photocell, a current flows thus activating an alarm.
Advantages of Photoelectric detectors:

They respond more quickly to smouldering fires.

They are more expensive than ionization detectors but are easier to use.

Backup batteries may be used [20].

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

2.0 Literature Review

2.3.5.1 Programmable Logic Controllers (PLC)


A programmable Logic Controller is also known as programmable controller. It is a
digital computer used for automation of electromechanical processes.
For example: In Industries, the control of machines.
PLCs are mostly used to operate huge machines. The PLC is designed in such a way
that it possesses several inputs and outputs arrangements, high temperature ranges, and
immunity to electrical noise and is resistant to vibration and impact. Figure 2.12 shows
a diagram of a Siemens sematic S7-400 PLC [21].

Figure 2.12: Siemens Sematic S7-400 PLC

Advantages of PLC:

It is flexible.

It is safe to deal with.

It has several contacts.

It can be observed virtually.

The programming is easy.

It is adaptive to changes in production.

Fast operating times.

Disadvantages of PLC:

Before working with the new technology, training is required.


20

2.0 Literature Review

Applications that perform only one job, is not efficient in the use of PLC.

It requires large space.

It requires extra security equipment.

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.

Some of the PIC Microcontrollers are listed below.


1) PIC 14 pin- 16F688
2) PIC 18 pin-16F628A
3) PIC 28 pin-16F876A
4) PIC 40 pin-16F877A (Figure 2.13)

Figure 2.13: PIC 16F877A Microcontroller

21

2.0 Literature Review

Advantages of PIC Microcontroller:

Flexible hardware design.

A larger choice is available.

It is suitable for small embedded applications.

Disadvantages of PIC Microcontroller:

Hardware design skills are needed.

Programming skill is needed.

It has limited memory [24].

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.

It starts instantly when switched on.

It is small in sizes and can be placed in a variety of fixtures.

It contains no dangerous chemicals and hence can be disposed easily.

Output is unaffected by high and low ambient temperatures.

2.3.6.2 Fluorescent Lamps


The most common application of this technology is in tubular fluorescent lamps.
Fluorescent lamps contain a mercury vapour and a phosphor coating inside the tube.
When switched on, an electric discharge goes though the mercury vapour and causes the
22

2.0 Literature Review


mercury atoms to gain energy. When the atom loses the energy, it emits ultraviolet
radiation. Hence, the ultraviolet radiation hits the phosphor coating on the tube finally
emitting visible light. Fluorescent lamps are divided into two main branches: the
fluorescent tubes and the compact fluorescent lamps.
2.3.6.3 High-Intensity Discharge (HID) lamps

HID lamps exist in three types of lamps:


1) Mercury vapour (MV)
2) Metal Halide (MH)
3) High pressure sodium (HRS)
High-Intensity Discharge lamps can be used at a very high pressure and temperature.
They are best suited for places like streets, highways, stadium and parking lots.
Advantages of High-Intensity Discharge lamps:

It has a maximum light output over a wide range of temperature variations.

It has a good efficiency.

It has a long lifetime.

2.3.6.4 Low pressure sodium lamps (LPS)


A low pressure sodium lamp operates at a lower pressure than HID lamps. It gives an
orange colour of light (used in street lights). They have efficiency up to 190 lumen per
watt. The monochromatic light emitted does not render easy colour identification
possible.
2.3.6.5 Light Emitting Diodes (LED)
Light emitting diodes are semiconductor devices. They produce light when current
passes through them. They are a new technology for the future. They are used in traffic
lights, flash lights and others.
They have multiple advantages:

They have a long lifetime.

They do not contain toxic mercury.

Disadvantages of LEDs:

Unit cost is quite expensive [25].


23

2.0 Literature Review


2.3.7 Motor
An electric motor is a device which converts electrical energy into mechanical energy.
In this project, a motor is used to drive the blind mechanism. There are different types
of motors with multiple features and specifications to satisfy the user requirements.
Table 2.2 shows the different types of motors that could be used in this project.

Table 2.2: Types of Electric Motors

Electric Motors
DC Motors

AC Motors

Other Motors

Shunt Motor

Induction Motors

Stepper Motor

Separately Excited Motor

Synchronous Motor

Brushless DC Motor

Series Motor

Reluctance Motor

Permanent Magnet DC (PMDC)

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:

They are inexpensive.

They are available in a wide range of speed and torque.

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

2.0 Literature Review


2.3.7.2 AC Motors
An AC Motor works on alternating current electricity. That is, it would not run on direct
current electricity as DC motors. Ac electric motors are divided into single phase and
three phase motors. Single phase AC electrical supply is what is typically supplied in
homes and three phases is only available in industries. AC Motors consist of induction
and synchronous motor.
2.3.7.3 Other Motors
Other motors consist of stepper motors, brushless DC motors, hysteresis motor,
reluctance motor and universal motor. The most commonly used motor in this part is the
stepper motor. It is a special type of synchronous motor. A stepper motor uses a special
type of construction that allows a computerized control system to step the rotation of
the motor.
Advantages of Stepper Motor:

Rotation angle of motor is directly proportional to input pulse.

Precise positioning and good repeatability of movement.

Excellent response for starting, stopping and reversing.

A wide range of rotational speeds can be achieved as the speed is proportional to


the frequency of the input pulses.

Disadvantage of stepper Motor:

Resonance effect which occurs at lower speeds and the decreasing torque with
increasing speed [26] [27] [28].

2.3.8 The Blind Mechanism


Basically, there are different types of mechanisms that are available to regulate the
amount of natural light that is allowed to enter the room through windows. One such
mechanism involves the use of blinds. Blinds provide window covering solution which
most of the time is found on the room side of the window. They make it possible to
block light coming from outside, while at the same time hiding the inside of the room
from exterior viewing. However, there exist two types of blinds, namely vertical and
horizontal blinds. Both vertical and horizontal blinds have their advantages.

25

2.0 Literature Review


2.3.8.1 Vertical Blinds
Vertical blinds are window covering material which is hanging vertically from a head
rail. They can be made from different types of materials such as wood, Vinyl (Polyvinyl
chloride), aluminium or fabric.

Advantages of Vertical Blind:

It is durable.

It is easy to clean.

It insulates and darkens rooms.

Some are fire resistant.

Do not get dusty easily as dust falls between them.

It can be easily replaced.

It can be opened and closed easily.

Disadvantages of Vertical Blind:

It is sometimes noisy when operating.

It offers less privacy due to cracks availability.

2.3.8.2 Horizontal Blinds


Horizontal blinds are a type of window treatment that is placed horizontally by a
vertical support of two rails.
Advantages of Horizontal Blind:

It is quieter than vertical blinds on operating.

It offers higher privacy as there are no cracks between the blind.

It manages temperature control by reducing amount of sun rays.

It acts as insulator.

Disadvantages of Horizontal Blinds:

It is not easy to clean.

It gets dusty easily.

A rack cannot be easily changed or replaced [29] [30].

26

3.0 Methodology and Design

METHODOLOGY AND DESIGN

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

The electronics structure consists of the following components:

Sensors
1) Motion Detector
2) Light Sensor
3) Temperature Sensor
4) Smoke Detector

PIC Microcontroller

OLIMEX board

Stepper Motor driver

27

3.0 Methodology and Design

3.1 Overview of the methodology and design


In this section, the use and importance of the major components as well as the building
of the room are described.
The prototype mechanical part is made up in 2 main steps:

Building of the wooden room

A wooden structure is used to implement the room in the microcontroller-based


room automation system. Sheets of plywood are used to build the base, the
walls, the door and the roof of the room.
A large sheet of plywood (5 mm thick) is cut according to the required
dimensions for the walls, roof and the base. The dimensions of the windows are
made large enough so that they are able to accommodate the blind mechanism
and they allow sufficient natural light to enter the room. Thus, energy is saved
on the artificial light.
Figure 3.1 shows the different sides and openings of the room.

Figure 3.1: Different sides and openings of prototype

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

3.0 Methodology and Design


make the walls stand firm, wooden sticks are nailed to every right-angled corner. An
exploded view of the room is given in the figure 3.2.

Figure 3.2: Exploded view of the prototype

Design and mounting of the Blind Mechanism

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

3.0 Methodology and Design


Two 110 mm and 80 mm iron rods are used to make a T-shape iron for the blind cloth to
hang on. Depending to the length of the window, the appropriate number of T-shapes
iron required to cover the window completely is calculated. Figure 3.3 shows a picture
of the blind.

Figure 3.3: Blind

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

3.0 Methodology and Design


Figure 3.4 shows a block diagram of the power transmission system.

Figure 3.4: Block diagram of power transmission

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

3.0 Methodology and Design

3.2 Material Selection


The selection of materials plays a vital role in the design process. The characteristics of
the material that were considered for the construction of the Automated Room are listed
below:
1) Availability
2) The cost of material (Locally).
3) Malleability How much easy is it to work with and machine the material.
4) Weight (light)
5) Tensile Strength The maximum amount of force that the material can
withstand before cracking.
6) Durability Resistant to corrosion and pollution.
Some materials corresponding to the above mentioned requirements are listed below:

Plywood

Iron Sheet

Aluminium

The selection is done by using Pughs method as represented in Table 3.1.


Table 3.1: Selection of materials for construction of the room

Materials

Plywood

Iron

Aluminium

Sheet
Availability

++

Cost

++

--

Malleability

Weight

++

++

Tensile Strength

++

Durability

++

Results

32

3.0 Methodology and Design

Key:
++ : Appropriate

- : Bad

+ : More or less good

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

3.0 Methodology and Design

3.4 Selection of components


3.4.1 Light Sensor
Upon analysing at the characteristics of various types of light sensors described in
section 2.3.1, the Light Dependent Resistor (LDR) has been selected. It offers an
accurate response to varying light intensity. Its characteristic is that as light intensity
increases its resistance decreases and vice versa. Moreover, they are easily available in
the local market and are inexpensive. Figure 3.5 shows a block diagram of the lighting
system used in this project.

Figure 3.5: Block diagram of light illumination

3.4.2 Motion Sensor


After looking at the characteristics of the different types of motion detectors in section
2.3.2, the Passive Infrared Motion Detector (PIR) has been chosen as it has the ability to
detect any changes that occur in ambient infrared radiation. In addition, it is an indoor
device and is among the least expensive in its category.
3.4.3 Temperature Sensor
A temperature sensor is required to monitor a constant temperature inside the room and
should have the following characteristics:

It can be used in a wide application range.

It must be sensitive.

It must be relatively accurate in readings.

It must be simple to apply.

34

3.0 Methodology and Design

By considering these characteristics, a contacting temperature sensor has been


favoured. More precisely, a Resistance Temperature Detector, Thermistor 103
Temperature Sensor (Figure 3.6) has been selected to be used as it is cheap and
is mainly used for home appliances.

Figure 3.6: Temperature sensor (Thermistor 103)

3.4.4 Smoke sensor

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:

Reprogrammable chip with FLASH program memory of 14 KB.

35

3.0 Methodology and Design

368 bytes RAM.

256 bytes EEPROM Data Memory.

8 ADC channels of 10 bits.

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)

USART serial communication module for testing.


Figure 3.7 shows the different pins of the PIC 16F877A microchip.

Figure 3.7: Pins description of PIC 16F877A microchip [31]

3.4.6 OLIMEX Board


The PIC Microcontroller will be used with an OLIMEX board as shown in figure 3.8,
because it is user-friendly and provides the following advantages [32]:

It contains on-board circuit elements such as an oscillator, capacitors and a reset


pin circuitry that are necessary for the microcontroller to operate.

36

3.0 Methodology and Design

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.

Figure 3.8: Development board (OLIMEX)

3.4.7 Illuminating device


The selection of an illuminating device plays a fundamental part in this project. The
characteristics of the material to be used are listed below:

It should be instantaneous when switched on.

Low cost of the device.

It should be dimmed easily.

It saves energy.

It should be available in low voltage ratings.


Based on the devices discussed in section 2.3.6, two devices that correspond to
all the requirements are the:

Incandescent lamp

Fluorescent lamp
37

3.0 Methodology and Design


The selection is done by using Pughs method as illustrated in table 3.2.
Table 3.2: Selection of lamp

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.

A step angle of 1.8

Good step accuracy

Low Cost

Small size and weight

38

3.0 Methodology and Design

Rotation in both clockwise and anticlockwise direction


It was difficult to find a stepper motor with working torque of 0.824 Nm on the
market. Therefore, a hybrid 57 mm stepper motor (Figure 3.9) with higher
torque was selected. The specifications of the motor are listed in table 3.3.

Figure 3.9: Hybrid bipolar stepper motor

Table 3.3: Hybrid bipolar stepper motor specifications

Current rating

2.8 A

Frame size

56.4 mm x 56.4 mm

Holding torque

1.01 Nm

Number of wires

Resistance per phase

0.83

Shaft diameter

6.35 mm

Shaft length

19 mm

Step angle

1.8

Voltage rating

2.3 V

3.4.9 Motor Driver


A stepper motor driver is used to drive a stepper motor. It converts step (Pulse) and
direction inputs from a PC, Microcontroller or other source to the signals needed to send
current to the coils of the stepper motor. The characteristic that the stepper motor driver
should possess, is that it should be a bipolar stepper motor driver.
The Ocean controls KT-5196 Bipolar Stepper Motor Driver as shown in figure
3.10 was selected as it closely matches the above requirement. Other advantages
are listed below:
39

3.0 Methodology and Design

It is Microcontroller based.

It can controls 4,6 and 8 wire stepper motors.

It can do full and half stepping modes 1/4, 1/8, 1/16,1/64 and 1/128 microstepping modes.

Figure 3.10: Ocean controls KT-5196 Stepper Motor Driver

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:

It has a long lifetime compared to the horizontal one.

It is easy to clean and to handle.

It can be repaired easily if one slot gets broken.

It can be opened and closed easily.

3.4.10.1 Cooling and Heating System


A cooling and Heating System is required so as to maintain a constant temperature in
the automated room. Mauritius is a tropical island situated in the southern hemisphere
and hence does not really require a heating system. Even in winter, the temperature will
rarely go below 15C. However, the project can be easily modified to accommodate a
heater if the need is felt. The cooling system, on the other hand, is required due to the
40

3.0 Methodology and Design


hot temperatures prevailing on the island during summer.
An Air-conditioner would be the ideal choice for a cooling system in this project.
However, for practical reasons, it would be impossible to use an air-conditioner in the
prototype. Moreover, the air-conditioner being a huge consumer of electricity would
defeat one of the objectives of the project which is to save energy. So, a 12 volts dc
brushless fan (Figure 3.12) is used to represent the air-conditioner. The cooling system
in this project is illustrated by the block diagram in figure 3.11.

Figure 3.11: Block diagram of cooling system

Figure 3.12: 12 volts dc brushless fan

41

4.0 Implementation of the Mechanical Structure

IMPLEMENTATION OF THE MECHANICAL STRUCTURE

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.

4.1 Mechanical Part


As mentioned in chapter 3 section 3.1, the Mechanical structure of this project is
composed of the following parts:

Room Construction

Blind cloth hanger and Blind cloth

Motor Coupler

Freewheel

Transmission Mechanism

A detailed description of the mentioned parts is given in the following sections.

4.2 Room Construction


The automated room is made of plywood (5 mm Thickness). A large sheet of plywood
is cut into the required dimensions for the base, side walls, front, back and the roof.
Figure 4.1 shows a complete floor plan illustrating clearly the different dimensioning
and the final arrangement of the room.
The cuttings are done with respect to the following dimensions:
Base = 550 mm x 700 mm
Front and back side walls = 450 mm x 450 mm
2 sides walls = 700 mm x 450 mm
Height of roof= 150 mm
Right side window = 400 mm x 250 mm
Back side window = 250 mm x 250 mm

42

4.0 Implementation of the Mechanical Structure


Door = 180 mm x 50 mm
Ventilation frame = 80 mm x 80 mm

Figure 4.1: Final Design of the room with dimensions

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.

4.3 Blind cloth hanger and blind cloth


A complete blind mechanism consists of a blind cloth hanger and a piece of cloth hangs
onto the latter.

43

4.0 Implementation of the Mechanical Structure


4.3.1 Blind cloth hanger
The cloth hanger is made of two pieces of metal each of length 110 mm and 80 mm
respectively.
Two long metal bars of circular diameter 6 mm and 8 mm respectively were purchased.
Ten pieces of length 110 mm and 80 mm were cut from the 6 mm and 8 mm metal bars.
Calculations reveal that ten pieces are necessary to cover both the back and side
window.
One piece of each 110 mm and 80 mm metal is welded by a process called arc welding.
The 80 mm metal is welded perpendicularly at approximately half the length of the 110
mm metal bar, that is, 55 mm. A T-shape product is finally obtained (Figure 4.2).

Figure 4.2: T-shape metal

4.3.2 Blind Cloth


The cloth is cut to the required length with reference to the height of the walls of the
prototype. Then, the top of the cloth is sewed onto the T-shape metal as shown in Figure
4.3.

44

4.0 Implementation of the Mechanical Structure

Figure 4.3: Blind Cloth

4.4 Motor Coupler


The motor could not be connected directly to the freewheel. The freewheel is circular in
shape and has a centre hole of diameter 8 mm. The motor shaft has a diameter of 6.35
mm. Therefore, due to difference in diameters, the motor could not fit into the
freewheel. Thus, a coupler is manufactured to connect the motor shaft and the
freewheel.
The coupler is designed in such a way that the motor shaft fits in a hole at one end of
the coupler and the other end fits into the freewheel. Figure 4.4 shows a diagram of the
coupler connected to the motor and the freewheel.

45

4.0 Implementation of the Mechanical Structure

Figure 4.4: Motor and freewheel connected by a coupler

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

4.0 Implementation of the Mechanical Structure

Figure 4.5: Metal Rod

Cutting tool

Turning Chuck
Coupler
Figure 4.6: Turning Chuck

Figure 4.7: Coupling device with screws

47

4.0 Implementation of the Mechanical Structure

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

A sheet of aluminium of thickness 4 mm was used to manufacture the freewheel.


Firstly, the sheet was divided equally by a distance of 10 mm along its circumference
and the divisions were marked. Holes of diameter 10 mm were drilled at these points.
The sheet was finally cut to a reference diameter 50 mm as illustrated in figure 4.9.

48

4.0 Implementation of the Mechanical Structure

Figure 4.9: Drilling and cutting of the aluminium sheet

The resulting flywheel is represented in Figure 4.10.

Figure 4.10: Final Product of freewheel

4.6 Transmission Mechanism


A power transmission mechanism is needed to rotate the blinds in this project. The
power transmission used is a metal chain linking the motor and all the freewheels. In
49

4.0 Implementation of the Mechanical Structure


other words, the motor shaft was connected to the coupler, which was in turn connected
to a freewheel, which is the driver and all the other freewheels are driven by means of a
metal chain as shown in figure 4.11

Figure 4.11: Metal chain connected to freewheel

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:

Goggles were worn to protect the eyes.

Machines were operated according to operation manual.

Any incident or faults found was immediately reported.

The workplace was kept neat and tidy.

Lab coat was worn in order to avoid interference with working machines.

50

5.0 Electrical and Electronic Circuitry

ELECTRICAL AND ELECTRONIC CIRCUITRY

To be able to achieve the aims of the Microcontroller-based room automation system,


one of the most fundamental aspects to be considered is the electrical and electronic
circuitry. The design of the interface between the microcontroller with numerous inputs
and output devices is always a delicate task. However, errors in connection and polarity
of electronic devices are easily done and their troubleshooting becomes difficult.
Therefore, a simpler way was selected in order to reduce these errors. A built-in
microcontroller board namely the Olimex development board was used. This chapter
will elaborate on the electrical and electronic circuitry of the project.

5.1 Input/output pins of Microcontroller 16F877


The pin-out diagram of the PIC 16F877 is given in Figure 5.1. The Inputs are sensors
namely LDR, PIR, Thermistor 103 and Smoke sensor. The input port selected is
PORTB and the output port selected is PORTD.

Figure 5.1: Microcontroller 16F877 pins [33]

5.2 Interface of the Motion sensor and the Microcontroller


The circuit used to connect the PIR motion sensor and the microcontroller is shown in
figure 5.2. The PIR sensor is the main component used in the project to activate and
deactivate the system. The PIR motion sensor is connected to a + 5 Volt DC supply.
The output of the sensor is fed to PORTB.0 of the microcontroller. Whenever there is a
temperature difference in the detection range of the PIR sensor, the input at PORTB.0
equals to 1.

51

5.0 Electrical and Electronic Circuitry

Figure 5.2: Wiring of PIR sensor to microcontroller

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.

Figure 5.3: Relevant circuit of LDR sensor connected to microcontroller

52

5.0 Electrical and Electronic Circuitry


The circuit in Figure 5.3 is connected to a + 9 Volt DC supply. When the LDR (Norp12)
is exposed to light its resistance falls, thus causing the base current of the transistor to
increase and consequently the collector current also increases. The LED will then be on
and the relay will be energised. Hence, a + 5 Volt connected to the relay will be input to
PORTB.1 of the microcontroller.

5.4 Circuit of the inside Light Sensor


The main function of the inside light sensor is to vary artificial light intensity according
to the amount of natural light present in the room. Thus, a dimmer is used in this circuit
to adjust the amount of artificial light in the room depending on the amount of natural
light present. Figure 5.4 show the circuit implemented to attain this objective.

Figure 5.4: Interface of the inside light sensor to a dimmer and a bulb

The LDR Norp12 present in Figure 5.4 is connected to a variable resistance of 0 10


K connected in turn to a DC supply of + 5 volts. When light falls on the LDR its
resistance decreases, thus reducing the output voltage and vice versa. The output
varying voltage is fed to a dimmer which is operated with an AC supply of 240 volts.
Depending upon whether the input voltage in the dimmer increases or decreases, the
bulb will glow brighter or dimmer.

5.5 Temperature sensor connected to the Microcontroller


The circuit used in this project to monitor temperature variation is shown in figure 5.5.
As temperature will increase, the thermistor 103 resistance value will decrease. The
potential divider circuit will vary the differential voltage input to the 741op-am. The
53

5.0 Electrical and Electronic Circuitry


latter will then amplify this differential voltage value and output the amplified voltage
at Port A.0 of the microcontroller.

Figure 5.5: Thermistor 103 sensor circuit

5.6 Circuit connecting the Microcontroller and the Motors


To control the stepper motor, the KT-5196 stepper motor driver is used. The circuit
connecting the microcontroller to the stepper motor driver and the latter to the motor is
shown in Figure 5.6.
The circuit is used to drive the stepper motor. The driver KT-5196 contains selector
inputs which are used to select the step resolution required. The PIC 16F877A
microcontroller is going to determine the angle through which the blind mechanism
needs to rotate depending on the light intensity received and will accordingly send the
required number of step pulses to the driver to rotate the motor.

54

5.0 Electrical and Electronic Circuitry

Figure 5.6: Circuit connecting the KT-5196 stepper motor driver to the microcontroller and the
motor.

5.7 Circuit linking the PIC 16F877 and a Fan


Here, the output voltage from the microcontroller is amplified to energise a relay which
in turn switches a 12 V DC fan on. Figure 5.7 shows the circuit used to implement this
function.
In Figure 5.7, when portC.6 in PIC 16F877 is actuated, current flows through the 1 K
resistor via the base and the collector pin of the transistor BC 237 and hence a +12 V
DC relay is energised. The relay is connected across a +12 V DC supply which in turn
switches the fan on.

55

5.0 Electrical and Electronic Circuitry

Figure 5.7: Interface of microcontroller to a +12 V DC fan

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.0 Electrical and Electronic Circuitry

Figure 5.8: Circuit linking the microcontroller and the LED

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.

Figure 5.9: Interface between the microcontroller and a buzzer

57

5.0 Electrical and Electronic Circuitry

5.9 Limit Switch


A limit switch is used to sense the extreme position of the blind. In this context, if the
limit switch is activated it will send a voltage to the microcontroller notifying its actual
position. The microcontroller then knows the exact position of the blind mechanism and
can take necessary action. The type of limit switch used is a micro-switch. Figure 5.10
shows a diagram of the micro-switch used.

Figure 5.10: Micro-switch

58

6.0 Software Development

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.

6.2 Software development


The program developed by the PIC16F877 microcontroller has to take into
consideration all the possible input combinations and devise a logical course of action
for each input combination so that the automated room works according to plans. To
facilitate development of the software, flowcharts have been used to describe in a step
by step manner how the system works. The corresponding programming codes are
given in Appendix B. Figure 6.1 represents the main flowchart. It consists of a motion
sensor, which is considered to be the most fundamental device in this project.

59

6.0 Software Development

Start

Motion
Sensor
NO

Is PIR
sensor=1?
Yes

Flash LED and


Beep Alarm

End

Figure 6.1: Main flowchart of the system

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

6.0 Software Development

Temperat
ure
sensor

Is it 30 C?

No

Yes

Turn Fan ON

End

Figure 6.2: Flowchart of Temperature sensor in the system

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

6.0 Software Development

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

Figure 6.3: Flowchart of outside light sensor in the system

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

6.0 Software Development


In case of night, the same principle will apply. In other words, the limit switch will
describe the position of the blinds. If limit switch is pressed the motors, will not be
activated. But, if limit switch is not pressed the motors will be switched on, thus,
closing the blinds.
As usual, this process is repeated as the program is looped to begin another cycle.

63

8.0 Conclusion

TESTING AND RESULTS

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.

7.1 Mechanical Testing


This section deals with the operation of the blind mechanism. Once the blind
mechanism has been mounted, the following mechanical test was done to analyse how
the mechanism behaves while functioning.
7.1.1 Testing and Observation
The checking round was performed by rotating the coupling device manually. This was
done to investigate if the power transmission was rotating smoothly along the freewheel
as expected. The objective of this experiment is to determine the degree of smoothness
of the blind rotation during operation and to have an idea about the frictional force
present.

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.

There were some mechanical imperfections while manufacturing the freewheel.


For example, the drillings were off-centred and the distances between two
consecutive teeth were not regular everywhere.

Solution used:
The metal chain was greased.

64

8.0 Conclusion

7.2 Electrical/ Electronic Testing


This section discusses about the implementation of the circuit and the necessary tests
performed.

7.2.1 Implementation and Testing of the Temperature Sensor circuit


The circuit was design exactly as illustrated in section 5.5 of this report. Before its
implementation on strip board, the latter was mounted on a breadboard for testing.
When a voltage of + 5 V was supplied to the circuit, an output voltage of 1.648 V was
recorded for a temperature of 26C (Room temperature). Hot water was used as an
option to increase the temperature of the surrounding. A thermometer was used to
measure the exact temperature. The circuit was designed in such a way that when the
temperature was above 30C, the output voltage was high (4.57 V) and below 30C, it
was low (1.648 V). The test results confirmed that above 30C, a high voltage was
recorded by the microcontroller. This implied that the circuit has been correctly
mounted and the objective was met. Figure 7.1 shows the procedure adopted to record a
high voltage on a multimeter.

Figure 7.1: Multimeter reading for temperature sensor

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.

Table 7.1:Outputs of the PIR Motion Sensor

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

Figure 7.2: Output voltages of PIR sensor

7.2.3 Outside LDR Light Sensor Testing


Once the LDR kit had been mounted and connected to a battery of + 9 V as detailed in
section 5.3, a supply voltage of +5 V was connected to the relay. When light fell on the
LDR, the relay was energised and hence, a voltage of +4.76 V was read on a

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.

Figure 7.3: Voltage output from the Outside LDR

7.2.4 Implementation and testing of the Inside LDR Light Sensor


The circuit for the inside LDR Light Sensor was implemented exactly as per section 5.4.
When a supply of + 5V was applied to the circuit for testing, a range of voltages was
obtained for different light intensities. Table 7.2 shows the values recorded during the
testing process.
Table 7.2: The output voltage of the input light intensity

Amount of light Intensity

Output voltage/ V

Maximum

0.42

Medium< x < Maximum

1.61

Medium

2.05

Minimum< y < Medium

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.

Figure 7.4: Stepper Motor connected to 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.

7.3 Software Testing


The software which controls the entire system was written with Mikrobasic and was
simulated using PIC Simulator IDE. The program was tested to determine whether the
proper sequence of operation had been achieved. After several attempts during which

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.

7.3.1 Testing of the whole system with PIC 16F877A Microcontroller


All the circuits implemented in this system were mounted on strip boards and the latter
was connected to the respective pins of the PIC16F877A microcontroller, which was
mounted on a development board. Figure 7.4 gives a full outlook of the arrangement of
the circuits for the whole system.

Figure 7.5: The complete circuit

7.3.2 Problems Encountered


During the simulation of the software, the program was looping between certain lines
and was not able to continue execution. Therefore, some variables were introduced in
the program to avoid the above mentioned problem. Moreover, some problems were
encountered in making the stepper motor rotate by the microcontroller.

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

The microcontroller-based room automation system was indeed a very interesting


project to work on. The energy saving system is not limited for this particular
application as it can be implemented in several other applications like: Offices and
Laboratories with little modification in software coding with respect to the
requirements. The fact that the program controls the operation of the provides the
flexibility to the project to adapt and extend as needs changes.
In this project a temperature sensor is used to maintain a stable temperature in the room.
This is achieved by a cooling fan which actuates at 30C. Moreover, a light sensor
monitors the amount of natural light present in the room during the day and accounts for
the right intensity by providing an amount of artificial light. A smoke sensor provides
the security of the occupant and a PIR motion sensor detects occupancy of the room.
This

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.1 Difficulties and limitations


Nowadays, automated systems are easily available on the market. Each and every
design faces the risk of being duplicated by competitors to market their products. So,
due to the risks that their products can be copied, no information about the devices used,
the working mechanism and the software that run them are kept confidential. Hence, it
was a challenging task to find out how to proceed with the various mechanisms of the
automated room and how to integrate them in a single system. All the components used
including the blind mechanism were designed and constructed with much precision and
accuracy.

8.2 Future works


The objectives of the automated system proposed at the beginning of the project were
successfully attained. However, some improvements can be brought forward to upgrade
the system. Some of the recommendations are listed below:
70

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.

Instead of using PIC16F877A microcontroller, a MIAC can be used as


controller. The signal conditioning will not be complicated and motors can be
connected directly to the miac.

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.

The system can be control by using a wireless communication via a mobile


phone.

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

[3] Brandon Lord, The importance of Home automation,


http://www.articlesnatch.com/Article/The-Importance-Of-HomeAutomation/1766974#.ULZmJ88-u0w, Aug 21 2011 [Nov 09 2012].

[4] Robert Emerson, Importance of Home Automation,


http://www.articlesbase.com/cable-and-satellite-tv-articles/importance-of-homeautomation-5573834.html, Jan 16 2012 [Nov 11 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.

[6] Ministry of Energy and public utilities, Energy sector overview,


http://www.gov.mu/portal/site/mpusite/menuitem.f676a53597359b5632cf401000b521ca
/, Jun 18 2012 [Dec 06 2012].

[7] Lisa Montgomery, 10 key features in a home automation system,


http://www.electronichouse.com/article/10_features_to_look_for_in_a_home_automatio
n_system/, Jun 05 2009 [Nov 10 2012].

[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

[11] Ricky Andromeda, Types of light sensors,


http://www.ehow.com/list_6820001_types-light-sensors.html, [14 Jan 2013].
[12] Vandana, default charged coupled device,
http://www.techfuels.com/scanner/1577-charge-coupled-device.html, 20 march 2008
[14 Jan 2013].
[13] Motion Sensor, Motion detector, http://en.wikipedia.org/wiki/Motion_detector,
12 Jan 2013 [15 jan2013].
[14] Carolyn, 5 Types of Motion Detectors, http://www.familyhomesecurity.com/5types-of-motion-detectors/, [15 Jan 2013]
[15] Ultrasonic Motion Detector, http://www.autothiefs.com/ultrasonic-motionsensor.html [15 Jan 2013].
[16] Temperature sensors, The seven basic types of temperature sensors,
http://www.wwdmag.com/water/seven-basic-types-temperature-sensors, 28 December
[22 Jan 2013].
[17] Sensor selection guides, Types of Temperature sensors,
http://www.watlow.com/products/guides/sensor/index.cfm, [22 Jan 2013].
[18] Temperature sensors, Types of temperature sensors,
http://www.hayashidenko.co.jp/en/info08.html, [22 Jan 2013].
[19] Smoke sensors, Smoke detectors, http://en.wikipedia.org/wiki/Smoke_detector,
16 Jan 2013, [23 Jan 2013].
[20] Anne Marie Helmenstine, How do smoke detectors work?
http://chemistry.about.com/cs/howthingswork/a/aa071401a.htm, [23 Jan 2013].
[21] PLC, Programmable Logic Controller,
http://en.wikipedia.org/wiki/Programmable_logic_controller, 19 Jan 2013, [24 Jan
2013].
[22] Bridges, Functions, Advantages and Disadvantages of programmable logic
controllers (PLCs), http://bridges.articlealley.com/functions-advantages-anddisadvantages-of-programmable-logic-controllers-plcs-1644253.html, 08 July 2010, [24
Jan 2013].
[23] PIC Microcontroller, A PIC Microcontroller Introduction, http://www.bestmicrocontroller-projects.com/pic-microcontroller.html, [24 Jan 2013].
[24] Martin Bates. More control systems Pic Microcontroller, second edition,
Newnes, 200 wheeler Road, Burlington, UK,MA01803,Elsevier, 2004,Pg 300.
73

[25] Lamps, The different types of Lamps,


http://www.uom.ac.mu/saveenergy/lamptypes.html, [27 Jan 2013].
[26] Aneesh Jeetoo, Design and implementation of a Microcontroller-based Syringe
pump, Beng Honors, University of Mauritius, Reduit, Mauritius, 2012.
[27] John Sunshine, What are the different types of electric motors?
http://www.wisegeek.com/what-are-the-different-types-of-electric-motors.htm, 11 Dec
2012, [28 Jan 2013].
[28] Electric motors, Types of Electric Motors,
http://www.ece.uah.edu/courses/material/EE410-Wms2/Electric%20motors.pdf, [28 Jan
2013].
[29] Vertical Blinds, What are vertical blinds? http://www.replacement-blindsslats.co.uk/vertical-blinds-hotizontal-blinds.html, [28 Aug 2012].
[30] Blinds, Vertical and Horizontal blinds, http://www.blindshalet.com/bpa-16verticalblinds.html, 11 Dec 2009, [28 Aug 2012].
[31] PIC16F877A pins,
http://www.codeproject.com/KB/gadgets/DigitalThermometer/ATMEGA16-pinout.jpg,
[20 March 2013]
[32] Development board, OLIMEX Board, http://hruska.us/tempmon/old-index.html,
[13 Feb 2013].
[33] Pins of 16F877A microcontroller, http://www.voti.nl/wloader/pinout.gif, [6 March
2013].

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

PIR Module Data sheet

85

Appendices

PIC16F877A Data Sheet

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

dim temp_sensor, x, y, h, j as word 'Describing variables'


dim n,m as integer
const Temp=932

sub procedure Opening_of_blinds()


'SUB1: 'Opening of blinds'
n=0
while (n<50)
PORTD.2=1 'Step m1'
PORTD.3=1 'DIR m1'
PORTD.4=1 'Ena m1'
PORTD.5=1 'step m2'
PORTD.6=1 'DIR m2'
PORTD.7=1 'Ena m2'
delay_us(500)
PORTD.2=0
PORTD.3=1
PortD.4=1
PortD.5=0
PORTD.6=1
PORTD.7=1
delay_us(500)
inc (n)
wend
PortD.4=0
93

Appendices
PortD.7=0
y=1
j=1
h=1

end sub

sub procedure Closing_of_Blinds()


'SUB2: 'Closing of Blinds'
m=0
while (m<50)
PORTD.2=1 'step m1'
PORTD.3=0 'DIR m1'
PORTD.4=1 'Ena m1'
PORTD.5=1 'Step m2'
PORTD.6=0 'DIR m2'
PORTD.7=1 'Ena m2'
delay_us(500)
PORTD.2=0
PORTD.3=0
portD.4=1
PORTD.5=0
PORTD.6=0
PORTD.7=1
delay_us(500)
inc (m)
wend
j=0
h=0
y=0
PortD.4=0

94

Appendices
PortD.7=0
end sub

main:

Intcon=0
ADCON1 =$80

TrisA.0=$01 'set port A.0 as analogue input'


TrisB=$FF 'set portB as input'
TrisD=$00 'set portD as output'
TrisC.0=$01 'set portC.0 as output'

If PORTB.0=0 'No signal from PIR'


Then
x=0
End if

If (PORTB.0=1) and (x=0) 'Signal from PIR'


Then
PORTD.0=1 'Flash LED'
PORTD.1=1 'Beep sound'
delay_ms(1000)
PORTD.0=0
PORTD.1=0
delay_ms(1000)
PORTD.0=1
PORTD.1=1
delay_ms(1000)
PORTD.0=0
PORTD.1=0

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.1=0) and (PORTB.0=1) and (h=1) 'signal from LDR night'


Then
Closing_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

PROGRESS LOG BOOK

98

Das könnte Ihnen auch gefallen