BLUE LIte and Blue Heat

fiercebunΗλεκτρονική - Συσκευές

2 Νοε 2013 (πριν από 3 χρόνια και 10 μήνες)

117 εμφανίσεις


BLUE LIte and Blue Heat

Bluetooth enabled Smart Home Devices






Mark Shaw

and Giorgio

Politano


The Bachelor of Applied Computing/Diploma in Wireless and Telecommunications
Technology


University of Guelph
-
Humber


Dr.
Mieso

Denko





Submitted to th
e University of Guelph
-
Humber August 2008
2


Abstract

Home appliances such as security and climate control systems have become more advanced
with the recent improvements in microcontrollers and wireless technologies such as Bluetooth.

Most of these appliances

have difficult and complex user interfaces. However, by incorporating
smart phones and other Bluetooth enabled mobile devices, users can connect to the appliances
using their own existing communication device.


Although the automotive industry has taken

advantage of this in recent years with the development of Bluetooth enabled appliances in
many higher
-
end vehicles, such solutions for the home are
not commonly found. This thesis

will
outline the design and implementation of a system to interface with p
re
-
existing home
appliances and communicate with a mobile device such as a cell phone
, laptop

or PDA via
Bluetooth.
The application relies on the use of cell phones
,

personal computers

and
temperature

sensors to col
lect signals through a wireless
network
to provide users with a simple
interface to interact with appliances in the home.


3


Contents

Abstract

................................
................................
................................
...............................
2

Contents

................................
................................
................................
................................
3

1. Introduction

................................
................................
................................
.......................
6

1.1

Background

................................
................................
................................
.............
6

1.2

Motivation

................................
................................
................................
..............
7

1.3

Contribution

................................
................................
................................
............
7

1.4

Organization

................................
................................
................................
............
7

2. Literature Review
................................
................................
................................
................
8

3. Bluetooth enabled Smart Home Devices
................................
................................
.............

10

3.1 Problem Statement

................................
................................
................................
.....

10

3.2 Objectives

................................
................................
................................
...................

10

3.3 Development Tools

................................
................................
................................
.....

12

3.3.1 Bluetooth development board

................................
................................
...............

12

3.3.2 Microch
ip Inc. MPLAB IDE,
................................
................................
.....................

12

3.3.3 FlexiPanel Designer

................................
................................
...............................

12

3.4 Interface Design

................................
................................
................................
..........

13

3.4.1 User Interface Prototype

................................
................................
.......................

13

3.5 Software

................................
................................
................................
.....................

14

3.5.1 Pre
-
defined Toothpick Services

................................
................................
..............

14

3.5.2 Program Flow Charts

................................
................................
.............................

16

3.6 Hardware
................................
................................
................................
....................

16

3.6.1 Block Diagram
................................
................................
................................
.......

16

3.6.2 Bluetooth module with microcontroller
................................
................................
..

17

3.6.3 Bluetooth enabled smart phone
................................
................................
.............

17

4


3
.6.4 Honeywell CT50 Series analogy Thermostat
................................
............................

18

4. Implementation and Analysis
................................
................................
.............................

18

4.1 Interface

................................
................................
................................
.....................

18

4.2 Software

................................
................................
................................
.....................

19

4.2.1 Pre
-
defined Code

................................
................................
................................
..

19

4.2.2 Blue Heat Code

................................
................................
................................
.....

20

4.2.3 Blue Lite Code

................................
................................
................................
.......

21

4.3 Hardware
................................
................................
................................
....................

21

4.3.1 Temperature Control Circuit

................................
................................
..................

21

4.3.2 Lighting Control Circuit

................................
................................
..........................

25

4.4 Installing the Application

................................
................................
.............................

26

4.5 Runni
ng the Application
................................
................................
...............................

27

4.5.1 Interacting with the Interfaces

................................
................................
...............

27

5. Future Work

................................
................................
................................
.....................

28

6. Conclusions

................................
................................
................................
......................

29

Appendix A


Schematics

................................
................................
................................
......

30

Appendix B


Code Flow Charts

................................
................................
.............................

32

Appendix C


Blue Heat Code

................................
................................
................................

34

Appendix D
-

Cost

................................
................................
................................
.................

39

4.6.1 Blue Heat
................................
................................
................................
..............

39

4.6.2 Blue Lite

................................
................................
................................
...............

39

References

................................
................................
................................
...........................

40


5


List

of Figures

Figure 1
-

Bl
ue Lite/ Blue Heat Interface Prototype

................................
................................
.

14

Figure 2


Blue Lite and Blue Heat CPU User Interface

................................
............................

18

Figure 3
-

User interface on
Java phone
................................
................................
..................

19

Figure 4
-

Blue Heat Flow Diagram

................................
................................
.........................

32

Figure 5
-

Blue Lite Flow Diagram
................................
................................
...........................

33

Figure 6
-
Hardware Block Diagram

................................
................................
.........................

16

Figure 7
-

ToothPick 2.1 mechanical schematic

................................
................................
.......

17

Figure 8
-

Blue Hea
t Prototype
-

Circuit

................................
................................
..................

24

Figure 9
-

Blue Heat Prototype
-

Back

................................
................................
.....................

24

Figure 10
-

Blue Heat Prototype
-

Front

................................
................................
..................

24

Figure 11
-

Blue Lite Schematic

................................
....................

Error!
Bookmark not defined.

Figure 12
-

FlexiPanel Architecture
................................
................................
.........................

26

6


1.

Introduction

1.1

Background

Home automati
on deals with the specific automation requirements of homes and in the
application of automation techniques for the comfort and security of its residents. This can
include controlling the lights, climate control, control of doors and windows, security and

surveillance systems. There are currently several products on the market that allow home
owners to control these devices. This is normally controlled by a handheld remote that
communicates with the devices using a mesh wireless network or a wired networ
k. These types
of devices require a unique and dedicated device to communicate with the automated products.

One of the basic systems on the market is made by
iControl [9]
and is easy to ins
tall and
expandable. The system uses the 802.11 wireless protoco
ls

to transmit signals from the various
devices to
a

control box which is connected to the internet. Some of the devices the company
offers specifically for elderly care include: cameras, window/door sensors, motion sensors,
water sensors, freeze sensors,
panic pendants/wristwatches, smoke detectors, carbon
monoxide detectors, lamp modules, and thermostats. All of the devices are connected wirelessly
to the control box which then allows the devices to be monitored and controlled using the
companies website.

This system is perfect for the el
derly because it is easy to use and

it allows
family members to monitor the house to ensure that their relative is safe, it is portable and can
easily be installed in an exis
ting home. The major drawbacks of this system a
re that it requires
the use of several costly technologies to properly operate. The user must have internet access
available as well as a router to install the control box. The user must also have a mobile device
which has web access to check the status
of their home. This can become expensive with the
data plans mobile carriers offer today.

The automotive industry has also taken advantage of short range wireless technologies to
enable users to safely operate their vehicles while still making hands free

phone calls. Most
high
-
end vehicles produced after 2004 now come equipped with Bluetooth.
More than 30
automotive brands worldwide, including Audi and Land Rover, offer Bluetooth
-
compatible cars
.
Some cars come with Bluetooth
systems as standard equipme
nt while some offer it

as an

available

option
.

Chrysler's system, called UConnect, includes a rearview
-
mirror
-
mounted
microphone, a dash
-
mounted control pad and a hidden Bluetooth receiver. Acura's system,
called HandsFreeLink, is voice
-
activated, and call
er, signal and battery strength information
display on the instrument panel.

[11]
.

This system eliminates
hard
-
wired connections or docking
stations and

allows drivers to

operate their cell phones either through the car's controls or via
hands
-
free voice
activation.

The system then communicates back with you through your car’s
stereo and s
ome systems even automatically mute your car's audio when a call is answered.

These systems have proved to be a popular selling point as many countries are making it ill
egal
to use a cell phone while operating a vehicle. Although the automotive industry has shown a
7


dramatic increase in the use of Bluetooth technologies for ‘smarter’ cars, this implementation is
not widely found within the home.

Another key project is on
going at
The University of Florida

[10]. They have

built a 500 square
foot smart house that is designed assist and to provide medical care to
a
user.
The hous
e
implements devices including
a microwave that recognizes entrees and automatically
d
etermines h
ow long to cook them

and devices to track the individuals location within the
home. The house also uses devices to detect water on the floor and a camera that allows the
person to view who is at the door and let them in using a cell phone. The smart house
at the
University of Florida relies on a centralized computer network to deliver electro
nically
coordinated assistance.

1.2

Motivation

The research previously conducted

shows the importance of implementing home automation
for the elderly or disabled. Smart
homes allow them to stay in their residents where they feel
more comfortable and can prolong the time before having to move into costly health care
facilities. Smart homes will give the disabled an opportunity for independence that they may
not have had b
efore. The goal of this project is to design a system that communicates with a
mobile device such as a cell phone or PDA via Bluetooth.
The application relies on the use of cell
phones and inexpensive sensors and is best suited for the elderly and home
-
b
ound people. The
main functions of the project are to collect signals through a wireless sensor network using the
protocol Bluetooth and the analysis for data through an adaptive architecture.

1.3

Contribution

Two innovative products were produced called Blue

Lite and Blue Heat. Blue Heat is a Bluetooth
enabled thermostat and Blue Lite is a Bluetooth enabled light controller. Both of these
applications rely

on the use of cell phones

or

personal computers
, microcontrollers and
temperature control

sensors to c
ollect signals through a wireless network
to provide users with
a simple interface to interact with appliances in the home.

The devices produced enable the user to control the appliances using pre
-
existing devices such
as their mobile phone or home compute
r. The interfaces are intuitive and easy to use and
provide the user with a more accessible interface then those found in the home. The devices are
also very easy to integrate into existing applications and require only a small amount of
expertise to inst
all.

1.4

Organization

This paper is organized as follows. Section 2
is comprised of a literature review

which describes
pre
-
existing solutions
. Section 3 describes the prototype and desig
n of the system produced

and
section 4 describes the implementation and
analysis of
these systems. Future work and
expansions are discussed in section 5 and finally, section 6 gives the conclusions.

8


2.

Literature Review

The intr
oduction of home automation

in the 1970s failed to improve the lifestyles of users for
several reas
ons. Firstly, de
termining economic benefits of home automation

technologies is
difficult. The costs of implementing smart home technology must be justified by the effects
brought about by their installation

[3]
. There is a need for home automation

techn
ologies to be
cost effective, easy to install and flexible with many network infrastructures and appliances.

In 2003, Housing Learning & Improvement network published a smart home definition offered
by Interetec which states that a smart home is “a dwell
ing incorporating a communications
network that connects the key electrical appliances and services, and allows them to be
remotely co
ntrolled, monitored or accessed


[4]. The following section includes a brief
summary of previous research into smart home
s within the past decade.

In 1995, Welfare Techno
-
Houses were constructed in Japan. [7]. The purpose of these
experiments

was to provide health monitoring for elderly and disabled persons at home by
using fully automated measurements to support daily healt
h care and improve quality of life.
The University of Texas at Arlington has conducted the MavHome project over the past 7 years
[8]. The MavHome

(Managing an Adaptive Versatile Home)

is a home environment that detects
environment states through sensors
and intelligently acts upon the environment

though
controllers. The sensors in the home form an ad
-
hoc network with interconnect together to
make appropriate decisions.

SAP laboratories in Canada with researches from the University of McGill

[6]

present

a wireless
solution for monitoring people in need of medical assistance. The application relies on the use
of cell phones and inexpensive sensors and is best suited for the elderly and home
-
bound
people. The main functions of the project is to collect s
ignals through a wireless sensor network
using protocols like ZigBee and Bluetooth and the analysis for data through an adaptive
architecture that produces real
-
time heath
-
monitoring system to improve medical support for
people in their homes and in assist
ed living environments.

The research highlights a general architecture framework that consists of three major parts.
Firstly, medical data is collected from sensors and transmitted to mobile devices through a
wireless sensor network. Secondly, collected d
ata is processed by a J2ME application running on
mobile devices. Finally, the data collected and combined with data from other sensors to decide
on an appropriate action. The advantages of this approach are that it does not require costly
equipment, spec
ialized infrastructure or a challenging learning curve. It can be deployed in a
short period of time at a very low cost.


Several groups have done extensive research into the use of smart home devices for the support

or elderly and handicap people. The
U
niversity of Erlangen
-
Nuremberg, Germany

[5] has
described the challenges regarding smart homes, especially for supporting the elderly and
9


handicapped. The purpose is to compensate for handicaps and support the individual in order
to give them a more inde
pendent life for as long as possible.

A set of objectives is outlined that are of particular concern to an elderly or handicapped person.
The higher level goal is to compensate any limitations in any part of his life as far as possible and
to enable the

patient to live a more independent life as long as possible
.
Several sub
-
networks
were used in the implementation which includes Bluetooth, Wireless LAN, Radio Frequency ID
(RFID), Internet (TPC/IP) and the telephone network. A Bluetooth network is used

to
interconnect the nodes and to transport sensor data over the network. The RFID system
provides the possibility to transmit data from the RFID tags that are recording occupancy
locations. Their approach sends messages via Bluetooth using the available

Bluetooth module
on the nodes. This means no further hardware is required and additionally no further costs
arise.

A Similar system to the one proposed in this thesis includes research conducted by Engineering
students at the University of Bangladesh reg
arding the control of remote systems using mobile
telephony [15]. The paper focuses on the

services provided by mobile phones and how they can
be used to communicate with and control remote systems. A prototype was developed which
involves the use of two

mobile phones, a computer and
a Bluetooth module

or X10 controller

as
the hardware components. Software to facilitate the communication among the devices uses
the Java Standard Edition

(J2SE) and Micro Addiction (J2ME) and the C programming language.

The

system uses a Java enabled mobile phone running their application to send control
messages to the home. A second phone is connected to the home computer using a data cable.
Software running on the home computer monitors the home mobile

for incoming contro
l
messages and acts as an interface between the home mobile and the home appliance. When a
message is received, it sends commands
via Bluetooth
to communicate with the appliances.

The
key issue with this approach is that a computer is required to interface

between the home
appliance and the phone. The use of a microcontroller would be better suited to this type of
application as many are available with built in USB and Bluetooth support.

The paper

does however

reinforce

the advantages of using a wireless

standard. Bluetooth is a
global standard for connecting
a wide range of devices, it is available on most handheld devices,
the technology is very easy to use and set up, and it provides security by encrypting data using a
128
-
bit long shared key.

Radio
Frequency
(RF)
systems have become increasingly popular recently with the
advancements in
RF
technology such as Bluetooth and Zigbee. These products offer a much
more reliable short range network then previous Infrared devices which had interference and
s
ecurity issues
.
This project will also focus on RF systems for the smart home with focus on the
Bluetooth technology.

Although many systems have been researched and proposed, very few if
any have been implemented. This project aims to build on the previo
us research described to
10


implement a wireless sensor network to monitor appliances in the house. These appliances will
be controlled via a mobile device running Bluetooth. This approach provides an easy to operate
and cost effective approach that will be
nefit the elderly and those with disabilities function as
normally as possible.


3.

Bluetooth enabled Smart Home

Devices

3.1 Problem Statement

The focus of our research is on helping elderly or handicapped people live a more independent
life as long a
s possible.
The objective of our system is to take care of several domestic systems
that may normally be difficult for those who are handicap or elderly to take care of. The
proposed idea will allow a user with any Bluetooth enabled device to run a piece
of
downloadable software on any mobile device such as a cell phone or PDA. This application will
allow the user to control a device that is c
onnected to any home appliance that is Bluetooth
enabled. The focus of this application will be to direct a lighti
ng system and a climate control
system.

S
ensors will be connected to the hom
e appliances so that they can b
e monitored

and

controlled.

Suppose an elderly person who
has gone to bed and during the middle of the night becomes
uncomfortable with the tempera
ture of the house or hears a noise outside.

The p
roposed
system would enable the client

to

control the temperature by

turn
ing on and

the heat

or turning
on and off the air conditioning.

The user can
set heat or air to turn on

at a specified
temperature.


The user could also check the status of the outside light and
turn on

and off

the
light
with
out the
need to get out of bed.

These devices would also benefit users with limited mobility
that

may
have a difficult time getting to or even reaching their light

switch or thermostat
.
These
objectives require a large amount of technology.
The user

interface must be as simple and
powerful as possible and operate in a self
-
organized way.

3.2 Objectives

The following lists of objectives must be completed with this

in mind:

1.

Develop Bluetooth Appliance Controller:
A microcontroller will interface with the
Bluetooth module to perform the automation. A simple microcontroller will receive
signals from the cell phone and will be processed.


2.

Develop Software for a Bluetoo
th Enables Mobile Device:

An application will need to
be developed using the J2ME java platform for programs running on mobile devices
using the Java APIs for Bluetooth Wireless.

11


3.

Integrate the Appliance Controller to a Device:

The appliance controller need
s to be
integrated with
the lighting
/climate control

system
s

at a low cost with easy installation.

4.

Create a Scatternet with the
Appliance Controller
Devices:
Create ad hoc Bluetooth
network that is form
ed

by interconnecting devices. This allows every Blu
etooth device
to be reach
ed

by every other device. This is necessary due to Bluetooth’s short
communication range (10m
-
100m). This will enable the user to connect to a
ll

device
s

on the network without having to worry about distance form the device.

5.

Co
nduct Experiments and Analyse Data:

Using the mobile device and the appliance
controller, conduct tests on usability and product range within a home environment.

The user will require the following components:



Bluetooth enabled device



C
lient

Software



Bluet
ooth appliance controller

Two applications
will be developed

to run the light control ad the climate control devices. The
application should be
capable of running on several platforms.

An
application will be created

to
run on devices
such as mobile phone
s
, PDA’s and Blackberry devices.

To make the software
work on as many devices as possible, a
pplications will also be written to operate on Windows
Mobile clients as well as Bluetooth enabled Windows PCs.

The goal for this application is to
make it as robus
t as possible so that it can be run on many different
platforms.

Bluetooth wireless technology

will be used which

is a short range communications network that
was developed to replace cables that connect portable and fixed devices. Bluetooth is capable
of providing low power, low cost and robust communications between devices. The Bluetooth
standard has been globally accepted which allow almost any Bluetooth enabled device to
communicate with each other seamlessly. This make
s the Bluetooth standard bes
t suited

for
this type of installation.

A microcontroller will interface with the Bluetooth module to perform the automation.
Bluetooth modules have been developed

which combine Bluetooth wireless radios with
programmable integrated controllers

that inc
lude a full protocol stack that makes interfacing
with the host controller simple, without the need for Bluetooth expertise. A simple
microcontroller will receive signals from the cell phone and will be processed.

This will require
both software and hardw
are development to receive data from the cell phone via Bluetooth to
perform the tasks.

A device that would turn

on and off a light

will be developed that

would use a simple relay to cu
t
the power
to
an LED to simulate a light fixture in the home. Anoth
er device will be used that
12


has a
feedback controller

circuit

with a small fan

and a
thermistor
. This

will simulate

a heating
and air conditioning thermostat in the home.



Quantitative results will compare our work with previous work and will highligh
t how our
application works better. Some key factors for the evaluation will include performance, quality
of service, ease of use, and how the product makes the lives of people easier and better.
Maintaining and enhancing the quality of life for both old
er people and people with disabilities
involves making independent living as easy as possible.

3.3 Development Tools

The first step in beginning the design and development of our product was to find the tools
necessary to accomplish the tasks. The fol
lowing is a list and brief description of software used
and why each product was selected.

There are four

main components that will be needed to accomplish our project. These include

a
Bluetooth module with microcontroller,

a Bluetooth development board, a

Bluetooth enabled
smart phone

and software development tools.

After extensive research into the products
and solutions currently
available, the following were
chosen to meet our application
-
specific requirements.


3.3.1
Bluetooth development board

The p
rimary aim of the Bluetooth Evaluation Board is to allow evaluation of Bluetooth products
as easily as possible.
T
he evaluation board can be used during development as a reliable, tested
environment while troubleshooting.

This board was selected to help a
id in the development of
applications and

testing of the device. It was later
replaced with custom elec
tronics once the
final device was

ready for production.

3.3.2
Microchip Inc. MPLAB IDE,


This development interface
is a free, integrated toolset for t
he development of embedded
applications employing Microchip's PIC

microcontrollers. MPLAB IDE runs as a 3
2
-
bit application
on MS Windows
, is easy to use and includes a host of free software components for fast
application development and debugging. MPLAB I
DE also serves as a single, unified graphical
user interface for additional Microchip and third party software and hardware development
tools. Moving between tools and upgrading from the free software simulator to hardware debug
an
d programming tools is ac
complished easily

because MPLAB IDE has the same user interface
for all tools.

For these reasons, we selected this IDE for the development of the backend code
for the mobile applications. [13]


3.3.3
FlexiPanel Designer
,

This graphical user interface des
ign tool
is a free is software

bundle

to aid in the design of
FlexiPanel user interfaces. The user interface may be specified and tested from within the design
tool and then exported to a specific FlexiPanel Server. FlexiPanel is a generic technology for
a
llowing one device (the FlexiPanel Server) to create a user interface on another device (the
FlexiPanel Client). It provides a wireless universal remote control and monitoring facility for
13


computer software and electronic products, eliminating the need for

user interface
components.

[14]


T
hese

intergraded development environments

allow us to design and develop applications to be
used on smart phones w
hich will communicate with the B
luetooth device. There is also
extensive documentation and help guides and
examples to help guide us through the
development process.

3.4 Interface Design

Two graphical user interfaces were developed, one called Blue Lite and the other called Blue
Heat. Blue Lite will control the lighting system while Blue Heat will control the
climate HVAC
system. The user interface was developed to allow the applications to be run on several
common mobile platforms. The FlexiPanel Designer software was used to create simple yet
intuitive user interfaces. The interface was first developed to p
roduce a more user friendly
product.

3.4.1 Functional Requirements

The goal was to develop a robust application which would allow a user to turn on and off a light
or adjust the climate controls of a thermostat within range of the mobile device. The applic
ation
required both user input and feedback which takes user input and sends a signal to the
Bluetooth module. The module then performs the desired action and returns a response to the
application.
The applications also needed to be memory and processor c
onscious as both these
factors are often limited on most mobile devices. Also, the interface is stored in a client/server
architecture where the code for the interface is on the module and is downloaded to the mobile
device when user connects. Creating an

interface that is too large results in increased download
time and this needed to be avoided. With these factors in mind, the initial prototype of the
application was produced.

3.4.2 Non
-
Functional Requirements

The interfaces needed to be simple so that
it could still be used by customers that were not
technically savvy. The end user may be someone very familiar with mobile applications or it may
be an elderly person who is new to the technology. The goal was to produce a product that
would be easy to us
e for all users while still maintaining an atheistically pleasing interface which
was similar to the common look and feel of other mobile applications.

3.4.1 User Interface Prototype

Figure 1 shows the prototype design for both the Blue Lite and Blue Heat

user interfaces. The
initial design had to keep in mind the functional and non
-
functional requirements listed above.

Figure
1

-

Blue Lite/ Blue Heat Interface Prototype


3.5 Software

As mentioned earlier, the Bluetooth modul
e uses a PIC microcontroller created by Microchip
Technology. They provide a simple development interface called MPLAB which can be used to
write software for the microcontroller. Using the pre
-
generated code from the design software
which takes the user

interface objects and creates C code, the backend code was written to
communicate between the user interface and the electronic devices. All the development was
done using the C programming language.

3.5.1
Pre
-
defined Toothpick Services

Several Toothpic
k services are preinstalled in the module in protected memory which helps aid
in programming for the module
.
Several of these functions were used in generating the
backend code and are explained in detail below:

Digital I/O

The microcontroller allows for
all the pins, except for power and ground to be used as single bit
digital input/output pins provided they are not already used for another function. For both
appliance applications, several outputs were used to allow the microcontroller to trigger a rela
y
which would allow the light and or HVAC to turn on and off. The built in functions provided by
the Toothpick services makes using this pins very simple and only several lines of code are
required.

Analog I/O

The microcontroller supports up to 12 channel
s of 10
-
bit and 8
-
bit analog to digital conversion.
Code definitions provided by the Toothpick services makes using these very simple. The A/D
15


converter was utilized to enable the Blue Heat application to read an analog temperature value
from a thermisto
r circuit and convert this value into a temperature reading. The thermistor
circuit provides a value ranging between 0


5V which is fed into an input pin on the
microcontroller. The A/D converter then takes this voltage and returns a value to the
applic
ation between 0
-
255 depending on the voltage. The thermistor provides a specific voltage
per degree change and this information was used to then convert this 8 bit number into a
corresponding temperature.

LinkMatik Control

These set of controls lets the
program access the LinkMatik Bluetooth radio directly. It is
connected to the
universal asynchronous receiver/transmitter

port of the PIC microcontroller
which interfaces the radio to the microcontroller. These services pre
-
installed in the module
allowe
d us to communicate with the radio easily to perform tasks such as connecting and
disconnecting from the remote device and putting the Bluetooth radio into an

aggressive power
saving mode.
The radio r
eturns to normal power mode when a command is give or a
Bluetooth
event occurs
. This state is entered when the module is not connected to a remote device to
help conserve power.

Call
back Functions


When an event occurs and the Bluetooth module needs to inform the application that
something has happen, it ca
lls one of the provided call back functions. The cal back functions
provided include the following:




Error Status


this is called if an error occurs and several error codes are provided by the
modules services. These error codes were used extensively to

de
-
bug the application
and code has been written to halt the application if an error has occurred.




LMTEvent



called when an event occurs on the LinkMatik module. These events are
described above in the LinkMatik control section and deal with connectin
g and
disconnecting the remote devices.




FXPEvent

-

called when a FlexiPanel interface event occurs, such as a button being
pressed. This event handler was used to trigger the application that the user had
interacted with the interface and the appropriat
e action is taken based on the input.


The module provides many other services and pre
-
written functions including pulse width
modulation, parallel communication protocols and many others but these were utilized for our
application.

16


3.5.2 Program Flow Ch
arts

Two program flow charts were created for both the Blue Heat and Blue Lite applications main
code. These flow charts explain the logic of the code and how each component interacts with
the others. Please see Appendix B.

3.6 Hardware

The following i
s a block diagram of the components used and a detailed description each block
used and why each product was selected. The diagram shows the 3 major components used for
the project. Those items in yellow were purchased and those in red were designed and cr
eated
to work with the off the shelf components.

3.6.1 Block Diagram


Figure
2

-
Hardware Block Diagram

17


3.6.2
Bluetooth module with microcontroller

The
ToothPick

2.0 Bluetooth Transceiver combines the PIC 18LF67J10 programmable in
terface
controlled
microcontroller and

the

LinkMatik (
Bluetooth 2.0) radio device and was purchased for
this project. The microcontroller comes p
reloaded with Toothpick Services firmware

which
includes

Fl
exiPanel user interface server which allows the dev
eloper to create intuitive graphical
interfaces to communicate with the Bluetooth module. It also comes packaged with a
wireless
field programming
tool which allows the software to be electronically distributed and uploaded
to the microcontroller using th
e Bluetooth protocol.



Figure
3

-

ToothPick 2.1 mechanical schematic

This device was chosen because of several key features. This module provides a FCC/CE certified
2.4GHz Class 1.0 Bluetooth radio which provides a free space ope
rating range of 100 meters
with an integral antenna. The device is very small in size with the L x W x H measuring
51mm ×
22mm × 10mm

and requires a low regulated voltage of only 5 volts. It draws a limited current of
30mA during transmission and is capa
ble of going into sleep mode where it only draws several
hundred micro Amps. These features make it the ideal solution to easily integrate into existing
home appliances.

3.6.3
Bluetooth enabled smart phone

There are several phones on the market currently
that employ
Bluetooth

technology. Most
major high

and low

end phones are capable of working with this type of application.

For the
18


testing and implementation, the Nokia 6265i handset was used. This phone provides Bluetooth
wireless technology support with

an integrated class 2 radio with a transmission range of 30
meters.
This device is compliant with Bluetooth Specification 1.2 and

it

support
s

several profiles
for communication [12]. This phone was chosen because it provides the tools needed to load
and

test our mobile application.


3.6.4 Honeywell CT50 Series analogy Thermostat

In order to test the temperature control circuit, we required the use of a commercially sold
thermostat. We choose the Honeywell CT50 because it provides a simple analog interf
ace
which we were capable of manipulating in order to connect and test our Blue Heat temperature
control system.

4.

Implementation and Analysis

4.1 Interface

Once the template was produced, it was time to use the FlexiPanel development
tool to
generate t
he interface.

FlexiPanel Designer manages the list of controls that are to be displayed

to the user
.

The software package provides v
arious views to control different aspects of the
controls, such as how they are
managed and
how they appear on specific cli
ent software.

The
application was

written to
work across several clients including a

Windows PC and
a mobile
phone

runni
ng java and the interface was

modified for each type of client.


For the Windows PC client, once you connect the computer to the module
, the user interface is
displayed as shown in the development tool. Since a Windows PC can provide more processing
power, a more advanced user interface was created and shown below.







Figure
4



B
lue Lite and Blue Heat
CPU
User Interface

19


The Java phone user interface is greatly limited to the graphics and processing power of the
phone being used. For this reason, the interface is displayed as a simple list of controls which
can be modified by the
user.

The client can use the scroll functions of their phone to traverse
through the list and use a select button to interact with the controls.

This interface resembles
common applications for mobile devices which should be
very familiar to the user. The

following image shows how the user interface appears on a mobile phone.


Figure
5

-

User interface on Java phone


Once the user interface was designed, it can be programmed into the Bluetooth module but the
controls are not yet i
nteractive because only the interface is generated at this point. The
Toothpic
k

MPLAB modules are automatically generated by the designer software which
produces .C and .H files. These files provide code which enables the use of the controls on the
inter
face. An application was then generated using MP LAB to interact with the application. The
following section outlines the backend code that was written.

4.2
Software

The backend code

that we produced

for the applications is explained in the
next section
.

The
code flow
charts will help
describe

the

flow of the code
.

Both the applications for the Blue Lite
and Blue Heat modules were written in C using the MPLAB IDE.

The software produced utilizes
many of the built in functions described above as well user

defined methods.



The application consists of several classes which will be discussed in detail in this section. The
first
section describes

the code produced by the interface design s
oftware and several header
files which must be included. T
he second s
ection describes code we produced.

4.2.1 Pre
-
defined C
ode

There are two files called Blueheat.c and Blueheat.h

that is produced by the FlexiPanel design
software for the user interface.

A custom application was

being developed using MPLAB C18

so
the user

interface is transferred to
the Bluetooth module as

computer
-
generated C files which
are included during compilation
. This takes the interface that was designed for the applications
and converts it into C so that it may be stored on the Bluetooth module.

There was no need to
modify the C code. The BlueHeat.h file is also generated and gives access to several predefined
methods which allow the user interface to be controlled and manipulated. This includes
20


methods to get values from text boxes, set value
s in number fields and retrieve alerts when the
interface is modified by a user.

Two other files that are utilized are called Toothpick.h and PIC18F6720.h. The first file is a

header file provided by FlexiPanel and is specially written for the Bluetooth m
odule used for this
project. It was not modified and must be included in the project package.

The second file is

a
header file which is included in the MPLAB C18 compiler and
is specifically written for the PIC
microcontroller and is written and supplie
d by Microchip Technology. It must be included in
order to use the microcontroller and includes methods to perform low
-
level tasks. This code was
not modified and must be included in the project package.

4.2.2
Blue Heat
Code

The

main application called m
ain.c

starts by waiting for a client to connect. It will continue to
loop through a while loop waiting until a client has connected. During this time, the green LED
on the Bluetooth module is set to flash every 250ms to indicate that it is ready and wait
ing for a
connection. When a connection is made by a remote device, a high
-
level interrupt is thrown
and the user is connected to the module. When this occurs, the red LED on the module is set on
to indicate a user has connected.

Once a user has connect
ed the main loop continues by reading a value from

one of

the analog
input
s

and setting up the Analog to digital converter.

The value from the input is fed into the 8
bit A to D converter which then returns a value between 0 and 255. This is a digital
re
presentation of the value being fed into the microcontroller by the thermistor. This number is
then converted into a temperature value in degrees Celsius.

The value from the user interface is then read into memory which represents the desired
temperature
. A get method is provided in the BlueHeat.h file to get this information from the
textbox. The code then checks to see if the user has selected the heat and AC buttons on the
us
er interface. When the user clicks on one of the buttons in the interface,
a low level

event is
triggered. Within this interrupt handler, a value cal
led SetH or SetAC is set to 1 depending on
which button was selected and the code returns from the interrupt handler.

If the heat button was pressed, setH will be set to high. IF t
his condition is true, a specific pin on
the microcontroller is set to high which triggers the relay to switch to activate the heat control
and another pin is set to low which deactivates the AC control. This is done because the Heat
and AC cannot be turn
ed on at the same time. The opposite occurs if the AC condition is true. A
pin on the microcontroller is set to high to activate the AC control and the heat control is
deactivated. This process simulates the user manually switching the AC or Heat on usi
ng the
thermostat.

Next, the value read from the analogue to digital converter which represents the rooms current
temperature is compared against the desired room temperature inputted by the user. If the
heat has been activated and the desired room temp
erature is greater than the current room
21


temperature, a pin is set to high on the microcontroller which
will trigger a relay to turn the heat
unit on and start heating the room. If the desired room temperature is less than the current
room temperature, th
e heat is turned off. If the AC has been activated and the desired room
temperature is greater than the current room temperature, the AC is turned ON

by setting on of
the microcontr
ollers pins to high. If the desired room temperature is less than the cur
rent room
temperature, the AC is turned off.


This process is continually repeated to cycle on and off the HVAC unit as the room temperature
changes. A temperature threshold of 1 degree Celsius is used to keep the current room
temperature within 1 degree

of the user’s desired temperature. This means if the user has
selected 25 degrees, the room would heat until it reached 26, shut off and naturally cool until
the temperature reached 24 degrees. The heat would then be activated again and the process
cont
inues.





4.2.3 Blue Lite Code

The code starts by waiting for a client to connect. It will continue to loop through a while loop
waiting until a client has connected. During this time, the green LED on the Bluetooth module is
set to flash ever
y 250ms to indicate that it is ready and waiting for a connection. When a
connection is made by a remote device, a high
-
level interrupt is thrown and the user is
connected to the module. When this occurs, the red LED on the module is set on to indicate a

user has connected.

Once a user has connected the main loop continues

by monitoring the on off button provided in
the user interface. When the user selects the button, a low level interrupt is triggered. In this
event handler, a value called setLight i
s set to 1 which indicates the button has been pressed
and the interrupt returns back to the main code. If the value is set to 1 then one of the output
pins of the microcontroller is set to high to switch on the light. If the value is set to 0 then the
o
utput is set to low to switch off the light.

The source code for both applications is included in
the appendix.

4.3
Hardware

The next step
was

the

development of the electronic components for both of our products.

Two
separate components were created

fo
r each of the devices and are described in detail below.
Please see Appendix A for the schematics of both this devices.

4.3.1
Temperature Control Circuit

The temperature control circuit is designed to be interfaced with any existing analog thermostat
wit
h very little modification. The control circuit replaces the functionality of the thermostat by
mimicking the same functionality

but using digital signals
.

The Blue Heat module can be placed
near the existing thermostat to work with it or is capable of com
pletely replacing your analog
device.

22


The Bluetooth module is

mounted on a circuit board

inside the protective casing

and is powered
by a single 9V battery.

Since standard manual thermostats do not receive any power, an external
power source was needed. T
his means the battery will need to be replaced periodically by the
user. The LM7805 5 volt power regulator

is used to regulate the 9 volts

being supplied by the
battery to a

5

volt DC

input

required by the

microcontroller.

Temperature

Sensor

A typical ana
log thermostat uses
two different thermometers. One on the front cover to display
the temperature and the other in the
thermostat

controls the heating and cooling systems. These
thermometers are
simply

coiled bimetallic strips

that consist of two material
s with different rate of
expansion and when they heat and cool they expand and contract
.

To replace this
mechanism, a
thermistor was

used to read th
e temperature. A thermistor is a type of resistor with varying
resistance according to temperature. The s
ensor uses a platinum material which has a
predicable electrical resistant change with varying temperature. The advantages of this type of
temperature sensor are its low cost, compact size and fast response time to vary temperatures.
A single thermostat
can be used to control the HVAC system as well as to display the current
temperature to the user.

A voltage divider circuit was created which is a simple linear circuit that produces a portion of the
input voltage across the component. The termistor produ
ces a resistance of 4.7K ohms at 100
degrees Celsius

so it was paired with a 4.7K resistor in series to create the voltage divider. The
voltage reading being dropped across the circuit is directly proportional to the current temperature

and produces a val
ue between 0 and 5 volts
.

One of the major

problem
s with a thermistor is the
variation in

measured temperature over the temperature range.

This means the resistance vs.
temperature curve is not non
-
linear which made it very difficult to convert the readin
g from the
temperature sensor to a temperature.

Usually the resolutio
n is good at lower temperatures

but

becomes very

poor at higher temperatures.
To fix this problem

a resistor

was placed

in parallel
with the thermi
stor. The resistors value is

equal

to

th
e thermistor's resistance a
t the mid
-
range
temperature. This

resul
ted in

a significant reduction in non
-
linearity
. This means that there is now
a consistent voltage change vs. temperature curve.

This value is then fed into the analog to digital
convertor
on the microcontroller where it is changed into a digital reading.

Internal Operation

There are several situations when switching done by the thermostat. Switching occurs when the
user turns on or off the heat and air conditioning and when the HVAC cycle
s on and off
depending on what the room’s ambient temperature is.

S
everal relays are used to replace
these
switching capabilities
.

There are four terminals on a thermostat that need to be connected and
disconnected. The transformer on the heating and air

conditioning unit provides 24V AC from a
transformer. This is then carried through the thermostat and depending on the settings and
temperature
conditions;

the voltage is carried to the relay on the HVAC unit to turn on and off the
system.

The Omron G
5V
-
2

relay was selected that is capable of switching up to 125VAC with a load up to
2 amps. This is more than what is required as it will be used to switch the 24VAC coming from the
transformer. The relay is capable of being triggered with 5V which will be pro
vided by one of the
microcontrollers outputs. Some other benefits of the relay are that it provides a fully
-
sealed case,
23


has an operation response time of only 7ms and has a life expectancy

of over 15 million
operations. In order to protect the microcont
roller, a diode was placed in series with the switching
voltage line from the microcontroller to the relay
.

Current flowing through a relay coil creates a
magnetic field which collapses suddenly when the current is switched off. The sudden collapse of
the
magnetic field induces a brief high voltage across the relay coil which is very likely to damage

the microcontroller over time
.

Interfacing with Thermostat

The unit will work with a typical thermostat that is designed for a system with four wires. The wi
re
terminations from the control circuit are marked as follows:



RH

-

This wire comes from the 24VAC transformer on the heating system.



RC

-

This wire comes from the 24VAC transformer on the air
-
conditioning system.



W

-

This wire comes from the relay that t
urns on the heating system.



Y

-

This wire comes from the relay that turns on the cooling system.


To integrate the Blue Heat control unit with an existing thermostat, the user must connect the
clearly labeled wires from the control unit to the matching co
n
nectors inside the thermostat. This
will enable the user to control the HVAC unit using the thermostat as well as the Blue Heat
device. The Blue Heat circuit is wired in series with the existing thermostat. The thermostat can
be used normally at any time

while the Blue Heat device is in the off state. If the Blue Heat
device is in the on state, and left in this state, the user will not be able to manually shut it off until
the state is changed to off.

The entire unit is housed inside an atheistically p
leasing plastic housing which is made by Pactec
Enclosures. It was chosen because it can be mounted on the wall under an existing thermostat
or in place of an existing one. The housing is completely sealed and all the electronics are
hidden inside the ca
sing which is held together using 4 screws. The unit can be easily serviced
and the entire control circuit inside can be removed if need be. Also, a small door on the back of
the unit provides easy access to the battery for when it needs to be replaced. A

blue and red led
are located on the front of the unit to indicate to the user the current state of the HVAC unit. The
red LED is used to indicate if the heat is on and the blue LED is used to indicate if the air
conditioning is on.

Product Results

The n
ext section shows the final product for the Blue Heat device which is i
llustrated in several
pictures. Figure 8 shows a top view of the prototypes circuitry inside the housing. You can see the
battery compartment on the left which holds a standard 9V batte
ry. This is accessible though a
small removable door on the back of the enclosure as shown in figure 9. The right side of the
housing holds the circuitry and is isolated from the battery compartment.


2
4



Figure
6

-

Blue Heat Pro
totype
-

Circuit


Figure
7

-

Blue Heat Prototype
-

Back


Figure
8

-

Blue Heat Prototype


Front

25



4.3.2
Lighting Control Circuit

The lighting control circuit is designed to be interfaced with an existing
light switch within the
wall electrical box unit. The circuit can easily be wired into a switch box to allow both your light
switch and your Bluetooth enabled device to cont
rol the operation of the light. In order to
simulate the mechanical switching of
a light switch, a special type of relay was needed. The
relay needed to be capable of switching 1
1
0VAC power source found in North
American h
omes
as well as handle up to 10A of current. The relay also needed to be

triggered with a 5V input
from the micro
controller but still protect it from power spikes and surges which may occur on
the power lines.


Internal Operation

I
n order to accomplish this,
the Omron G3NE solid state relay

was used.

A solid state relay
(SRS) acts as an electronic switch but contain
s no moving parts. The re
lay we chose is a photo
-
coupled which means it uses a light emitting diode (LED) to activate a photosensitive transistor to
switch the load. They key
benefits to this type of relay are

that it can be controlled by a low
voltage sig
nal from the microcontroller and physically isolates the controller from the load
optically. It also has built in protection against external surges.

A 9V battery is used to power the microcontroller which is converted to 5V using another LM7805
voltage r
egulator. The idea setup would use an AC transformer to convert the 110VAC coming
from the power lines to a manageable 6VDC supply to run the microcontroller. This was not
chosen because it requires a much more complex system but will be discussed in the

future work
section.

The lighting control circuit is wired in series with the existing light switch to enable them both to
operate at the same time. In order for
either one of the two switches to operate, the other switch
needs to be in the on position.

The user can leave the Bluetooth control operating as on and still
manually switch on and off the light using the physical switch. Likewise, the user can leave the
switch in the on position and switch the light on and off using the mobile device. Below
is a
detailed schematic of the light controller circuit.



Product Results


26


4.4
Installing

the Application

The FlexiPanel server

which is installed on the module

allows remote device
s such as Windows
PCs, handheld devices

and cell phones to display
user interfaces
that are stored on the server
. It
uses the FlexiPanel Bluetooth Prot
ocol to transmit the user interface

to the remote device. The
remote device needs to run the FlexiPanel Client software which is freely available

for both
pocket PCs and Wi
ndows operating systems.
The Client software does not req
uire
customization, since the user interface

specifications are stored on
the Bluetooth module

and
transmitted to the
mobile
cli
ent when it connects. The module

is not concerned about the type
of cli
ent
which connects and
it treats them equally.
The user interface

is compiled using
FlexiPanel Designer software
.



Figure
9

-

FlexiPanel Architecture


FlexiPanel Client
s connect to FlexiPanel servers and a

client may c
onnect to
a server at any time.

The client is the module installed in the home appliance controller and the client is a remote
device such as a pocket PC or PDA.

Once the

client has made

connectio
n to the server via
Bluetooth
, the server tells the
client to display
th
e desired user interface on its
display.

The
server may modify the contents and

appearance of the controls at any time, and even

replace
th
e entire ‘dialog’ with another.
If the
cl
ient m
odifies a control, for example
pressing a bu
tton, it
sends a message

to the
FlexiPanel Server.

Either the server or the client
may choose to

disconnect at any t
ime.


Additionally, the link may be dropped if the devices go
out of range of each

other. The state of
the controls is retained by the

server so that if the client

reconnects, or another

client connects,
the user interface will be in the

same state as it

was when it was last modified.
The application
was
designed taking in
to account the possibility of a
dropped connection.

This was
accomplished by making sure that n
o action would

be taken which relies on a client’s ability to

maintain a connection. If
the connection is dropped,
the application

will store the current values
and continue to operate.


27


Wireless field

programming (WFP)

was used which is a service that

al
low
s the developer

to
program Toothpick via Bluetooth.


A separate Windows software application

is used for wireless
field programming. The program is also able to create Service Packs

which are specialized
executable files

for either Wi
ndows and/or Pocket

PC which

can

be

distribute
d

to allow
custome
rs

to upgrade the

application

themselves.

This application is used to pair with the
Bluetooth module and transmit the application via the Bluetooth wireless protocol to the
module to be stored in memory.


4.5 R
unning the Application

To run the application, the user must download the client software on the mobile device

or PC
.


To install

the application on a java phone follow the steps below:

1.

Download FlexiPanel.jar from

http://www.flexipanel.com/WirelessSoftware.htm
.

2.

Transfer the file to the phone using Bluetooth

file transfer
, infrared or your sync cradle.
You

need consult your computer and/or phone

manual to find out how to do this. Try
right

cl
icking

on the FlexiPanel.jar and choosing one

of the
Send To
options.

3.

The phone should automatically detect that the

file is a
Java application and install it
automatica
lly. Depending on the phone you
have, you may

be warned that the software
is
not certif
ied.

Acknowledge this and continue.

On
start
-
up
, the client application will automatically
search for dev
ices to connect to. After a few
seconds, a list of avai
lable Bluetooth devices will be
shown.

The applications will be labelled
‘Blue Heat’ and ‘Blue

Lite’ on your phone.
Select the

device you wish to connect to.
If

the

expected device
is not displayed, scan again by
selecting Options > Refresh from the menu.

The client application for Windows requires a built in Bluetooth radio or external dongle to
o
perate.
To install the application on a Windows PC, follow the steps below:

1.

Download
the Windows Remote Client FlexiPanelWin30.exe from
http://www.flexipanel.com/WirelessSoftware.htm
.

2.

The clien
t software is a standalone application and requires no additional installation.
Simply click on the saved file to begin using it.

4.5.1 Interacting with the Interfaces

When you connect to one of the devices

using a phone or pocket PC, the

controls are

d
isplayed
on the scr
een in a list.
Once a connection is established, the controls will

be displayed
and can
be
used by the client. Depending on the phone being used, the application will appear slightly
different. To interact with the button controls, sim
ply scroll to the button icon using your
mobile phones navigation

keys
and select the button using the designated button on your
phone.

To interact with text controls, scroll to the text icon using your mobile phones
28


navigation keys and select the text co
ntrol. Then us the mobiles keypad to enter the value and
press select.

To interact with the interface using a Windows personal computer, use the mouse pointer to
hover over the desired buttons and left click on the button icons to activate the controls.

To use
the text box control, select the text box with the mouse, use the keyboard to input the value,
and press the OK button to update the field.

5
.
Future Wor
k

Although the final products were very successful
at accomplishing the objectives
, it must b
e
kept in mind that the products produced are simple prototypes and much more work would
need to be done to create a marketable product. Several areas that need to be improved are
the size of the devices, the cost

of the devices, the power sources used

an
d the range of
communication.

Currently, the Blue Lite device is too large to fit easily into a pre
-
existing wall switch electrical
box
. There are several ways this could be improved in future work. The use of surface mount
components would dramatically
decrease the overall size of the components. Surface mount
components are also often less expensive as they require less material to produce.
For example
FlexiPanel
offers the Toothpick microcontroller in a surface mount package for $91.50. This
would h
elp reduce the overall cost of the devices as well as the size.

Another area to help
improve the size is the circuit board that is used. Currently for the prototype, a generic
breadboard style board was used. If this device were to be commercially produ
ced, a more
compact circuit board could be designed.

The overall cost of the devices is also a major area of concern. One of the key reasons that
smart home technology has failed to be implemented in the home is the cost to benefit ratio.
Currently, wit
h each devices prototype costing over $150, it is difficult to justify the cost to the
end user. There are several reasons for the high cost of the devices but the main reason is that
every one of the components used was purchased through a middle supplie
r in limited
quantities. The cost would be dramatically reduced if the components were purchased through
the manufacture in higher quantities. Cost savings of over 400 percent can be made simply by
purchasing in bulk. For example, the LM7805 voltage regu
lator used in both applications was
purchased for 47 cents each. If the order was increased to 10,000 components, the unit price
drops to only 11 cents.


The power sources used for both applications rely on batteries to power the devices. This is a
majo
r issue for two reasons. Firstly, the running costs of both devices increases as the user
must purchase and replace batteries to keep the device operational. Secondly, the device is not
always easily accessible, especially for those users with impairment
s. This could be improved by
using the existing power source, especially with the Blue Lite device which could use the 110V
29


AC source already being used to power the device. Several digital thermostats also have a power
source being provided that could be
tapped into to power the device.

The last area of improvement is in regards to the range of the devices. The radio being used by
the devices is a Class 1 Bluetooth radio which has a rage of up to 100ft. However, most mobile
phones today us a Class 2 Blu
etooth radio which has an operational range of only 30ft. This
limits the users range and requires that, if a mobile device is used, you must be within line of
sight of the appliance. A solution is to use a home computer with a Class 1 Bluetooth dongle t
o
access the devices that are
at a farther distance. Test results indicated that the user had a range
of over 80ft in this type of application and could easily control devices in other rooms and on
other floors of the house.

6. Conclusions

The goal of t
his paper was to outline the design and implementation of a system to interface
easily with pre
-
existing home appliances and communicate with a mobile device such as a cell
phone, laptop or PDA via Bluetooth using a simple interface. Two innovative produc
ts were
produced called Blue Lite and Blue Heat. Blue Heat is a Bluetooth enabled thermostat and Blue
Lite is a Bluetooth enabled light controller. Both of these applications rely

on the use of cell
phones

and personal computers

and inexpensive sensors t
o collect signals through a wireless
network
to provide users with a simple interface to interact with appliances in the home.

The devices produced enable the user to control the appliances using pre
-
existing devices such
as their mobile phone or home comp
uter. The interfaces are intuitive and easy to use and
provide the user with a more accessible interface then those found in the home. The devices are
also very easy to integrate into existing applications and require only a small amount of
expertise to i
nstall.

Our research shows the many types of applications for implementing home automation and the
applications are not limited to those discussed in this paper. The technology used could be
implemented in a wide variety of applications that require t
he use of sensors and appliances.
This project successfully designed a system that communicates with a mobile device such as a
cell phone or laptop via Bluetooth to control a thermostat and a light switch but has many
possible applications that could bene
fit from this work.



Appendix A


Schematics


Blue Heat
Schematic

Diagram

Blue Lite
Schematic

Diagram


32


Appendix B



Code Flow Charts

Blue Heat


Figure
10

-

Blue Heat Flow Diagram

33


Blue Lite


Figure
11

-

Blue Lite Flow Diagram

34


Appendix C


Cod
e

Main.c

#include "Toothpick.h"

#include <p18f6720.h>

#include "BlueLite.h"

rom unsigned char * szOn = "ON
\
r
\
n";

rom unsigned char * szOff = "OF
\
r
\
n";

unsigned char * zero = 0;

int set = 0
;


void main( void )

{




//if no BlueMatik, flash red led rapidly


while ((ToothpickSemaphores&TPSF_LMTEXISTS)==0)


{



LedRed = ~LedRed;



msDelay(50);


}


FxPCommand( FxPC_Start, 0, 0 );


AwaitLMTComplete();



// main loop


while ( 1 )


{



// Flash LE
D to show we're alive



LedGreen = ~LedGreen;



msDelay( 250 );








} // end of while ( 1 )


}


// HighInterrupt handler
-

nothing needs to be done

void HighInterrupt (void)

{

}


// LowInterrupt handler
-

only thing to do is clear the once
-
per
-
second
clock tick
interrupt

void LowInterrupt (void)

{



if (IsSWI( SWI_Tick ) )


{



ClearSWI( SWI_Tick );


// Clear clock interrupt flag



return;


}


}



// Error event handler

void ErrorStatus( unsigned char ErrNum )

{


// Flash error number for diagnositic
purposes


// For product releases, a Reset() is better for unanticipated errors


Breakpoint( ErrNum );

}



35


// LinkMatik Event handler

void LMTEvent( unsigned char EventID, void *pData1, void *pData2 )

{


if ( EventID==LMTE_Syntax )


{



// Flash error num
ber for diagnositic purposes



// For product releases, a Reset() is better for unanticipated errors



Breakpoint( ((unsigned char*)pData1)[0] );


}

}


// FxPEvent handler

void FxPEvent( unsigned char EventID, void *pData )

{


if ( EventID==FxPE_Connect )


{



// turn off red led during connection



LedRed = LedRedOn;


}


else if ( EventID==FxPE_Disco )


{



// turn off red led after disconnection



LedRed = LedRedOff;


}




// Check for control events


else if ( EventID==FxPE_ClntUpdate )


{



// If the
button was pressed...



if (*((unsigned short*) pData) == ID_On_Off_3)



{



//LedRed = LedRedOff;




//LedGreen = LedGreenOn;




// Is the current text value F or O?




if (set == 0) //turn light off




{





//LedRed = LedRedOff;





set = 1;





DirAN9
= DirOutput; //setting the the direct out put to
AN9Pin





AN9Pin = 1; //setting the pin to high
-

light on










// set the text value to O and update the client





//Set_Result_1( szOff, zero );





//FxPCommand( FxPC_CtlUpdate, ID_Result_1, 0 );









//Set_Result_1( szOn, 0 ) ;




}




else //turn light on




{





//LedRed = LedRedOn;





set = 0;





DirAN9 = DirOutput; //setting the the direct out put to
AN9Pin





AN9Pin = 0; //setting the pin to high
-

light on










// set the text va
lue to O and update the client





//Set_Result_1( szOn, 0 ) ;





//Set_Result_1( szOn, zero );





//FxPCommand( FxPC_CtlUpdate, ID_Result_1, 0 );





}



}


}

}



36


BlueLite.c

#include "Toothpick.h"

#include <p18f6720.h>

#include "BlueHeat.h"



int setH
= 0;

int setF = 0;


int Channel = 0;

unsigned long ADResult = 0;

ram signed long setTempResult = 0;

signed long curTempResult = 0;


void main( void )

{


SetAnalogAD0; //Sets AD0 as an analog input and all other ADx pins as digital I/O


ADConverterOn8bit; /
/Turn on A to D converter for 10
-
bit data conversion


VRefNegIsVss; //Sets negative voltage reference to Vss ground


VRefPosIsVdd; //Sets positive voltage reference to Vdd 5V




//if no BlueMatik, flash red led rapidly


while ((ToothpickSemaphores&TPSF_LMT
EXISTS)==0)


{



LedRed = ~LedRed;



msDelay(50);


}


FxPCommand( FxPC_Start, 0, 0 );


AwaitLMTComplete();



// main loop


while ( 1 )


{



// Flash LED to show we're alive



LedGreen = ~LedGreen;



msDelay( 250 );




SetADChan( Channel ); // select a to
d channel



CyclesDelay3p2plus3p2times(4);



StartAtoD; // start a to d conversion



AwaitAtoDComplete; // await end of conversion



GetADResult8bit( ADResult ); // get result



curTempResult = (ADResult/5);






//Set_curTemp_13(0,&curTempResult);




//ge
t the desired temp and convert to AtoD value assing to setTempResult



Get_setTemp_16(&setTempResult);



setTempResult = (255
-

(setTempResult * 5));





if (setH == 1)



{








//if the heat button is turned on




// set AN5 to low to turn AC off and d
isconnect RC and O




DirAN5 = DirOutput;




AN5Pin = 0;




//set AN11 high to connect RH and B





DirAN11 = DirOutput;




AN11Pin = 1;








// if the heat is on and its temp is below desired temp by 1
degree, start heating





if(ADResult > (setTempRes
ult+5) )




{





DirAN10 = DirOutput;





AN10Pin = 1;

37





}




// when the temp reaches above the desired temp by 1 degree, turn
the heat off




else if (ADResult < (setTempResult
-
5))




{





DirAN10 = DirOutput;





AN10Pin = 0;




}



}



// if the

heat is turned off, shut down connection between RH and B



else if (setH ==0)



{




DirAN11 = DirOutput;




AN11Pin = 0;



}




if (setF == 1)



{








//if the ac is on, set AN5 high to make connection between Rc and O




DirAN5 = DirOutput;




AN5P
in = 1;




// if the temperature is below desired temp plus 1 degree, turn off
the AC




if(ADResult >(setTempResult+5) )




{




DirAN3 = DirOutput;




AN3Pin = 0;




}




// if the temp is above the desired temp by one degree turn off AC




else if(ADR
esult < (setTempResult
-
5))




{





DirAN3 = DirOutput;





AN3Pin = 1;




}




}



// if the AC is turned off, set AN5 to low to disconnect RC and 0



else if (setF ==0)



{




DirAN5 = DirOutput;




AN5Pin = 0;



}











} // end of while ( 1 )


}


// HighInterrupt handler
-

nothing needs to be done

void HighInterrupt (void)

{

}


// LowInterrupt handler
-

only thing to do is clear the once
-
per
-
second clock tick
interrupt

void LowInterrupt (void)

{



if (IsSWI( SWI_Tick ) )


{



ClearSWI( SWI_Tic
k );


// Clear clock interrupt flag



return;


}


}

38


// Error event handler

void ErrorStatus( unsigned char ErrNum )

{


// Flash error number for diagnositic purposes


// For product releases, a Reset() is better for unanticipated errors


Breakpoint( ErrNu
m );

}



// LinkMatik Event handler

void LMTEvent( unsigned char EventID, void *pData1, void *pData2 )

{


if ( EventID==LMTE_Syntax )


{



// Flash error number for diagnositic purposes



// For product releases, a Reset() is better for unanticipated erro
rs



Breakpoint( ((unsigned char*)pData1)[0] );


}

}


// FxPEvent handler

void FxPEvent( unsigned char EventID, void *pData )

{


if ( EventID==FxPE_Connect )


{



// turn off red led during connection



LedRed = LedRedOn;


}


else if ( EventID==FxPE_Disco

)


{



// turn off red led after disconnection



LedRed = LedRedOff;


}




// Check for control events


else if ( EventID==FxPE_ClntUpdate )


{



// If the button was pressed...



if (*((unsigned short*) pData) == ID_Heat_10)



{





if (setH == 0) //tur
n light off




{





setH = 1;





setF = 0;




}




else //turn light on




{





setH = 0;




}



}






if (*((unsigned short*) pData) == ID_Cool_E)



{




if (setF == 0) //turn light off




{





setF = 1;





setH = 0;




}




else //turn light on




{





setF = 0;




}







}


}

}

39


Appendix D

-

Cost

The table below is a summary of the total cost of the products used for this project. These costs
show the total amount for the creation of the prototypes used for this project. It does not
accurately
reflect the true cost to build these devices if they were to be mass produced.


4.6.1 Blue Heat

Materials

Cost

Toothpick Module

$145.92

Prototype Board

$3.50

Relays x4

$11.20

Thermistor

$0.75

Voltage Regulator

$0.47

Enclosure

$7.50

TOTAL:

$169.34

4.6.2 Blue Lite

Materials

Cost

Toothpick Module

$145.92

Prototype Board

$3.50

Solid State Relay

$26.00

Voltage Regulator

$0.47

TOTAL:

$175.89

40


References

[1]

Ji ang, Li, Da
-
You Li u, and Bo Yang. "Smart Home Research."
Machi ne Learni ng and Cyberneti cs

(20
04). 15 Oct. 2007
<http://ieeexpl ore.i eee.org.cerberus.l i b.uoguel ph.ca/i el 5/9459/30108/01382266.pdf?tp=&arnu
mber=1382266&i snumber=30108>.

[2]

Shepherd, R. "BIuetooth Wi rel ess Technol ogy i n the Home."
El ectroni cs & Communi cati on
Engi neeri ng Journal

13 (2001): 1
95
-
203.
IEEE/IEE El ectroni c Li brary
. 15 Oct. 2007.

[3]

Beyond the Smart Home, Yamazaki, T.; Hybri d Informati on Technol ogy, 2006. ICHIT'06. Vol 2.
Internati onal Conference on, Vol ume 2,


Nov. 2006 Page(s):350


355

[4]

“Smart Home Research” ,
Li Ji ang; Da
-
You Li u;
Bo Yang;

Machi ne Learni ng and Cyberneti cs, 2004.
Proceedi ngs of 2004 Internati onal Conference on
,
Vol ume 2,


26
-
29 Aug. 2004 Page(s):659
-

663
vol.2

[5]

Sensor/Actuator Networks i n Smart Homes for Supporti ng El derl y and Handi capped Peopl e

Dengl er, Sebasti an; A
wa
d, Abdal kari m; Dressl er, Fal ko;
Advanced Informati on Networki ng and
Appl i cati ons Workshops, 2007, AINAW '07. 21st Internati onal Conference on
,
Vol ume 2,


21
-
23
May 2007 Page(s):863


868

[6]

Dagtas, S, Y Natchetoi, and H Wu. "An Integrated Wi rel ess Sensi ng a
nd Mobi l e Processi ng
Archi tecture for Assi sted Li vi ng and Heal thcare Appl i cati ons."
An Integrated Wi rel ess Sensi ng
and Mobi l e Processi ng Archi tecture for Assi sted Li vi ng and Heal thcare Appl i cati ons

(2007): 70
-
72.
ACM
.

[7]

T. Tamura, T. Togawa, M. Ogawa, and M.

Yoda, “Ful l y automated heal th moni tori ng system i n
the home,” Med. Eng. Physi cs, 20, pp. 573

579, 1998.

[8]

S. K. Das, D. J. Cook, A
. Bhattacharya, E. O. Hei erman,
III, and T.
-
Y. Li n, “The Rol e of Predi cti on
Al gori thms on the

MavHome Smart Home Archi tectures,
” IEEE Wi rel ess

Communi cati ons
(Speci al Issue on Smart Homes), Vol. 9, No.

6, pp. 77

84, Dec. 2002.

[9]

"IControl."
IControl Networks Inc.

2007. 27 Nov. 2007 <www.i control.com>.

[10]


Ascri be Newswi re. “Uni versi ty of Fl ori da ‘Smart Home’ Demonstrates Concept of Au
tomated
El derl y Hel p and Care”. Ascri be Newswi re: Heal th. 2003 29 November: 1
-
2.

[11]


Ki m, Ni na. "Car Gadgets: Bl uetooth Wi rel ess Communi cati on." Cars.Com
. 31 Aug. 2006. 6 Jul y
2008
<http://www.cars.com/go/advi ce/Story.jsp?secti on=gdgt&subject=comm&story=bl Too
th&
referer=&aff=nati onal >.

[12]

http://www.tel usmobi l i ty.com/content/cl i entcare/pcs_east/gui des/noki a_6265i/noki a_6265i_u
ser_gui de.pdf

[13]

htt
p://www.mi crochi p.com/stel l ent/i dcpl g?IdcServi ce=SS_GET_PAGE&nodeId=1406&dDocNam
e=en019469&part=SW007002

41


[14]

http://www.fl exi panel.com/Docs/Desi gner.pdf

[15]

Shahri yar, Ri fat, Enamul Hogue, Iftekhai r Nai m
, S. M. Sohan, and Mostofa Akbar. "Control l i ng
remote system usi ng mobi l e tel ephony." ACM Internati onal Conference Proceedi ng Seri es
-

Proceedi ngs of the 1st i nternati onal conference on MOBILe Wi rel ess Mi ddl eWARE, Operati ng
Systems, and Appl i cati ons

278 Ar
ti cl e 36
(2008).