Sunteți pe pagina 1din 32

INDIVIDUAL ASSIGNMENT

System Programming & Computer Control

Names

Module code

: CT047-3-2 / SPCC

Intake code

: UC2F1505 (SE)

Assignment title : Smart Home Control System


Name of lecturer: Mr. Seyed Amir Hossien Mousavi
Date due

Abstract

: 17th August 2015

This project was assigned to develop and portray the entire view of the Smart Homer Control
System that has been developed by utilizing LabVIEW skills. The developer has been
constricted to build a Smart Home by using LabVIEW. The system will function in a way
which is expected to control all the assorted devices in the home by having a main central
control keypad. All these devices will be communicated with each other in a direction via
TCP/IP connections.

Contents
Abstract......................................................................................................................................2
Acknowledgement......................................................................................................................5
Introduction................................................................................................................................6
LabVIEW...............................................................................................................................6
Smart Home Control System..................................................................................................6
Project.....................................................................................................................................7
LabVIEW features..................................................................................................................7
Global and local variable....................................................................................................7
Customizing Control...........................................................................................................8
Attribute Nodes...................................................................................................................9
Project requirements.................................................................................................................10
Accomplishment of the requirements using LabVIEW.......................................................10
Why we should use LabVIEW.............................................................................................11
How does LabVIEW works..................................................................................................11
System design...........................................................................................................................13
Client....................................................................................................................................13
Server....................................................................................................................................14
Protocol design.........................................................................................................................15
TCP/IP..................................................................................................................................15
Client model.........................................................................................................................15
Server model.........................................................................................................................15
TCP Open Connection......................................................................................................16
TCP Read..........................................................................................................................17
TCP Listen........................................................................................................................17
TCP Write.........................................................................................................................18
Limitation.................................................................................................................................19
Enhancements..........................................................................................................................20
Conclusion................................................................................................................................21
References................................................................................................................................22
Appendices...............................................................................................................................23
User Manual.........................................................................................................................23
Login.................................................................................................................................23
3

Lights................................................................................................................................23
Fans...................................................................................................................................24
Door..................................................................................................................................24
Curtain..............................................................................................................................25
Television..........................................................................................................................25
Server................................................................................................................................26
Additional Feature................................................................................................................27
Multiuser login..................................................................................................................27
Web Browser.....................................................................................................................27
Main switches...................................................................................................................28
User Control......................................................................................................................28
Alarm................................................................................................................................29
TV Size.............................................................................................................................29
Class exercises......................................................................................................................30
a)

Traffic Light..................................................................................................................30

b)

LED Lights....................................................................................................................31

Gantt chart............................................................................................................................32

Acknowledgement
This system work is the yield of continuous and scholarly provision from numerous resources
and people. It is impossible to express the debts owed to whoever that provides moral support
to the scholar on completing this project successfully. I would like to take this opportunity to
gratitude all those people that provided moral support and guidance to complete this project.
Although I faced some difficulties at the initial stage of this project but I have overcome it
successfully with endless, constant encouragement and guidance given by the module
lecturer. The module lecturer have widened my knowledge in terms of LabVIEW
programming and inspired me to accomplish the project in the given time frame. The
suggestions given by the lecture made me to maintain a good quality of task.
Current progression of technology has assisted me a lot in developing the application.
Through Google and YouTube, I have learnt various new techniques. It gave me better idea to
develop the system which helped me to provide a better system. I would like to take the
opportunity to thank them from bottom of my heart.

Introduction
LabVIEW
LabVIEW which stands for Laboratory Virtual Instrument Engineering Workbench is a
design platform which developed by National Instrument. Although it is from programming
background but LabVIEW is totally different from other programming languages such as
Java and C++. It is from a visual programming background where the system is developed
using graphical notation. LabVIEW is a platform independent where it can able to run
similarly in any types of hardware and operating system such as Mac OS X, Windows and
Linux with adequate runtime support. LabVIEW is supported by Virtual Instrument which
makes the programs in the LabVIEW can run in any combination of hardware and platform.
Thus, it can be easily transfer from one operating system to another type of operating system
upon its portability.

Smart Home Control System


Smart Home can be defined as a house that built with latest technological development and
uses that technology to monitor and control all the assorted devices in the house. This system
is such a complex system which cultivating from day to day for better enactment. The main
reason for develop a Smart Home Control System is to make the devices perform activities
automatically in a continuous flow as the user required once the user operate the central
control keypad. This is to provide a better living standard to people and make their life much
easier with technology.

Project
Focusing on the given project, the developer has given a task to develop a Smart Home
Control System with some features using LabVIEW. The developer came up with a
conclusion to develop a Smart Home Control System using a floor plan that designed by the
developer. The system should enable the user to control all the assorted devices using a home
remote control. This can be attainable using a LabVIEW where it only has the drag and drop
function which is easy to make things done. The system has been developed by having two
modules; one is Client and another one Server. Client which is a home system controller
provides user interface where the user gives input to the system. On the other hand, there is a
Server which is a home design plan used to process and provide output based on the input
given by the user using simulation. These two modules are communicated with each other
using TCP/IP networks. The user needs to login to the system by providing valid username
and password in order to access the system. This is to ensure that the system is secure to use.
Light, door, curtain and television are the prominent features that included for the user.
Moreover, extra features such as multi user login and web browser access also included in
this system.

LabVIEW features
LabVIEW has various features which make it to be flexible and easy to use. They also give a
professional look to the applications that built using LabVIEW.

Global and local variable

When there is a need to change the data value into several VI, the use of global variable takes
place. There are several advantages of using a global variable. One of them is the developer
only need to define the data once as it will write or read to various VI later. Since the use of
global variable consider as a poor practice of programming, the developer unable to view the
data flow in the applications. However, global variable is a good approach in some instances
such as the user can obtain the data although the program is still running with two while
loops. Data could be generated in a subVI in the top loop while the bottom loop reads the
7

data from the global and writes the information to the user interface(Ni.com,2015). Code
diagram is the place where the local variable created. Thus, the developer only can see the
local variable in code diagram.

Customizing Control
Custom control

Controls and indicators can be customized, saved, and reused in different Vis and this allows
the developer to modify the built-in controls and indicators to accommodate their applications
(Ni.com, 2015). The developer is able to make changes in the parts of the control, if he
modifies the Customize mode as the controls are the composition of the Customize mode.

Type Definitions

Type definition is the master copy of the control and indicator. Type definition will the
created if the developer needs changes in the control reflects in the several VIs. Once the
developer builds and saves the type definition, whatever changes are made to the control will
automatically applied to the all the VIs which are using that control.
Strict Type Definition

The strict type definition is also created in the same way as how the type definition has been
created but the only difference between these two is strict type definition requires the drop
down menu in the toolbar to be set manually by the developer. After the developer save the
strict type definition, the changes can be done in the master copy and these changes will only
apply to the Vis when they open. If the VI did not stored in the memory, changes will be not
updated to it.

Attribute Nodes

Attribute nodes are a means for getting and setting attributes of a control or indicator during
program execution. The attributes available will vary depending on the particular control or
indicator being used on the front panel of your application (Ni.com, 2015). Attribute Node
can be selected from the Create submenu by either pop up on control in the front panel or on
terminals in the block diagrams. By providing the ability to change the appearance, location,
and other attributes programmatically, attribute nodes provide you with a tremendous amount
of flexibility while designing and coding your application (Ni.com,2015).

Project requirements
The requirement of this project is to create a Smart Home Control System using LabVIEW
where the user can control the entire home appliance by using the controller in LabVIEW.
There are two modules which are client and server that used in this project in order to
accomplish the requirements.

Accomplishment of the requirements using LabVIEW


The developer expected to build a prototype using a visual programming language that can be
defined as LabVIEW to control home appliances. The prominent requirements of this project
are to build a Smart Home Control System that has various devices such as curtains,
television, lights and doors which can be controlled by the system. It is also has some
additional functions such as alarm clock, multiuser login and password protections for the tab
pages. The interface of the server is illustrated by the floor plan given to the developer.
The first function of the system is curtain. There are quite number of curtains used all around
the house. The features for the curtains are illustrated in the knob. When the user clicks the
button, the curtains will open and close by themselves.
Television is the second function that included in the system as per requirement. The
television represent as a window media player with play, pause, stop and volume adjustable
button. Few channels have been included for the user to watch.
The third function of this project requirement is lighting system. The lights will represent in
the form of LED. The lights have been set to some other parts of the house. All the lights will
give outputs to the user by on and off the lights.
The forth function is the door. The function of the door is exactly same as the function of the
curtain. It will open and close the door when the user clicks the buttons.

10

Why we should use LabVIEW


Creating a Smart Home Control System using a LabVIEW is the task given to the developer.
Thus, the developer needs to use the LabVIEW in order to accomplish the basic requirements
of this project. LabVIEW is developed using a graphical notation which is suitable for this
project. Moreover, LabVIEW is a sophisticated technology that has been use by millions of
scientists and engineers in testing and developing new applications. It is much easier for the
user to find a features as all of them are arranged in a proper order. There is an alternative
way to search for the features which provides description of the function and location of the
features. Thus, user can use this software without user guidelines although LabVIEW
comprises various features. The user can go for a control and help option in order to get to
know the functions and formats that can be applied onto each feature. It will produce a brief
introduction about how and where need to use the components and formats that can be used
in the features. Thus, the user can get wide knowledge about each feature without any
assistance from outside. Since it is from the visual programming background, it allows the
user to view the errors visually by highlighting them. Hence, it will be easy for the user to
correct the errors rather than searching where they have made the mistakes. Besides that,
LabVIEW is user friendly as users will feel sense of confortable and convenience to use this
software as it only required drag and drop operation in developing a system.

How does LabVIEW works


First of all, when you click the software it will show the starting window. Once you choose
the blank VI from the list of options given to you, it will show two types of windows. One is
front panel where you need to include designs and diagrams and a block diagram which the
connections and visual programming take place.
Front panel can also be defined as a user interface contains controls and indicators such as
button, containers and etc. The user can find all these components by right click the mouse.
All of them will be arranged in an order based on their category. For an example, the user can
only find the AND gate in numeric group.

11

On the other hand, the block diagram contains terminals, wires and structures. Once, the user
chooses the components in front panels, they will appear as a terminal in block diagram.
Then, the user will connect one terminal to another terminal using wires and suitable
terminals or functions. After done with all the connection, the user can run the program.
There are two option to run the program. Either can run the program once or run
continuously. After the application start to run the program, the user can choose either to stop
the program or pause it.

12

System design
Client

13

Server

14

Protocol design
TCP/IP
Internet Protocol (IP), Transmission Control Protocol (TCP) and User Datagram Protocol
(UDP) are the examples of protocols that act as an elementary tool of communication via
networks. They are used to exchange data from one network to another network such as
Intranet or Local Area Network (LAN). Since this project requires data connectivity between
client and server module, developer decided to use TCP or IP to enable the communication
between two modules. The reason for choosing this TCP or IP is these are the two protocols
that suitable to use for private network in a communication process as per required in this
project.

Client model
The diagram below simplifies how the client looks alike in the LabVIEW.

For client model, there are TCP Open Connection , TCP Write and TCP Close Connection.
TCP Open Connection will connect the client model to server model for communication
purpose. TCP Write will write data if there is any data that need to be stored in memory and
send it to server model to be initiated. TCP Close Connection will close the communication
between client and server model. As it close the connection, all the data that stored in the
memory will be deleted automatically.

Server model
The diagram below simplifies how the server looks alike in the LabVIEW.

15

There are three types of TCP that will be used in server model. They are TCP Listen, TCP
Read and TCP Close Connection. TCP Listen will listen to the signals and find is there any
port which has the same IP address. If it has so, the TCP Listen will relay to the TCP Read.
TCP Read will read the signal and perform actions as how the developer programmed it to be.
Lastly, the TCP Close Connection will close the connection between these two models.

TCP Open Connection

Address address can be an IP address or a hostname. This is where the developer


establishes TCP Open Connection address.
Remote port-this is the port which will specify the address that will use in TCP Open
Connection.
Timeout-the timeout will calculate in the millisecond. 60,000 ms is the default value for it
and if it shows -1 means needs to wait indefinitely. It will likely to produce an error after the
completion VI if still the connection did not fix a specific time.
Error in- it will explain the error condition that happens upon the execution of VI.
Local port- local port is the port where you specify the local TCP connection port and some
servers will only allow connections to clients that use port numbers within a specified range
that is dependent on the server the value is 0, TCP will choose an unused port (Ni.com,2015).

16

TCP Read

Connection ID- is the reference number that uniquely identifies the TCP Connection.
Bytes to read- this will read the number of bytes which come from the connection.
Timeout- the timeout will calculate in the millisecond. 25,000 ms is the default value for it
and if it shows -1 means needs to wait indefinitely. If the operation is incomplete, it will
likely to produce error after the completion of VI.
Error in- it will explain the error condition that happens upon the execution of VI. There is no
error in the default input of this cluster.
Connection ID out- it has a same function as connection ID.
Data out-is basically a string. The function of data out is to carry data read came from TCP
Connection.
Error out-it carries the details of error. If error in indicates an error, then error out contains
the same error information but otherwise it describes the error status that this VI produces
(Ni.com, 2015).

TCP Listen

Listener ID is a unique reference number that identify the Listener.


Timeout- the timeout will calculate in the millisecond. 25,000 ms is the default value for it
and if it shows -1 means needs to wait indefinitely. If the operation is incomplete, it will
likely to produce error after the completion of VI.

17

Error in- it will explain the error condition that happens upon the execution of VI. There is no
error in the default input of this cluster.
Listener ID-- it has a same function as Listener ID in.
Remote address-this is the address of remote machine that related to the TCP connection
which is in the IP address format.
Remote port- this is the port which will specify the address that will use in TCP Open
Connection.
Error out-it will contain error information if there is any error that the error in indicates.
Connection ID- is the reference number that uniquely identifies the TCP Connection.
TCP Write

Connection ID- is the reference number that uniquely identifies the TCP Connection.
Data in-It carries data to write in the TCP connection. It is in the string format.
Timeout- Timeout- the timeout will calculate in the millisecond. 25,000 ms is the default
value for it and if it shows -1 means needs to wait indefinitely. If the operation is incomplete,
it will likely to produce error after the completion of VI.
Error in- Error in- it will explain the error condition that happens upon the execution of VI.
There is no error in the default input of this cluster.
Connection ID out- it has a same function as connection ID.
Bytes written-is the number of bytes write by VI in order to specify the connection.
Error out-it will contain error information if there is any error that the error in indicates.

18

Limitation
As we all know nothing is perfect in the world as all the things have pros and cons.; same
concept applied here for the Smart Home Control System which was developed using
LabVIEW.
Light
As we know, once the system receives a correct response from the Client the light will turn
on or off but there is no light controller to control the colour of the light or the brightness of
the lights from dark to light.
User
For the login, only two users allow to access system. This is to ensure that the system is
secure and also to avoid the risk of theft. The system is can be accessible by two users and
registration for another user is permitted but into only can done through the parents. Besides
that, only one guest can register and login into the system. Moreover, not all the user can
perform similar function. Their accessibility is depend on the priorities that given to them.
Fan
The fan has the similar function as light. The fan will turn on once it gets the correct response
from the client but there is no controller to control the speed of the fan.

19

Enhancements
Smart Home Control System is the huge system with heavy scope. Thus, the developer
requires more time to implement more functionality into the system. Hence, the developer
provides some suggestions on functions that have stated below need to be integrated or
implemented in future for better performance of the system.
Online system
The developer suggests the system should be an online based system where the user can
access the system from wherever they are. Using an online system, the can monitor the
electronic devices virtually from anywhere. Thus, it would be very easy for them to get to
know what is going on in their home although they are far away from their home.
Integration of the users
As mentioned above, this system can be upgraded to be accessible by more users. This is
because, not two categories of people (parent and children) will be living in the house. Hence,
all the family members should give the priority to access into the system but the priority level
can be differ from the age or the type of user due to some security and privacy reason.
User access using biometric devices
Using username and password to login into the system is not an intelligent idea anymore
because anonymous who knows the username and password can easily get access into the
system without the knowledge of the users. Thus, biometric login devices such as face
detection, eye scanner and finger print should fix to the system where users can access
through these biometric devices.

20

Conclusion
In a nutshell, Smart Home Control System is sophisticated technology that implements in
todays life. Smart Home Control System has been discovered to keep the home safe and
secure. It will bring the users peace of mind and connected them to their home from wherever
they are. The user can control his home appliances using electronic devices by login into the
system. This system comprises many subsystems where they work together as one single
application with the control of LabVIEW. Besides that, the flexibility, consistency and other
facilities of the system will make the users ease to use the system. Although it has some
problems but there are solution for that which could enhance technology and can make it to
perform more efficiently. Enhancement of the system according to the current development is
vital for the users to interact with the system effortlessly.
At the end of this project, the developer learned numerous virtual programming skills and
how the LabVIEW, virtual programming aids the rapid progress of technology in the world.
The developer had a positive perspective towards the progression of this project where the
developer attained a lot of knowledge in the world of virtual programming in creating a
system which aid the human being to carry out certain tasks.

21

References
Ni.com, (2015). What Is LabVIEW? - National Instruments. [online] Available at:
http://www.ni.com/newsletter/51141/en/ [Accessed 26 July 2015].
What is protocol? - Definition from WhatIs.com. 2015. What is protocol? - Definition from
WhatIs.com. [online] Available at:http://searchnetworking.techtarget.com/definition/protocol.
[Accessed 2 August 2015].
LabVIEW User Manual National Instruments. 2015. LabVIEW User Manual - National
Instruments. [ONLINE] Available at http://www.ni.com/pdf/manuals/320999e.pdf [Accessed
15 August 2015]
Ni.com,. 'Basic TCP/IP Communication In Labview - National Instruments'. [ONLINE]
Available at http://www.ni.com/white-paper/2710/en/ [Accessed 25 July 2015]

22

Appendices
User Manual
Login

The diagram above shows the login panel. The users can only access to the system by valid
username and password. The tab will be only visible if the users enter a correct password for
the username.
Lights

The diagram above shows the switches that used to control the lights. The switches are used
to on and off the lights which are in the server. The lights can be found in the places such as
bathrooms, kitchens, bedrooms and in the living rooms for both level 0 and level 1. There are
19 lights surrounded the house.

23

Fans

Figure 3 shows the buttons that use as switches to switch on and switch off the fans which
can be found in bedrooms and living rooms. In this project, there are 7 fans around the house.
Door

The diagram above shows switches that used to control the doors in the server. There are
totally 4 doors in the house.

24

Curtain

The diagram above shows the knob or controller for the curtains. Its function is almost
similar to the door. Once the user rotates the knob in clockwise, the curtain will open
according to the scale of the knob. If the user rotates the knob in anti-clockwise, the curtain
that placed in the server will close according to the scale of the knob stopped. There are
totally 4 curtains applied in this system.
Television

This is the last project requirement of this project. Buttons such as play, pause, stop and
buttons for different channels have been implemented in the system. if the user click channel
1 button, the television in server will prepare the channel but it wont play the video until the
user click the play button. Volume slider added into the client to control the sound of the
television in the server.

25

Server

Additional Feature
Multiuser login

If the users enter incorrect password for more than 4 times, red light will turn on as a
warning that informing the users that the system going to be shutdown in a few seconds. If
the users enter a correct password the tab will be visible to them.

26

Web Browser

Web browser also implemented in this project where the user can access internet in the client.
Buttons such as go, reload, back, forward and search included in this web browser tab page to
ease the user to use this system.

Main switches

27

Main switches for lifts, fans, doors, and curtains have been created separately. Hence, the
users can use those switches to control devices in the server based on their category. One big
switch is also created to all the devices at one time. If a user wants to view the switches and
operate the devices, they need to click on the ok button about the main switch tab page. The
main switch tab page will be in invisible until the user click the ok button and enter the
correct password.
User Control

The user control tab page will be invisible for those who logged in into the system. The users
need to input the correct username and password in order to access the user control. If the
username and password are correct, the user control button will be visible for the user. Once
the users click that button, another two buttons will be appearing. One is for the day time
control and another one is for the night time control.

28

Alarm

Alarm concept was added into the client for the users to set alarm. Current time will be
showed in the client and below it has a set alarm button. If the users click that button, a new
message box will be appearing. This is the place where the users need to input the alarm
timing.
TV Size

This format was used to fix the TV size. By using this format the TV size will remain same
although the users change the channels.

29

Class exercises
a) Traffic Light

30

b) LED Lights

Gantt
chart

31

32

S-ar putea să vă placă și