Bluetooth Based Household Automation

By

Michael Johnson

Department of Computer Science

Submitted in partial fulfillment of the requirements for the degree of Bachelor of Computer Science

Algoma University College Sault Ste. Marie, Ontario April 2008

© Michael Johnson 2008

:, e of Cot trl

Chapter 1 Introduction 1 1.1 Brief Overview of Technology 1 1.2 Project Plan 2 1.3 Contribution 3 Chapter 2 Internet and Other Wireless Internet Technologies 4 2.1 History of Wireless Communication and its Implementation 4 2.2 Types of Wireless Communications 5 2.2.1 Radio Transmission 5 2.2.2 Microwave Transmission 6 2.2.3 Infrared Transmission 6 2.3 PANs 7 2.3.1 PAN Connections 7 2.3.2 PAN Networking 8 2.4 Internet Applications 9 Chapter 3 Bluetooth 11 3.1 History 11 3.2 Bluetooth SIG 12 3.3 Aim of Bluetooth 13 3.4 How Bluetooth Works 13 3.5 Applications of Bluetooth 15 3.6 Bluetooth Protocol Stack 17 3.6.1 Radio 18 3.6.2 Baseband 18 3.6.3 Link Manager 21 3.6.4 Host Controller Interface 22 3.6.5 Logical Link Control and Adaptation Protocol (L2CAP) 24 3.6.6 RFCOMM 26 3.6.7 Service Discovery Protocol 28 3.6.8 The Wireless Application Protocol (WAP) 30 3.6.9 OBEX 32 3.6.10 Telephony Control Protocol Specification (TCS) 33 Chapter 4 Architecture of Household Automation 35 4.1 Roomba Vacuum 35 4.1.1 Roomba History 35 4.1.2 Parts of the Roomba Vacuum 36 4.1.3 The Cleaning Algorithm 37 4.2 Power Regulating Circuit 38 4.3 Online Availability 40 Chapter 5 Implementation and Experimental Results 42 5.1 Issues related to sending commands through Bluetooth 42 5.2 General Overview of Project 43 5.2.1 Client-side Application 44 5.2.2 Server-side Application 45 5.2.3 Roomba vacuum 47

ii

Chapter 6 Chapter Summary and Future Directions 48 6.1 Chptr Sr tr rtn 9 Bibliography Errr r nt dfnd Glossary 51

Table of Figures

Figure 2.1 The Seven Layers of the OSI Model 8 Figure 3.1 Bluetooth Protocol Stack 17 Figure 3.2 THE WAP Protocol Stack 31 Figure 4.1 Power Regulating Circuit 38 Figure 5.1 Client-Side Application Screenshot 44 Figure 5.2 Server-Side Application Screenshot 46

iv

Chpt: Intrdtn 1.1 Brief Overview of Bluetooth Technology

1.2 Project Plan

1.3 Contribution

. rf Ovrv f ltth hnl Bluetooth technology is a newer technology which allows for short range wireless

communication. The range Bluetooth technology can handle depends on the devices

being used however it is generally between 10 and 100 meters. The technology allows for

multiple devices to communicate with each other. Currently, the most common use for

Bluetooth technology is the wireless headset for cellular phones or Personal Digital

Assistants. Many companies are trying to determine new and different ways to exploit

this technology for its products. Those companies see a value that Bluetooth brings to the

industry of wireless communication. A lot of these companies which are rivals in certain

aspects are actually helping each other out to develop new ways to use Bluetooth. They

understand that they may be helping their competitors but they also see more revenue

they can generate from this technology.

1 ,2 rjt ln In th I plntd ltth bd t hh ll r t ntrl

b v h t prt th r t vt pf bt fr hh th

n lt nd tht n b prfrd b thr b v On nd

ltd t ll b nt fr th bt t th b v ltd n thr h

h ll th r t plt h vn fr nhr hh h t th

Intrnt hh lt vrhr nd Whn th t rv th nd

hn b th r t ltth nntn th th b v tlf t p th nd t th v h t nd th b v ll bvl nd t t thn th ltth ntn rn thrfr th t ll l nd t b ltd n th r h hr n rl rn t b v

thr thn th ft tht t n rv r thn pl n r ff nd h rn

th nd "ltth d hld Attn" b n hhld

ppln ld hv bn d hrfr t nt ltd t th f b v

. Cntrbtn M th h tht t pbl t hrt rn rl thnl n ln rn nnr I hv l bn ntrtd n ntr thnl nd I hv vr lttl

xprn th ltth thnl I thn th rt pprtnt t lrn n thnl nd t f I n plnt t n rl rld nvrnnt ltth thnl ffr lt f dvnt t rl ntn thr n nd t lt t pl b t hrt rn thnl An b-bd r ln-rn

ntn t t n pl b rld t ntrl fl pnt nd fr thr

ltth thnl n b d t plt th t nd prfr th ll prtnt t t hnd It bvl pbl t hv plt ltth ntn

r th Intrnt d t th rn rtrtn ltth h hvr t pbl t

nplt th ndd t dt t th pnt hr n t ltth

ntn h th prnt fll fntnl t tht n b d thrh th Intrnt nd th b v ll b nvrd b nd hn fr tht bt

3

Chptr 2 ntrnt nd Othr Al Intrnt hn 2.1 History of wireless communication and its implementation

2.2 Types of wireless communications

2.3 Personal Area Networks

2.4 Internet applications

2. tr f Wrl Cntn nd t Iplnttn Ever since wired technologies have been in place, there has been a need to move forward

from this by having wireless technologies which would provide all the same functions as

the wired technologies but you would be able to add flexibility, mobility and portability.

The earliest works of wireless technologies are that of telegraphy which would receive

Morse code through an apparatus. Once the data being sent over and the methods to send

it were becoming much more complex, these were adapted to the wireless world and new

and great ideas were implemented. The first major use of wireless technology was for the

use of broadcast radio. The next one would be that of cellular phones which would

provide the user with mobility while maintaining the same uses provided by standard

telephones. Lastly and more recently, the use of wireless technology to connect to the

Internet has been implemented, this ties in with my study on Bluetooth as it will

wirelessly communicate with any Bluetooth enabled device and will then be able to send

over any data needed. The usefulness of wireless technology will always exist because it

will always be seen as an improvement from the norm as it provides the flexibility an

end-user would want.

4 2.2 p f Wrl Cntn These wireless signals being transmitted can be sent in many different ways. The three most common ones are radio, microwave and infrared [7]. Bluetooth technology uses the

2.4GHz radio frequency band to transmit data. Not only can the frequencies change, but the way the wireless signal is sent can change to, and that obviously directly ties into the use of wireless for the application. The signal can be sent point-to-point which is as it implies, from a single point to another, similar to cellular phone communications. The signal can be sent point-to-multipoint which simply means that the signal will originate from a single location, however the signal will be dispersed to a multitude of locations such as VOIP(Voice over Internet Protocol) or general wireless Internet communications.

The signal can be sent through a broadcast which is used by radio and will send its signal out to an intended audience and as is the case with most forms of broadcasting, the user needs to be set to the specific location where the broadcast is being sent to whether it is a television channel or a radio station.

2.2. d rnn Radio transmissions are done by of electromagnetic waves with frequencies below those of visible light. Electromagnetic radiation travels by means of oscillating electromagnetic fields that pass through the air and the vacuum of space. Information is carried by systematically changing some property of the radiated waves such as their amplitude or their frequency. When radio waves pass an electrical conductor, the oscillating fields induce an alternating current in the conductor which is detected and transformed into sound or other signals that carry information.

5 2.2.2 Mrv rnn Microwaves are electromagnetic waves with wavelengths shorter than one meter and longer than one millimeter or frequencies between 300 megahertz and 300 gigahertz.

Electromagnetic waves with a lower frequency are radio waves. Bluetooth and wireless technology uses microwaves in the 2.4 GHz ISM band. Cable television and Internet access on coaxial cable as well as broadcast television use some of the lower microwave frequencies.

2.2. Infrrd rnn Infrared is an electromagnetic radiation of a wavelength longer than that of visible light but shorter than that of microwaves. The name means below red because red is the color of visible light with the longest wavelength Infrared transmission is used for many different reasons such as infrared filters, night vision, tracking, heating and communication. Remote controls are a popular infrared communication device. The device uses an infrared LED to emit infrared radiation which is focused by a plastic lens into a narrow beam. The beam is modulated to encode the data. The receiver uses a silicon photodiode to convert the infrared radiation to an electric current. It responds only to the rapidly pulsing signal created by the transmitter and simply omits the slowly changing infrared radiation from ambient light.

6 2. A

2.. A Cnntn A Personal Area Network (PAN) works a lot like a Local Area Network (LAN), however instead of the location of the network being confined to a small location, it is confined to one's self. These can sometimes be referred to as a Wireless Personal Area Network

(WPAN) due to the fact the device it is attached to is mobile. The PAN is very popular with Bluetooth technology as the technology range is very limited. These Bluetooth devices typically offer a communications range of approximately 10 meters but under ideal conditions, this can reach up to 100 meters. At this relatively small distance, these small portable devices can conserve their limited battery power and reuse their bandwidth. To be defined as a PAN, it must meet the following requirements:

1) It must allow devices to share information

2) It must have low power consumption

3) It must be able to frequently make and break connections for mobility

4) It needs to allow resource discovery and use

and lastly,

5) It needs to incorporate international regulations for global interoperability.

A PAN can use various communications channels, including electric, magnetic, optical and electromagnetic channels [8].

7 2..2 AC: Eltr:n The Open Systems Interconnect (OSI) model explicitly defines how to incorporate devices into computer network systems. It describes the functions of multiple layers that can be developed independently but still function cohesively. The OSI is a seven layer model as shown in Figure 2.1 [12].

A aaaye

eseaio aye

Sessio aye

aso aye

ewok aye

e Oas ik aye

e iYysiea

e see ayes o e 0 Mdl

Figure 2.1 The Seven Layers of the OSI Model

For personal area networking, only four of these are important. The

transfers unstructured bits across a The

establishes connections and provides reliable data transmissions. The Network layer

provides logical addressing and data transmission services to the upper layers

independent of the physical and data link methods used. The Application layer provides

services such as file transfer to the software running on the system. On the physical layer,

the medium most commonly used for PANs is the 2.4 GHz radio band. This medium

effectively takes care of the lower layers by establishing the link and channel over which

information flows from one device to another. Embedding a radio in a device establishes

llie physical connections but the devices also need an acceptable format for transmitting 8 the data so they can share data, applications and resources. This requirement involves the upper layers. Since mobile devices are small, portable and wireless, they have unique requirements for data formatting and transmission.

2.4 Intrnt Appltn Internet applications are web based applications that have the features and functionality of traditional desktop applications. They typically transfer the processing necessary for the user interface to the web client but keep the bulk of the data on the application server.

Internet applications typically run in a web browser and do not require any software to be installed and they also run locally in a secure environment which is called a sandbox.

Traditional web applications centered all activity around a client-server architecture.

Under this architecture, all processing is done on the server and the client is only used to

display static content. The biggest drawback with this setup is that all interaction with the

application must pass through the server which requires data to be sent to the server, the

server to respond and the page to be reloaded on the client with the response.

There are many benefits for the user to use an Internet Application. For example:

G Installations are not required

• Distribution and updates of the application is an instant and automated process

® Upgrades to new versions are automatic

• The application can be used as long as the user has an interne connection and it

does not matter what operating system is being used.

® Web-based applications are generally less prone to infections when compared to

an actual executable

\ long with the benefits of using Internet applications, there are always some drawbacks

) this, if not every application would be a web application.

9 ® The use of a sandbox may cause some problems with restrict access to system

resources

® Scripting languages such as JavaScript are required and it is possible the user

has disabled scripting in their browser

® To achieve platform independence, some Internet Applications use client-side

scripts which can cause performance issues

1

Chptr ltth 3.1 History

3.2 SIG

3.3 Aim of Bluetooth

3.4 How Bluetooth works

3.5 Applications of Bluetooth

3.6 The Protocol Stack

0 tr Bluetooth technologies were initiated by Ericsson in 1994 as a means to eliminate wire

clutter in homes and offices. Ericsson is a Swedish based company that is famous for its

cellular phone services. Most recently, Ericsson has joined forces with the popular

Japanese company Sony to foiin the joint venture of Sony Ericsson. Ericsson had

interestingly coined the term Bluetooth after their Scandinavian heritage. The Danish

king Harald "Bluetooth" Blátand had united Denmark and Norway, who were at war at

the times, and he brought Christianity to Scandinavia. The base idea behind Bluetooth

technologies was to unite computer devices and . The King's

nickname was simply for his love of blueberries and the legend states that he loved them

so much that his teeth were stained blue.

11 .2 ltth SIG The Special Interest (SIG) was founded in February 1998 by major companies such as Ericsson Mobile Communications, Intel, IBM, Toshiba and Nokia Mobile Phones

[6]. The SIG's main focus is to oversee the development of Bluetooth standards and the licensing of the technologies and trademarks to manufacturers. By July 1999, the core promoters had published the first version of the Bluetooth specifications. By December

1999, four more major companies had joined the Bluetooth SIG, and those companies were Microsoft, Lucent, 3COM and Motorola. It may not be clear at first why all these companies would want to work together with Bluetooth because some of these companies are in direct competition with each other. However, all involved companies stand to have something to gain from being a part of the SIG. The implementation of Bluetooth and the overall improvement of mobile device communication will allow all parties involved to

sell devices with enhanced functionality. For the Bluetooth promoters group, making

Bluetooth an open specification rather than keeping it restricted and proprietary is more

beneficial because the consumers are more likely to adapt to a new technology if it is

available through many major manufacturers rather than only having a select few carry

the product. As of January 2008, the Bluetooth SIG has grown to over 10,000 member

companies and these companies are industry leaders in telecommunications, ,

automotive, music, apparel and industrial automation.

12 . A f ltth The SIG had developed a specific set of goals Bluetooth had to achieve in order to become successful. Bluetooth was tagged as a cable replacement technology so in order for it to be implemented, it could not be more expensive than the cable that it was replacing. The use of Bluetooth needed to be as simple and convenient as plugging in the cable it was replacing and it must just as reliable. Being a wireless technology, it also needed to be able to cope with any errors it received. It was to work with mobile devices so it needed to be able to run on batteries, use very low power and should run on low voltage. It also needed to be lightweight and had to be small enough so it would not disrupt the design of cellular phones, headsets and Personal Digital Assistants. Bluetooth aims to be widely available, inexpensive, convenient, easy to use, reliable, small and low power. If it was to achieve all these goals, the SIG knew it would be a success for any company that was involved with it.

.4 ltth Wr Bluetooth devices operate at the very popular 2.4 GHz in the globally available, licence- free ISM (industrial, scientific and medical) band. Because so many devices use this frequency, Bluetooth had to implement a frequency hopping algorithm that would reduce transmission interference. Bluetooth operates in a master-slave environment so a

Bluetooth device can take on the role of a master or a slave. The master sets the frequency hopping sequence while slaves simply synchronise to the master in time and frequency. Every Bluetooth device has a unique Bluetooth device address and a

1 luetooth clock. The baseband part of the specification describes the algorithm which

calculate a frequency hop sequence from the device address and clock. When slaves 13 connect to a master, they are given the master's device address and clock because all slaves use the master's clock and address so that they are all synchronised to the same frequency hop sequence. The master also controls when devices are allowed to transmit.

The master allows slaves to transmit by allocating slots for voice traffic or data traffic.

For data traffic slots, slaves are only allowed to transmit when they are replying to a transmission sent to them by the master. For voice traffic slots, slaves must regularly transmit in reserved slots whether or not they are replying to the master. The number of time slots each device gets depends on its data transfer requirements.

The next major concept in Bluetooth is that of Piconets and Scattemets. A collection of slaves operating with one common master is referred to as a piconet. All devices on a piconet follow the frequency hopping sequence and timing of the master. The slaves in a piconet only have links to the master and there are no direct links between slaves. The

specification limits the number of slaves in a piconet to seven. It is possible to have a

larger coverage area or a greater number of network members by linking piconets into a

scatternet, where some devices are members of more than one piconet. When a device is

present in more than one piconet, it must time share by spending a few slots on one

piconet and a few slots on the other. It is possible to have a scatternet where one device is

a slave in one piconet and a master in another. It can also happen where a device is a

slave in both piconets. However, it is not possible to have a device that is a master of two

different piconets and that is because all slaves in a piconet are synchronised to the

master's hop sequence and two piconets cannot have the same hop sequence. Along with

interference that was previously mentioned, having large amounts of piconets in the same

area may also cause interference since there may be a frequency collision at a specific

hop in the sequence of two separate piconets. The data transmitted during that collision

14 will be lost and will need to be retransmitted so the more piconets in an area, the more likely retransmissions will be needed causing data rates to fall. This can be compared to having a conversation in a noisy room. The noisier the room, the more likely you will need to repeat yourself.

. Appltn f ltth Another important job of the Bluetooth SIG is to identify the various usage models within the Bluetooth environment and to assign a specific group to a certain working group.

Each working group is responsible for defining specifications that control the development of Bluetooth enabled products within a particular technology or application area. In this section, a bit more detail will be given concerning what each working group is responsible for [2].

The Audio/Video working group needs to define Audio/Video protocols and profiles that make Bluetooth the low cost, low power, globally available wireless standard without having to compromise quality or range.

The Car Profile working group is responsible for ensuring device interoperability in a vehicle environment using Bluetooth specifications.

The Coexistence at 2.4GHz working group is responsible for ensuring that Bluetooth products can operate successfully in the ever popular and unlicensed radio spectrum without experiencing difficulties from wireless LANs, cordless telephones and other radio products.

15 The Extended Service Discovery Profile working group needs to provide mappings of industry Service Discovery Protocols. The mappings are discovered using the Bluetooth

SDP(Service Discovery Protocol).

The Human Interface Device working group ensures that user friendly Bluetooth enabled devices such as keyboards, pointing devices, gaming devices and monitoring devices are compatible with each other, easy for consumers to use and most importantly affordable.

The Imaging working group defines the minimal requirements and generic functions necessary which will enable the exchange of digital images between devices. On the destination end, the images will be displayed, stored, printed or sent to another location viva Bluetooth data access point.

The Local Positioning working groups is to develop a location descriptor in order to

provide information that other applications can use to determine location.

I he Personal Area Networking working group is concerned with the issues of creating

(1-hoc, mobile IP-based personal area networks and the security issues that follow these

lictworks.

< inting working group must develop specifications to ensure that Bluetooth printers

1 I <

Idio 2.0 working group has the responsibility to recommend improvements to the

1 [I I Itic.tooth radio specifications (Radio 1.0) in the development of a new and

16 expanded radio standard. Radio 2.0 will not replace Radio 1.0 but will rather add a set of optional extensions to the older specifications.

The Unrestricted Digital Information Extension for Japanese 3G Handset working group is to provide a standard profile that enables the UDI transfer service of the 3G cellular phone system to external devices connected to the 3G cellular phone handsets via

Bluetooth.

All these working groups were implemented by the SIG to ensure that Bluetooth technologies would be able to integrate with day to day applications. They also wanted to make sure these integrations stayed current as the applications they work with were also being modified.

.6 ltth rtl St

rlvCl

OI3E A- Cnd ICS 131

COMM Ad 6MIMMEME _,

t Cntrllr Intr f M

Figure 3.1 Bluetooth Protocol Stack

'iiv of the main features Bluetooth offers is that it allows devices from different

Hitheturers to work with one another. To this end, Bluetooth does not just define a

17 radio system, but it also defines a software stack to enable applications to find other

Bluetooth devices in the area, discover what services they can offer and use those services. The Bluetooth stack is defined as a series of layers, though there are some features that cross several layers [1].

306.1 d The previously mentioned frequency hopping is performed in this layer to ensure that there is no collision at the same frequency. Modulation is also performed at the radio layer, this is where the operating band is separated into different spaced channels. The operating band of 83.5MHz is divided into 1 MHz spaced channels, each signalling data at 1 M symbols per second as to obtain the maximum available channel bandwidth.

Power emission and control is also performed at the radio layer. Regulations have allowed Bluetooth to create three power classes. Power Class 3 is the most common

scheme adopted by manufacturers and it is the lowest power consumption option. It uses

only 1mW of output power. Power Class 2 is the least used type however it offers a max

output power of 2.5mW. Power Class 1 has a mandatory requirement for power control,

while classes 2 or 3 make this optional. Power Class 1 has a maximum output power of

nomW however it will allow for a range of up to 100 meters.

.6.2 bnd l radio interfaces between the on-air channel medium and the digital baseband, which

'Inlats data supplied by the Link Controller for robust and reliable transmission over the

'' 1 1) 1 and retrieves data from the channel for passing up the stack. The baseband is

ble for channel coding and decoding and low level timing control and

n-lent of the link within the domain of a single data packet transfer. The Bluetooth 18 Device Address is also specified at the baseband layer, the address is a 48 bit IEEE MAC address. The address is split into three different parts, the Non-significant Address Part

(NAP), the Upper Address Part (UAP) and the Lower Address Part (LAP).

The NAP is 16 bits long and is used to initialise the encryption engine stream

LFSR(linear feedback shift register). The UAP is 8 bits long and is used to initialise the

HEC(Header Error Check) and CRC() calculations and for frequency hopping. The LAP is 24 bits long and is used by sync word generation and frequency hopping.

A link is also established between a device acting as Master and a device acting as Slave at the baseband level. Once that link has been made, there are two basic types of data packets that may be exchanged, each is characterised by the two following link types.

An ACL(Asynchronous Connection-Less) link exists between a Master and a Slave as soon as a connection has been established. A Master may have a number of ACL links to a number of Slaves at any one time but only one link can exist between two devices. An

ACL link will prove a packet-switched connection where data is exchanged at undefined times. The choice of which Slave to transmit to and receive from is up to the Master device on a slot by slot basis so both asynchronous and isochronous (time bounded) services are possible. Most ACL packets facilitate error checking and retransmission to assure data integrity.

A SCO(Synchronous Connection Oriented) link is very different than an ACL since it

Provides a symmetric link between Master and Slave with a reserved channel bandwidth and regular periodic exchange of data in the form of reserved slots. The SCO link

19 provides a circuit-switched connection where data is regularly exchanged and is intended for use with time-bounded information such as audio.

The last major part of the baseband layer is to perform channel coding. Since Bluetooth is only designed to work over a line of sight link and the data rates are relatively modest for the signalling bandwidth, the necessary coding is not too complex. The coding applied to the data bit stream in Bluetooth consists of Cyclic Redundancy Check and header Error

Check. A CRC is performed on all packet headers and on ACL payload data to validate the integrity of the received data.

The 8 bit HEC is calculated over the packet header before applying FEC which will be explained shortly. The cipher stream, which is sourced by the encryption engine, is simply exclusive OR'd into the bitstream data path. Whitening is also performed, where a pseudo-random bit sequence with the data bitstream to randomize the data. This is done to reduce the possibility of long sequences of zeros or ones. The last channel coding part

is to Forward Error Correction (FEC). This is done by adding extra parity bits created

from the input data, a number of bit errors in the data may be detected and corrected.

20 .6. n Mnr The diagram presented at the beginning of this chapter referred to this part as LMP which stands for the Link Management Protocol which is what the Link Manager uses to perform its duties. The host drives a Bluetooth device through Host Controller Interface commands but it is the Link Manager that translates those commands into operations at the baseband level. The Link Manager must manage many operations such as attaching slaves to a piconet and allocating their active member addresses. They must also handle the opposite where they need to break connections to detach slaves from a piconet. The

Link Manager is also in charge of configuring the link which includes controlling master/slave switches where both devices must simultaneously change roles. It must also establish the ACL and SCO links mentioned in the previous section. It will also put connections into low-power mode for energy conservation.

Link Managers communicate with others on other devices using the Link Manager

Protocol, this defines a set of messages which are passed between Link Managers. Every

LMP message begins with a single bit transaction identifier. This bit simply states who is initiating the transaction, it will be a 0 if a master initiated and a 1 if a slave initiated the

transaction. After the transaction ID, a 7 bit Operation Code follows which identifies the

type of LMP message being sent. The Operation Code is finally followed by the

message's parameters, each of which occupies an integral number of bytes. The Link

Manager is responsible for setting up and managing the baseband connections that link

I luetooth devices. It establishes ACL links by controlling the baseband then LMP

111 L-ssages can be used to establish a SCO link across an existing ACL connection.

21 Whenever a master or a slave wishes to shut down a link, it will send an LMP detach

command This will be done if a user ended the connection, the device has low resources

or it is about to power off. When a slave has been detached from a piconet, the master can reuse the slave's active member address to identify a new slave. If a slave did not detach properly, this could cause problems with two slaves trying to respond to the same active member address so the Link Manager will initiate a procedure to ensure that a slave is

fully detached before its address can be reused.

The Bluetooth baseband includes an encryption key generation and cipher engine. For

encryption and decryption, this engine must be configured and controlled by higher

layers and that control must be synchronised at both ends of the link. LMP provides the

mechanism for negotiating encryption modes and coordinating encryption keys used by

devices at either end.

.6.4 t Cntrllr Intrf Some Bluetooth systems will have the baseband and Link Manager on one processor

while higher layers and applications are running on a separate host processor. In systems

where the higher layers are run on a host device's processor and lower layers on a

Bluetooth device, an interface is needed between the higher and lower layers. The

Bluetooth standard defined the Host Controller Interface. A device such as a Bluetooth

card for a PC may use the HCI to separate upper and lower layers because hosts such as

PCs have spare capacity to handle the higher layers which then allows the Bluetooth

d evice to have less memory and a less powerful processor. The HCI interface is also

Ieful for test and type approval of Bluetooth devices. By standardising the HCI, this

I lows drivers to be written which can be used with a variety of Bluetooth modules from

I Fferent manufacturers. It also provides a standard test interface which can be used for 22 the radio and lower portions of the stack. All Bluetooth devices are not split between processors, some devices such as headsets run all the layers on one processor. These single-processor devices still need to support an HCI for test purposes.

HCI commands are used by the host to control the Bluetooth module and to monitor its status. There are only three types of HCI packets and these packets are carried on the HCI transport layer.

® A command packet used by the host to control the module.

e An event packet used by the module to inform the host of changes in the lower

layers

® A data packet to pass voice and data between host and module.

There are some HCI transport interfaces that offer data rates much larger than the data

rate across the Bluetooth radio and air interfaces, so a host can pass data down faster than

it can be transmitted out of the module. A mechanism is needed to slow down data

transport across the HCI only when the module's buffers are overloaded and to allow the

transport layer to run at full speed the rest of the time. Bluetooth solves this problem

H Providing flow control of the HCI. Each time a command is sent to the Bluetooth

Ili( glide, the module responds with a command saying it can either complete the task

iQdiately or not. If it cannot complete the task, it will send a notification when it is

pleted. The host will then query to find out how many command packets the module

iffer and it will not send more than that amount without having received a

i on notification from the module.

23 .6. l n Cntrl nd 4%dpttn rtl (2CA The logical link control and adaptation protocol takes data from higher layers of the

Bluetooth stack and from applications and sends it over the lower layers of the stack. It passes the packets either to the Host Controller Interface or in a host-less system, to the

Link Manager. L2CAP has many functions which include multiplexing between different higher layer protocols which allows them to share lower layer links, it segments and reassembles larger packets to allow transfer when lower layers do not support the large size. It also provides group management which provides a one-way transmission to a group of other Bluetooth devices and ensures quality of service for higher layer protocols.

Once an L2CAP connection is established, it needs to be configured. Only certain parameters can be configured between the two devices, those are the Maximum

Transmission Unit, the Flush Timeout and the quality of service. The MTU is the maximum size in bytes of packet payload a device is willing to accept. If the MTU requested is larger than a device can support, it will reject the request with a reject packet containing the MTU it can handle.

The flush timeout gives the amount of time in milliseconds that a device will spend trying

t transmit an L2CAP packet segment before it gives up. If a packet segment does not get

thrh before the flush timeout is exceeded, the segment cannot get through and the

hl packet is flushed or thrown away.

quality of service option can select best effort or a guaranteed quality of service.

iously, it is impossible to have a guaranteed quality of service with a wireless link

(ke f the possibility of interference so it can only configure the channel so that it

24 does not compromise QoS by accepting more traffic than it can handle. The transmitting device tells the receiving device what quality of service it will implement.

Higher layer protocols use packet sizes larger than those which Bluetooth can handle so

L2CAP provides segmentation of higher layer packets going down the stack and reassembles them as they pass up the stack. L2CAP packets are very large, carrying up to

65,535 bytes of data while HCI uses smaller packets. The actual size of the packet is implementation independent however the specification says that all implementation must support packets carrying up to 255 bytes of data. It becomes clear that the L2CAP may need to be segmented into many HCI packets and the same will need to be done for reassembling the packets on their way back up the stack. Lastly, no matter on the application, they must use L2CAP to send data along with many of the higher layers so this layer has become a mandatory part of any Bluetooth system.

25 .6.6 COMM RS-232 serial ports have nine circuits, which can be used for transferring data and signalling. RFCOMM can emulate the serial cable line settings and status of an RS-232 serial port. RFCOMM provides multiple concurrent connections by relying on L2CAP to handle multiplexing over single connections and to provide connections to multiple devices. RFCOMM relies on the baseband to provide reliable in-sequence delivery of byte streams. It does not have any ability to correct errors. RFCOMM data rates will be limited in devices where there is a physical serial port involved, type 2 devices.

Implementations may optionally pace data on virtual serial ports in type 1 devices.

RFCOMM is a simple, reliable transport protocol with framing, multiplexing and additional provisions such as status, remote line status, remote port settings, parameter negotiation and optional credit based flow control. Serial port transmit and receive data lines are to a Universal Asynchronous Receiver Transmitter (UART). The job of the UART is to convert between the serial data sent down cables and the parallel data processing which devices use. UARTs use buffers to convert between serial and parallel data. This allows them to reduce the load on the processor. The UART transfers the bits between the cables and buffers, then the processor only needs to get involved when there is a whole buffer to deal with. The RFCOMM specification mentions emulating the nine circuits of an RS-232 serial port and specifies how a serial data stream can be emulated. Since the serial stream from an RS-232 port is viewed by the

microprocessor after it has been through a UART, software dealing with serial ports is

actually handling parallel data. Similarly, RFCOMM software deals with parallel data

delivered by the lower layers of the Bluetooth stack.

26 COOM hndl t tp f dv p 1 dv r ntrnl ltd rl prt

nd tp dv r ntrdt dv th phl rl prt r th tp 1 dv th prt ltn ntt p t pf ntn ntrf t th

COMM rv h n b d t nnt t l ppltn r t n b d t nnt t ppltn pfll rttn fr ltth A tp 1 dv ld

ll b th nd f ntn pth h ptr r prntr r th tp

dv th prt prx ntt rl dt fr COMM t n xtrnl S-3

ntrf lnd t nthr dv p dv r ntrdt dv hh t n th ddl f ntn pth h d

Sn COMM fr r rrd n th pld f CA pt n CA

nntn t b t p bfr nd COMM nntn n b t p COMM h rrvd rtl nd Srv Mltplxr (SM vl hh d b CA t

dntf COMM trff h COMM SM dfnd n th ltth r

pftn x3 An CA fr rvd th th vl n th SM fld

ll b nt t COMM fr prn h frt fr t b nt n n COMM

hnnl Strt Anhrn lnd Md fr f th rpndn dv

COMM lln t nnt t nt Anhrn lnd Md nd nd b n Unnbrd Anldnt fr If th rpndn dv COMM d nt nt t nnt t rf th nntn b ndn nntd Md fr

ltth dv ffrn rv pprtd b COMM t hv n ntr n thr

rv dvr dtb hh v nfrtn n h t nnt vr COMM

COMM rvr hnnl nbr r dn nn th hnnl nbr n hn

hvr t ll nt d hl t n It n b rlltd hn th rv nt 7 in use. The minimum information required to connect to a service over RFCOMM is a service name, needed to identify the type of service, and a channel number on which to transfer data. By querying Service Discovery Protocol records, a device can find out all the information it needs to connect to a service thru RFCOMM.

.6. Srv vr rtl When using a Local Area Network, you can connect to a printer and once found, it stays in place for a great length of time. Bluetooth is designed to allow the user to walk in without any pre-configured settings, use the printer and leave forgetting all its details.

The Service Discovery Protocol (SDP) allows this to happen. SDP provides the means to browse through the range of services Bluetooth devices in the area can offer. SDP relies on L2CAP links being established between SDP client and server. Once an L2CAP link has been established, it can be used to find out about services and how to connect to them. An SDP server is any Bluetooth device which offers a service or services to other devices. Infonnation about services is maintained in SDP database. Each SDP server maintains its own database, there is no centralized database. SDP clients use services provided by servers. To allow them to do this, servers and clients exchange information about services using service records.

The SDP database is a set of record describing all the services which a Bluetooth device

can offer to another device. SDP provides the means for another device to look at these

records. An SDP service is described by service attribute, which provide the information

Client needs to use the service. Each attribute in the record describes a different aspect

''f a service. Bluetooth version 1.0b standards defined twenty-eight types of attributes.

28 Some of the attributes are specific to Bluetooth profiles. It is likely as more profiles are defined, more types of attributes will be defined for them. Attributes have values and those values can have various types and sizes. Attributes are sent in data elements which begin with data element descriptors that describe the type and size of the attribute being sent.

A service record holds all the information a server provides to describe a service, which illustrates how a service record is made up. To make it easier to find the service you want, services are arranged in a hierarchy structured as a tree which can be browsed.

Clients begin by examining the root of the hierarchy then follow it down to the leaf nodes where the individual services are described. It is up to each service provider to decide what services will be searchable and how the hierarchy will be constructed.

A Universally Unique Identifier (UUID) is a 128 bit number and each record has a

UUID attribute. These are used to search for a record. The Bluetooth standard specifies

UUIDs for the attributes needed for the Bluetooth profiles. The Bluetooth specification's

UUIDs are likely to be used a lot so to save bandwidth transferring them and storing them, they can be shortened to a 32 bit or 16 bit faun. This can be done because all the

Bluetooth specification's UUIDs are based in the same Bluetooth base UUID. A manufacturer defining a new service is allowed to allocate its own UUIDs. This could easily lead to clashes of IDs so SDP uses a method of allocating UUIDs which makes them extremely unlikely to be duplicated.

29 .6.8 h Wrl Appltn rtl (WA The wireless application protocol is a wireless protocol that allows mobile devices to use

data service and access the Internet. WAP can work with a variety of different wireless

technologies, each of which connects at the bottom of the WAP stack as a bearer.

Bluetooth simply provides another possible bearer beneath the WAP stack. In the same

way Bluetooth has the SIG, WAP has the WAP forum. The WAP forum brings together

companies from all parts of the wireless industry to define WAP standards and to help

ensure interoperability between WAP products. Bluetooth has not been formally adopted

as a bearer layer by the WAP forum. This does not mean that there will be no standards

for interoperability between WAP-enabled Bluetooth products. The Bluetooth

specification includes a section on how to interoperate with WAP and the Bluetooth SIG

is working with the WAP forum to help ensure interoperability of Bluetooth and WAP.

WAP supports a client/server architecture. The client communicates with a server using

the WAP protocols. WAP enabled client devices can use microbrowsers. These are

specially designed web browsers that fit onto mobile devices such as a cellular phones. A

microbrowser is designed to work with a small screen and to use less memory than a

browser running on a desktop PC. WAP supports such facilities through the Wireless

Markup Language (WML). This works in similar ways to HTML however WML is

designed to cope with the smaller screen sizes typically found on today's mobile devices.

Content providers on the Internet are providing WAP pages because it allows them to

access a huge market of mobile customers. The market for WAP services extends much

further than this because around twice as many mobile phones are sold as desktop PCs so

there will be a huge demand for this technology once these mobile devices becomes

smart phones. Many people who do not have a PC will be able to access the World Wide

Web through their mobile phone. WAP does not just work with phones, pagers and

30 personal digital assistants are obvious candidates to work with WAP. In fact, any device

with a display screen and the ability to support a wireless connection could be turned into

a WAP device.

Appltn r (WAE Oe Seices a Aicaios

Sessio aye (IS

asacio aye (W

Secuiy aye (WS

rnprt r (W

E3 ,nrffs: GSM S6 I COMA S C I C iE E Ec...

Figure 3.2 THE WAP Protocol Stack

WAP has defined its own stack which is used at a higher layer in the Bluetooth stack. It

takes the layered approach much like other networking technologies such as the OSI

model and the Bluetooth stack.

o WAE: Provides a user interface, typically a microbrowser which was described

earlier

o WSP: Supports the session between a WAP client and the WAP server

• WTP: Provides a reliable transaction layer for the session layer. It is possible

there is no need for WTP if the layers below the session provide a reliable service.

For example, since Bluetooth baseband provides a reliable transport, there is no

need for WTP when Bluetooth is used as a bearer for WAP

• WTLS: Provides security. This layer can also be omitted for applications which

do not require more security than the Bluetooth baseband provides.

31 The last layer WDP(Wireless Datagram Protocol) is joined with Bluetooth by three

Internet protocols, shown in the Bluetooth stack, which allow datagrams to be sent across

Bluetooth's RFCOMM serial port emulation layer.

• UDP(User Datagram Protocol): Provides an unreliable, connectionless datagram

transport

• IP(Internet Protocol): A protocol which supports addressing, routing,

segmentation and the reassembly of packets

• PPP(Point to Point Protocol): A client/server based packet transport system

commonly used on dial-up links to carry IP packets.

.6. OE Object Exchange (OBEX) is a binary protocol designed to allow a variety of devices to exchange data simply and spontaneously. Spontaneity is important for Bluetooth where short duration ad-hoc connections can be setup. OBEX has a client/server architecture and allows a client to push data to a server or pull data from a server. OBEX packets are carried in RFCOMM frames. The data part of an RFCOMM frame is just an undifferentiated byte stream so the receiving OBEX implementation must sort this byte

stream into packets. This is not too difficult because all OBEX packets include a length

field which can be used to determine where one packet ends and the next one starts.

Applications which are going to exchange data need to agree on a standard way of

representing it. The object model fills this need by defining a series of headers which can

!bold data objects and information about them. Each header carries a piece of information

tN out the object or in the case of body headers, it can carry the object itself. The OBEX

''sion protocol describes how two OBEX clients and servers can communicate by 32 exchanging request and response messages. The client sends requests and the server sends responses. OBEX has six defined operations which are

e Connect: Used to set up an OBEX connection

® Disconnect: Used to close an OBEX connection

• Put: Used to send an object

® Get: Used to request an object

• SetPath: Used to set the directory on the receiving side

• Abort: User to terminate an operation before it would noimally finish

.6.0 lphn Cntrl rtl Spftn (CS TCS defines how telephone calls should be sent across a Bluetooth link. It gives guidelines for the signalling needed to set up both point to point and point to multipoint calls. Telephony control relies upon the presence of a speech synchronisation and control system which can be used to set up speech paths through the baseband using SCO links.

Telephony control is split up into four parts.

e Call Control: handles connection and disconnection

• Group Management: handles groups of devices. This part manages inquiry,

paging and scanning

• Connectionless: handles broadcast information

o Protocol discrimination: handles directing messages between the other parts of

TCS and L2CAP

33 TCS is driven by a telephony application which provides the user interface and provides the source of voice or data transferred across the connections set up by TCS. The specification for TCS suggests that multiple calls could be handled by running multiple instances of TCS, each with their own L2CAP channel identifier. TCS can be used to join devices in a Wireless User Group (WUG). A piconet Master acts as the WUG Master and handles pairing to all devices which join the WUG. Devices in a WUG can request connections directly to one another, allowing calls to be set up faster than if they were not in the WUG. TCS does not define handover of calls from one device to another. It also does not provide a mechanism for groups of devices to enter into conference calls, only point to point links are supported.

34

Chptr E, Arhttr f hld . ,tn 4.1 Roomba Vacuum

4.2 Power regulating circuit

4.3 Online availability

40 b The Roomba vacuum is a robotic vacuum cleaner that is sold by the iRobot company.

The following subsections will provide some history on the vacuum, a description of the

parts of the vacuum, and the cleaning algorithm the vacuum uses.

4.. b tr The first Roomba vacuum was released in 2002 with updates and new models being

released every year since. The iRobot Corporation, which manufactures the Roomba

vacuum, sells and designs many robots. The company was founded by Rodney Brooks,

Colin Angle, and Helen Greiner after they all had worked in MIT's Artificial Intelligence

lab. The company did not succeed from its inception in 1991 till the release of the

koomba vacuum in 2000. After the success the company had with the Roomba vacuum,

th decided to continue by designing other robots that perform cleaning tasks. iRobot

`Lsigned the Scooba which is a floor washing robot, the Dirt Dog which is used to pick

objects from shop floors, the Verro which is a swimming pool cleaning robot

k I lastly, the Looj which is a gutter cleaning robot [9].

35 .‘

4..2 rt f th b The Roomba vacuum is a circular vacuum one foot in diameter and is moved by two tracked wheels that reside below the unit. It contains all the normal parts to perform all necessary cleaning duties. It has a dirt storage bin, a vacuum inlet and a main cleaning deck. A Roomba runs on a rechargeable NiMH(Nickel Metal Hydride) battery which works at approximately 18 volts. When the battery is fully charged, it can vacuum for 2 hours. The vacuum has 5 motors built in, one driving each wheel (2 in total), one driving the vacuum, one driving the spinning side brush and one driving the agitator assembly.

The most intriguing part of the Roomba vacuum is how the vacuum can seamlessly navigate. Roomba uses iRobot's AWARE Robotic Intelligence System to make any decisions needed so that minimal human input is required. The AWARE system is made up of multiple sensors that pick up environmental data. They send this data to the microprocessor and the Roomba will adapt accordingly. According to iRobot, the system can adapt to new input up to 67 times per second. There are two different types of sensors that are mounted on the vacuum. There are 4 cliff sensors which constantly send out infrared signals and Roomba expects them to immediately bounce back. If these signals are not returned, the vacuum knows its approaching a cliff and will change its direction right away. The other two sensors are object sensors. These sensors are activated when a bumper is retracted which tells the vacuum that it has encountered an obstacle. The

Vacuum will then perform the actions of backing up, rotating and moving forward

epeatedly until it finds a clear path.

36 4.. h Clnn Alrth Once instructed to clean, the vacuum will begin to move in a spiral motion to determine the size of the room. It will head towards the perimeter of the room once it receives data from the sensors. It will begin to move around the perimeter of the room until it bumps into an object. Once it bumps into an object, it will maneuver around it and find a clear path and continue to perform its cleaning duties. The vacuum is given a certain amount of time to perform its job however it takes the approach that it should cover the entire floor before the allotted time expires. The only issue with that approach is that completely covering the entire floor is pretty much hit or miss.

An extra feature available for some Roombas is an available docking station which will allow the vacuum to dock and undock itself to recharge its battery. When the battery power gets low, the vacuum starts looking for an infrared signal emitted by the charger.

Once found, the vacuum follows the signal and will go dock itself to the charger. Some vacuums may even head back out to finish cleaning once they are fully recharged.

37 •

4.2 r ltn Crt

t

I "E% 111

Figure 4.1 Power Regulating Circuit

This circuit is needed to regulate the voltage provided from the Roomba vacuum to power the BlueSMiRF Bluetooth modem. The Bluetooth modem is attached to the vacuum through an 8-pin mini-Din serial cable which can be found on many Macintosh computers. The voltage that is provided by the vacuum's battery is 16 volts, but only 5 volts are required to power the Bluetooth modem. Therefore the voltage must be reduced and accurately regulated to the required 5 volts to provide stable power with the correct

'cage to the Bluetooth modem. Both the cable connected to the vacuum and the

n(qooth modem are connected to ground and the voltage regulator. There are only two

cs which connect the vacuum and the Bluetooth, TXD and RXD. TXD stands for

Ltnsmit Data and this is used with serial cable connections so any data sent from the

U 1 to the modem is sent through this wire. RXD stands for Receive Data and this

38 wire will receive any information sent from the Bluetooth modem to the vacuum. At the

Bluetooth end, the TXD signal connects into the RX-I input which is the serial input or the Receive into the B1ueSMiRF. The RXD signal connects into the TX-0 input which is serial output or the Transmit from the BIueSMiRF. The CTS-I and RTS-O connections are connected together because they are not used in this case. CTS-I is Clear-To-Send into the BIueSMiRF while RTS-O is Ready-To-Send from BIueSMiRF and both are used for hardware flow control which is not a necessary component for this project. The circuit did not require the use of an 8 pin mini-din serial cable - it could have used a 7 pin cable and there is an conversion chart available to change from an 8 pin setup to a 7 pin setup.

Once the one end of the serial cable was cut to incorporate it into the circuit, a voltmeter was required to determine which wire corresponded with which pin to create the connection. This is a critical task since a minor mix up between wires could cause the circuit to simply lose the data sent to or from the device. This would not cause an error and so would be very difficult to determine the origin of the problem. More importantly, if the ground and power wires were accidentally inverted, this could cause significant damage to the Bluetooth modem.

39 4. Onln Avlblt The interesting portion of this project is the fact that the Bluetooth technology can be extended so that the vacuum can be operated from anywhere with an interne connection.

The user will be connecting to a specified server and the Roomba will be controlled from that server. The distance restriction will need to be followed from the server end to the

Roomba vacuum. Open source software XAMPP is used to help host the server end.

XAMPP is a free, cross-platform web server consisting mainly of the Apache HTTP

Server, MySQL database and interpreters for scripts written in PHP and Perl programming languages. XAMPP stands for:

X: X refers to the four operating systems( Windows, Linux, Sun Solaris and Mac OS X)

A: Apache

M: MySQL

P: PHP

P: Perl

The webpage is an HTML page that has some java code integrated as an applet. The applet allows the user to control the vacuum. It simply reads in the command entered and

sends that command to the vacuum to perform [3].

40 if (state WAITING) {

theOutput = "Welcome... Server connection established";

state = SENTWELCOME; //change into a command state

} else if (state — SENTWELCOME) {

//Read sent command

if (theinput.equalsignoreCase(" forward")) {

//SEND FORWARD COMMAND

reseset();

rc.control();

rc.goForward();

state = WAITING;

}

This piece of code above is used to test out the connection with the server end and once the connection is established, it sends the Roomba into command mode [11]. In this case it will receive the command to move the vacuum forward so it will reset the Roomba connection and then send the requested command. The Roomba connection needs to be reset and this is simply because it will completely stop the previous command sent to it

and send the new one. This is such a seamless process that it does not appear that the

connection is reset but that a new command simply sent. All commands take this form..

The changes are be the input word sent to the system and the command sent to the

Roomba communication system.

41

Ch2 :: Iplnttn nd 6... xprntl nlt 5.1 Issues related to sending commands through Bluetooth

5.2 General overview of project

. I rltd t ndn nd thrh ltth The project did not run as smoothly as first anticipated. The majority of the problems that

were encountered were related to Bluetooth communications is some way.

he first issue encountered was that the Bluetooth receiver simply did not understand the

commands it was being sent. It would simply do what it is designed to do when it feels

ome that it receives does not pertain to itself and that is to simply drop whatever was

eig sent to it. The receiver would be receiving commands to move the Roomba vacuum

In \\ ever it would not understand them so it was ignoring them. Upon further inspection,

‘■ dvrd tht th ltth rvr ndd t b n nd d t b bl

pi ocess any commands. The receiver was sent into this mode when it was sent three

ling plus (+) values in serial HyperTerminal. This could also be saved in non-volatile

Jul Y on the Bluetooth chip so that this would not need to be done each time the chip

mlnected. By always having the chip in command mode, the Roomba vacuum

lids could be sent through Bluetooth at any time as long as the two devices are

issue encountered was that the Bluetooth transmitter could not send the

t( the receiver. After the Bluetooth devices are paired, a virtual

42 communication port is opened so that the two devices could communicate with each other. The Roomba commands are simply sent through this port. However, after the need to replace the transmitter, the new transmitter was not able to create this virtual communication port so the commands were simply being dropped before even being sent.

Even though the receiver was idly waiting in command mode, no command would ever reach it because the communication port was not set up. This issue was very difficult to

isolate simply because the program was working previously. A lot of time was spent trying to test if the client/server applications were communicating properly. There was

also the need to see if the web portion was actually prompting the server to send the

command to the Roomba. All of these tests showed that these applications were working

properly which indicated that Bluetooth had to be the issue. After stripping away all the

extras within the application and returning to the basics which had previously been

working, it was clear that the Bluetooth virtual communication port was not set up

because the commands were reaching the last point before being sent over and yet they

were not being sent. This issue could have been resolved had time constraints not arisen.

.2 Gnrl Ovrv f rjt I dying household appliances being controlled automatically through Bluetooth

ommunications is a very good idea and one that can be accomplished. Obviously, there

Nstrictions with Bluetooth communications however the web portion of the project

' Ply nd to be handled through standard TCP/IP procedures and the needed aspect to

' 11 ()I the Roomba vacuum can then be sent locally to the Roomba vacuum.

43 .2. Clntd Appltn The base idea of having a client side application would allow the user to control his

Roomba as long as he had access to the Internet. Upon arriving to the website, the user would be given a choice of commands to choose from and would select the command he would like the Roomba to perform. The client-side application is very important because it is the only part of the entire process the user actually sees so it does need to have some visual appeal. If the application is visually appealing and is easy to use, the user is more likely to want to use it again. Once the command has been selected, that command is sent from the client application to the server application.

IG OWA ACK SO

Ae, Mnd.

Figure 5.1 Client-Side Application Screenshot

44 .2.2 Srvrd Appltn The server-side application works in the background and the end-user would never

actually see this part of the project. The server-side application always needs to be running due to the fact that it will never know when a command will be sent to it so it

always needs to be ready to receive one. The server application will receive a command

from the client and will need to decipher which command needs to be sent to the Roomba vacuum. The client deals with users so it will speak a language the end-user will understand while the server application needs to speak a language the Roomba vacuum will understand so it will convert the command to a certain instruction the Roomba vacuum can understand. The server application also needs to know ahead of time which virtual communication port is being used between both Bluetooth modules. This part needs to be hard coded so that the server can always make connection with the Roomba.

There are usually only a couple Bluetooth communication ports available and since the

server application will always be running, the communication port will never need to

change [10].

45 C" a us 0. aa a. $o ,”". i 6gi ae .44 t l.. r..4044..,

' • • nnt:tn A: ,I. . St cg, asa44. Caici Ia iiek •a a Q0 iay • • • • o Ia • ya :I:24

e

Figure 5.2 Server-Side Application Screenshot

46 .2. b v The Roomba vacuum will simply be waiting idly however once the Bluetooth receiver which is attached to it will receive a command. It will pass that command on through the

serial cable and which will make the vacuum perform that operation. The vacuum, during noi nal use, will query the sensors before performing a certain operation. With the set up

of this particular system, the vacuum will completely ignore the sensors and blindly perform the operation it was sent. To have the sensors input, a two-way communication needs to be set up between the Bluetooth modules so that the server would query the vacuum sensors and wait for a response before a specific command can be sent to it. The two-way communication system may be problematic because of the Bluetooth modules being used. If the modules are of different classes, one module may not be able to communicate with the other simply because the second module would be out of range.

Figure 5.3 Roomba Vacuum

47

Chptr 6 Chptr Sr nd tr rtn 6.1 Chapter Summary

6.2 Future Directions

6. Chptr Sr In chapter 1, Bluetooth technology was briefly introduced and a short description was

given on what it does. My project was also described to provide the reader with a detailed

look at how I implemented a Bluetooth based home automation system and lastly I gave a

reason for why my thesis and this particular topic was chosen.

In chapter 2, a historical background of other wireless technologies was given along with

the different types of wireless technologies. The concept of Personal Area Network was

introduced and also it was shown how it relates to the Local Area Network. Lastly, a brief

description of an Internet Application was given and what its benefits and drawbacks are.

In chapter 3, Bluetooth technology was described at great length. A historical background

was given along with the aim of Bluetooth technology. Many of the current applications

for Bluetooth were given and also a layered structure for the technology was presented

and described in great detail.

In chapter 4, the architecture of the project was given and how each component of the

household automation works. The different components presented were the Roomba

vacuum, the power regulating circuit and the online availability of this project.

48 In chapter 5, any issues that were encountered during the implementation phase were presented and a description of what the problem occurred was given. Lastly, a general overview was given of the project along with some screenshots to show how the different aspects of the project worked.

6.2 tr rtn There are many different changes that can be made to inspire others to further continue with the research on Bluetooth. Bluetooth technology can be used to control many other possible devices. The possibilities are endless simply because there are so many possible benefits to using a short range wireless communication. To continue with my idea of online availability, it could be possible to add features which simplify the process of sending commands by having a certain pattern saved in memory so that the user simply has to make one mouse click and that entire pattern is sent to the Roomba vacuum. The idea of a piconet can be exploited where multiple devices can be controlled through the use of a central master point. The device does not need to be as large as a Roomba vacuum but can be scaled down to show the proof of concept of controlling multiple devices through one central point. The surface has only begun to be uncovered when it comes to Bluetooth technologies. There is much research left to do and many new applications to develop.

49 blrph

1 r C Strn "ltth 11 Cnnt tht bl" Snd dtn

M r MMhl Gltr "ltth End t End"

3 A n dlph "ltth Entl fr rrr" 7

S Chrbrt W S n n "A rtl Cntrlld ltth Enbld Envrnnt"

5 Mrtt-Wll "Wht ltth?" br -nr 5

"h ltth Spl Intrt Grp" http://www.bluetooth.com.

7 "Wrl Cntn" http://en.wikipedia.org/wiki/Wireless.

"rnl Ar tr" http://en.wikipedia.org/wiki/Personal area network.

9 "b v nvtn" http://home.howstuffworks.com/robotic- vacuum2.htm.

1 "Srvr ppltn" http://www.apachefriends.org/en/xampp.html.

11 "n b v" http://hackingroomba.com/

1 "OSI dl fr" http://aspalliance.com/1204 Computer Networking Concepts and Terminolog

5 Glr

ACL: Asynchronous ConnectionLess: the links used by Bluetooth to send data.

CRC: Cyclic Redundancy Checksum: a checksum generated by a polynomial which allows data integrity to be verified.

FEC: Forward Error Correctoin: an used to protect data on some Bluetooth packets.

HCI: Host Controller Interface: the interface which links a Bluetooth host to a Bluetooth module. Data, commands and events pass across this interface.

HEC: Header Error Check: a short code used by the receiving device to work out whether there are any errors in a received packet's header

ISM: Industrial, Scientific and Medical: a name for the frequency band Bluetooth uses.

L2CAP: Logical Link Control and Adaptation Protocol: layer of Bluetooth stack which provides segmentation and reassembly services to allow large packets to pass across Bluetooth links.

LED: Light Emitting Diode: A display technology that uses a semiconductor diode that emits light when charged.

LFSR: Linear Feedback Shift Register: a shift register that has feedback paths which take bits being shifted out of the register and feed them back into locations earlier in the shift.

LMP: Link Management Protocol: layer of Bluetooth stack which handles configuration and control of the Bluetooth baseband links.

MTU: Maximum Transmission Unit: the largest size packet pauload which a particular layer can handle.

OBEX: OBject EXchange protocol: layer of Bluetooth stack which allows devices to exchange arbitrary data objects.

OSI: Open Systems Interconnect: the goal of OSI is to provide standards which allow hosts to interoperate regardless of hardware and underlying operating systems.

PAN: Personal Area Network: a term describing the small, ad-hoc networks facilitated by Bluetooth, which join together a group of personal devices.

PPP: Point to Point Protocol: an Internet protocol which provides a standard way of transporting datagrams from many other protocols over point to point links.

51 QoS: Quality of Service: defines the bandwidth and latency a device can expect on a connection.

RFCOMM: Protocol for RS-232 serial cable emulation.

SCO: Synchronous Connection-Oriented: the links used by Bluetooth to send voice, these links use reserved time slots.

SDP: Service Discovery Protocol: a Bluetooth protocol which allows a client to discover the devices offered by a server.

SIG: Special Interest Group: the Bluetooth SIG is a group of all companies who have registered an interest in Bluetooth.

TCS: Telephony Control protocol Specification: part of the Bluetooth core specification which defines a signaling scheme for connecting voice and data calls.

UART: Universal Asynchronous Receiver Transmitter: a chip used for transmitting and receiving on serial interfaces.

UDP: User Datagram Protocol: a packet-based, unreliable, connectionless transport protocol which works over Internet Protocol.

UUID: Universally Unique IDentifier: a 128-bit number derived by a method which guarantees it will be unique.

VOIP: Voice Over Internet Protocol: A technology for transmitting voice, such as ordinary telephone calls, over packet-switched data networks.

WAP: Wireless Application Protocol: a communications protocol which aims to give mobile devices access to the Internet and other advanced data services.

WML: Wireless Markup Language: a language defined in the WAP specification which is used to define WAP web pages in the same way that HTML is used to define "ordinary" pages on the World Wide Web.

WUG: Wireless User Group: a group of devices supporting TCS with a Master that sends device information to all devices, enabling them to make fast connections to one another.

52