The Islamic University of Gaza

Faculty of Enginerring

Computer Department

Proposal For Graduate Project

Web Based Home Automation System

Done By :

Ahmed Faris

Ahmad Jarghoun

Saa'd Ashour

Submited to :

Eng. Osama Khader

Table of Contents

Table of Contents ….……………………………………………………………………...2

Table of Contents ….……………………………………………………………………...3

1. Introduction.…………………………………………………………...……………...4

1.1 About this Project……………………………………………………………..5

1.2 Description of Problem Domain………………………………………………5

1.3 What is Home Automation……………………………………………………5

1.4 System Overview………………………………………………………….….6

1.5 Research Undertaken………………………………………………………...7

1.6 Resource Requirements……………………………………………………...8

2. Requirements Analysis……………………………………………………………...9

2.1 Features of a Home Automation System…………………………………….10

2.2 Overview of Requirements………………………………………………..…10

2.3 General and Non-Functional Requirements………………………………….11

2.3.1 Security Requirements…………………………………………..…11

2.3.2 Performance Requirements………………………………………...11

2.3.3 User Interface Requirements……………………………………….12

2.3.4 Data Requirements…………………………………………………13

2.3.5 Hardware Requirements…………………………………………....13

2.3.6 Software Requirements…………………………………………….14

2.4Constraints…………………………………………………………………...14

2.4.1 External Constraints………………………………………………..14

2.4.2 Internal Constraints………………………………………………...14

3. High Level Design……………………………………………………………...……15 3.1 System Architecture………………………………………………………….17

3.1.1 Layers Architecture……………………………………………...…17

3.1.2 Technology Architecture…………………………………………..17

3.1.3 Project Architecture………………………………………………..17

3.1.4State Diagram………………………………………………………18

3.2Architecture Details……………………………...……………………....…..19

3.4System Interfaces…………………………………………………………….20

3.4.1 User Interface Design………………………………………...……20

3.4.2 System Interfaces…………………………………………………..21

4. Low Level ……………………………………………………………….22

4.1 System Architecture………………………………………………………….23

4.1.1 Client/Server Architecture…………………………………………24

4.1.2 Software Required…………………………………………………24

4.1.3 System Features……………………………………………………25

4.2 Architecture Details ……………………………………………………....26

4.3 Database Design……………………………………………………27

4.4 User Interface Design … …………………………..………………28

5. Implementation...... 31

5.1 code Implementation ………………………………………………………...32

6. Conclusions……………………………………………………………………..……41

6.1 Possible Future Software Changes………………………………………..….42

6.2 Final Thoughts……………………………………………………………….42

7. References...... 43

Introduction

Section 1 Introduction

1.1 About this Project

The goal of this project is to develop asecure Web Based Home Automation System that will allow users to remotely operate electric home appliances, e.g. turning on/off lights,in the user’s home.

The user interacts with the Home Automation System through a network, such as the Internetor a Local Area Network intranet by using an ordinary web browser. This will provide a user-friendly interface for the user to access and interact with the electric devices in the home.

Examples of practical uses for such a Home Automation System are many. These include;

  • energy management
  • heating control
  • lighting control

1.2 Description of Problem Domain

Home automation is a potentially huge growth area and several companies are currently developing software that enable users to access home devices from the office or other remote locations.

However, the software these companies are developing to accomplish home automation have;

  • Proprietary Interfaces
  • Are Totally Insecure
  • Not Web-Enabled

Therefore this project seeks to develop a Home Automation System that will overcome these limitations.

1.3 What is Home Automation?

Home Automation is a way of controlling electrical appliances from a distance. Commands are sent from one location and received and acted upon in another location.

There are several systems available for implementing this kind of control. This project will focus on the cheapest and most popular method for home automation, use Microcontroller .

1.4 System Overview

The Home Automation System will allow users to use any Internet web browser to remotely control their electric home appliances through a simple web page. This software intends to leverage existing technologies and to utilise them in a new way.

The proposed Home Automation System will be multi-user and will exist in a distributed computer environment such as the Internet but will also be accessible from within an intranet such as an office or in the home itself.

The basic objectives are:

  • The software will run on any web browser.
  • The software will switch devices attached to the remote computer on and off.

The proposed system can best be illustrated with the following diagram;

Home

(ParallelPort Cable)

Web Server/PC

PIC Circuit

(House wiring)

Web Browser

Lamp

Figure 1.1 System Overview

1.5 Research Undertaken

Several lines of research were conducted to support the implementation of the Home Automation System.

On the technical side, the research included;

  • Security Technologies – This will be of vital importance as the home automation system will be accessible from remote locations. Astrong authentication architecture will be required.
  • CommunicationTechnologies – A way of communicating via com ports on a PC will have to be researched. This will be necessary to communicate from the PC to the automated device.
  • Server Technologies – A lightweight web server has to be researched.
  • Automation Technologies – The technology required for switching on and off the remote devices will have to be researched.

On the non-technical side, researching various aspects of the project, which will include:

  • User interface design – We will be researching existing software products already available and also those in development.
  • Usability of current systems – We will be looking at the usability of different user interfaces currently used.
  • Functionality of current systems – We also will be examining the functionality of existing systems.

This project will be challenging in many ways. The development of the online interface and communication with the automated devices is a new combination of technologies.

However We have a lot of experience of working in software/hardware environment and feel the resulting software would be benefit in Home Automation.

1.6 Resource Requirements

The resources required for this project are as follows.

Software: NetBeans IDE

JCreator Pro Edition

Java SDK 1.5.0

Tomcat Apache Webserver

Internet Explorer 5.0 or later

ParallelPort Java Package

Word 2000

Microsoft Frontpage

Microsoft Access 2000

Hardware: ParallelPort cable

Kit to collect the circuit

PIC 16F84A Microcontrolle

12V Transformer

Resistors , Transistors , Capacitors & , Leds , & Wires

Personal Computer

Knowledge :- JSP , web programming

Java Programming

Microcontroller Programming concepts

Some Skills of design

Requirements Analysis

Section 2 Requirements Analysis

There are a number of requirements for this project design. The main requirements are;

  • The system should be as easy to use as possible and should allow the user to access all functionality via a web-based interface.
  • The system should be designed in a modular fashion. A modular system allows for easier implementation and well as easier modification at a later stage.

2.1 Features of a Home Automation System

  • The ability to control a device–This is simply the ability to turn On or Off a device, e.g. a lamp, from the Home Automation interface.
  • The ability to authenticate users – This authenticates user connections to the Home Automation System to prevent unauthorised access.
  • The ability to assign devices to a logical group–This simply means that a collection of devices are abstracted to logical groups of devices for ease of operation and organisation of devices. These logical groups in this project will be referred to as ‘Rooms’ in the Home Automation System, which can hold any number of devices .

2.2 Overview of Requirements

The basic requirements for the Web Based Home Automation System are:

  • Security Requirements – As users will have to log into the Home Automation System from remote locations and from different computers, security is a very important consideration in this project.
  • Performance Requirements – The home automation system must perform well and be reliable. Because a home automation system integrates devices in the home it is subject to a high number of possible failures e.g. power cuts,power surges etc. The home automation system must therefore be able to check and monitor the status of the controlled devices. Also the system must allow users to use these devices even if the automation link between these devices has broken down.
  • User InterfaceRequirements - A very important point is the ease of use of the system. The web page has to be intuitive and easy to use. Furthermore, it must be also taken into account that the home automation system can beusedby people with physical disabilities.
  • Data Requirements – The data for the Home Automation System will need to stored and accessed reliably and accurately.
  • Hardware Requirements – A flexible hardware arrangement will be desirable for adding new devices to the system.

These requirements will each be elaborated upon in the next Section 2.3 General and Non-Functional Requirements.

2.3 General and Non-Functional Requirements

This section will further expand on the overview of requirements listed in Section 2.2.

2.3.1Security Requirements

There are security risks associated with using the Home Automation System as it is designed to operate on a network like the Internet.When accessing the system the user needs to be assured that intruders, such as hacker attempts and third party invasions, can not have access to the Home Automation System. The user therefore needs to be confident that the Home Automation System is secure.The ability to authenticate user connections to the system is required.

To prevent unauthorised access the user has to log on to a website in order to have access to the Home Automation System. A secure system to validate the username and password information is required. The system will accept this information as proof of the identity and allow the user to access the Home Automation System.

2.3.2Performance Requirements

  • Speed of the Internet connection from the remote computer and the speed of the connection to the server will affect performance.The Home Automation System will be designed to be capable of operating even with slow Internet connections e.g. a standard 56K modem dial up connection to the network.
  • The Home Automation System will be designed to operate on a standard personal computer with a standard web browser installed. Response times to commands should be minimal from the browser.
  • The size of the website HTML & JSPcode should be minimized to improve performance on a slower connections to the Internet. The means minimising use of graphics and concentrating on a more functional design. This will be addressed in more detail in Section 2.3.3 User Interface Requirements section.
  • Efficiency of the software code will have an effect on how quickly commands to the system are given. Every effort will be made to design the code with performance in mind.
  • Hardware connected to the system may suffer from a latency factor between issuing of a command and when that command is carried out. This will be taken into account and may influence how fast the commands are processed within the system.
  • User Interface Requirements
  • The user interfaceof the Home Automation System should be intuitive and easy to use. We plan to provide a web-based interface for users to access the Home Automation System. This will enable users to use the system more easily, since it will be accessible through a common web browser from any computer connected to the Internet. This eliminates the need for installation and configuration of proprietary software.
  • The user interface will feature the use of meaningful graphics and icons, which will allow the user to easily identify options available. The number and size of these graphics, however, should be kept to a minimum to improve performance on computers with slow connections to the Internet.
  • As most people are familiar with browsing on the Internet the web based user interface should have a look and feel that is familiar to the user.
  • The user interface should consist of several windows and buttons to control the different control devices e.g. a lamp.
  • The user will be able to access the status of all devices that are currently installed and running on the Home Automation System.
  • The Administrator will be able to add/remove devices to the system. The administrator will also be view all users and their devices.

The proposed system will use a web-based Graphical User Interface, which will have the following characteristics:

  • Website – The user will be able to access the main website from any web browser.
  • Login screen – This will be the main entrance to the system. This will feature a pop-up screen and have two text boxes for typing the username and password.
  • Main Menu– Once the user logs in, a navigation menu will allow the user to select all options available from the main menu page.

2.3.4Data Requirements

The data for the Home Automation System will need to be stored and accessed in a reliable and accurate way. A database will store the username and passwords of several users at any one time. The database will also keep track of the number and recorded status of all available automated appliances.

Several text files will also be used to store initial start-up configuration details for the Home Automation System. The following table illustrates the data required;

Database Tables
Administrator Details
User Details
Device Details
Levels of Access

Figure 2.1 Data Requirements

2.3.5Hardware Requirements

The hardware requirements for the Home Automation System consist of acomputer controlled switching mechanism that will control the device to be automated.

Figure 2.2 PIC16F84A Microcontroller

This hardware is based heavily on the main chip on our project that is PIC16F84A .

Detailed Description : 16F84 A PIC The versatile 16F84 A FLASH/EEPROM microcontroller with its easy-to-learn instruction set (only 35 single word instructions) allows the same device package to be used for prototyping and production. In addition, with In-Circuit-Serial Programming™, the designer can update code without the device being removed from the end application circuit board. PIC 16F84 A contains 1024x14 word of FLASH program memory, 64 data memory bytes, and 68 bytes of user RAM. The device also features an 8-bit timer/counter with 8-bit programmable prescaler, Watchdog timer with its own on-chip RC oscillator for reliable operation, Power-On-Reset (POR) Power-up Timer (PWRT), Oscillator Start-up timer (OST) and a maximum speed of 10MHz. 16F84 fits perfectly in applications ranging from high-speed automotive and appliance motor control to low-power remote sensors, electronic locks, security devices and smart cards. PIC 16F84 A has 13 I/O pins and is available in the following package options: 18 PDIP(P), 18 SOIC(SO), and 20 SSOP(SS). PIC 16F84 Features 18-pin Enhanced FLASH / EEPROM 8-bit

Beside this chip we will use some simple elements if circuit such as capacitors and resistors etc. , We will use parallel port cable to send and receive data from chip to PC

2.3.6Software Requirements

  • During the stage of research, we use many software to integrate our project , thesed software varies from programming software to designing , to software for circuits , etc , these software names discussed before .

2.4 Constraints

There are several external and internal constraints associated with this project.

2.4.1External Constraints

  • Power Cuts - One of the external constraints is the possibility of unreliability of electrical power in the home. The system should be capable of operating and functioningcorrectly even after such an event has occurred.
  • Damage of devices :- this condition will be series condition and there is no way to know the status of the device in this condition .

2.4.2Internal Constraints

  • Software - The development of this project will be constrained to using the Java programming language and related APIs.
  • Functionality- The functionally of the Home Automation system will be constrained to operating on only leds that will act as the devices on home because the difficulties of high electricity and components that will cannot treate the high power .

High Level Design

Section 3 High Level Design

The overall design approach of the project will be object-oriented design using Java. The Home Automation System will be web based and use several server-side Java technologies .

3.1 System Architecture

The proposed architecture for the Home Automation System will be Client/Server based as the system will be accessed remotely and also accommodate several users at any time.

The use of server-side Java technologies like Servlets will provide a way to create a secure, thin-client, multi-tiered web application. These technologies are ideal as they can handle transaction and state management, multithreading, resource pooling, and other low-level details.

The diagram below shows a basic high level representation of the system.

Figure 3.1 Basic high level representation

3.1.1 Layers Architecture

The Home Automation System will feature a three-tier architecture.

  • Front-End layer: Client Side Graphical User Interface.

This layer will consist of static and dynamically generated web pages. Dynamic content will be generated by servlets.

  • Middle-layer: Web Server / Servlets.

This layer will consist of a lightweight web server such as Tomcat to handle user requests and responses.

  • Back-End layer: Database Server.

This layer will consist of an Access 2000 database which stores information about users and devices. Database access logic will use JDBC/ODBC & SQL to query, insert and update information.

3.1.2 Technology Architecture

The use of Java will extend the functionality of the web server. Each of the Java components will handle a specific request from the client. The web browser sends each online request to a web server where it will be processed. Using logic based on the type of request, the Java will query or update the database or text file as required and sends the necessary response to the user.

The following server-side components will be required;

  • Log In
  • Log Out
  • View Devices
  • Turn On/off Device

3.1.3 Project Architecture

The project architecture consists of four parts:

1)Client implementations: GUI (HTML & JSP generated code)

2)Server implementations: Client request handling.