78

ahmed project

Embed Size (px)

Citation preview

Page 1: ahmed project
Page 2: ahmed project
Page 3: ahmed project

WIRELESS HEART RATE MONITOR

MOHAMMAD FAAIZ BIN JAMALUDDIN

This thesis is submitted as partial fulfillment of requirement for award of the

Bachelor Degree in Electrical Engineering (Electronics)

Faculty of Electrical Engineering

Universiti Teknologi Malaysia

MAY 2008

Page 4: ahmed project
Page 5: ahmed project

iii

Dedicated with deepest love to:

My beloved family for their support, guidance and love.

My dearest friends for being there whenever I needed them.

Page 6: ahmed project

iv

ACKNOWLEGEMENT

First of all, I would like to thank Allah for HIS firm hands in guiding me in

the course of completing this thesis writing. It is by HIS grace and mercy that I am

able to embark on the project within such a limited time. Alhamdulillah.

Second, I would like to express my gratitude and thanks to my supervisor,

PM Harun Bin Ismail, for his professional guidance, wisdom, endurance, advices,

motivation and encouragement throughout the project.

I also would like to thank all my fellow friends for their contribution in giving

me a moral support throughout the project development period. Last but not least, to

all my beloved family members who were always by my side to encourage, advice,

comfort, cherish and support me during this entire project.

Finally, I really appreciate to have this responsibility to finish this project.

This task has taught a lot of lesson and knowledge which would be valuable to me in

the future.

Page 7: ahmed project

v

ABSTRACT

This project consists of two subsystems, which are hardware system and

software system. Basically, the hardware system consists of microcontroller and

other electronic circuits for detecting the heart pulse rate. The software system

consists of application program to connect the Bluetooth dongle at the computer to

the Bluetooth transmission module and microcontroller.

There are a number of methods that can be used to detect the presence of the

heart pulse. For example, the ECG wave can be used to produce a synchronized pulse

corresponding to each beat of the heart. Other techniques utilize pressure differentials

due to the pulse or optical methods that cause the pressure pulse to interfere with a

light beam. The second part of this project is to construct a communication link

between the transmitter and receiver. The transmitter unit transmits electrical

impulses produced by the contraction of the heart to the receiver. The receiver

samples the heart rate over pre-determind time period. The last part of this project is

to view the signal wave of the heart on a PC. The challenge of this system

development is to develop the connection between Bluetooth transmission module,

and the hardware system which consists of sensor unit and microcontroller.

Page 8: ahmed project

vi

ABSTRAK

Projek ini mengandungi dua subsistem, iaitu sistem perkakasan dan sistem

perisian. Umumnya, sistem perkakasan terdiri daripada mikropengawal dan litar-litar

yang lain untuk mengesan kadar degupan jantung. Sistem perisian pula mengandungi

program- program aplikasi yang dapat berfungsi sebagai penghubung di antara

bluetooth dongle dan juga mikropengawal.

Terdapat pelbagai kaedah yang boleh digunakan untuk mengesan kehadiran

degupan jantung. Sebagai contoh, gelombang ECG boleh digunakan untuk

menghasilkan gelombang degupan jantung yang seragam untuk setiap degupan

jantung. Kaedah lain adalah dengan memanfaatkan kebezaan yang disebabkan oleh

degupan atau kaedah optik yang boleh menyebabkan tekanan degupan mengangu

pancaran. Bahagian kedua projek ini adalah sistem komunikasi di antara pemancar

dan penerima. Bahagian pemancar akan menghasilkan denyut elektrik yang

dihasilkan kepada penerima. Bahagian terakhir projek ini adalah memaparkan

gelombang degupan di komputer. Cabaran dalam pembinaan sistem ini adalah

pembinaan sistem komunikasi di antara unit pemancar bluetooth di mana

mengandungi bahagian pengesan denyut dan mikropengawal.

Page 9: ahmed project

vii

TABLE OF CONTENT

CHAPTER TOPIC PAGE

TITLE i

DECLARATION ii

DEDICATION iii

ACKNOWLEDGEMENT iv

ABSTRACT v

ABSTRAK vi

TABLE OF CONTENTS vii

LIST OF TABLES x

LIST OF FIGURES xi

LIST OF ABBREVATION xiii

LIST OF APPENDICES xv

1 INTRODUCTION

1.1 Background 1

1.2 Objective 2

1.3 Scope 3

1.4 Development Challenges 3

1.5 Thesis Outline 4

2 LITERATURE REVIEW

2.1 Heart Rate Sensor 5

2.1.1 Introduction 5

Page 10: ahmed project

viii

2.1.2 Photoelectric Plethysmography (PPG) 5

2.1.3 PPG Sensor Characteristics 6

2.1.4 PPG as a Source of Cardiovascular Information 7

2.2 Bluetooth 8

2.2.1 Bluetooth Application 8

2.2.2 What is Bluetooth? 9

2.2.3 Bluetooth Technology and Transceiver 11

2.3 Microcontroller 13

2.3.1 PIC16F877A 13

2.3.2 Universal Synchronous Asynchronous Receiver 17

Transmitter (USART)

2.3.3 USART Baud Rate Generator (BRG) 17

2.3.4 USART Asynchronous Mode 18

2.3.5 USART Asynchronous Transmitter 19

3 METHODOLOGY AND APPROACH

3.1 Tools Used 21

3.2 Assumptions 22

3.3 Project Methodology and Approach 22

3.4 Proposed System 24

4 SOFTWARE DEVELOPMENT

4.1 MicroC 26

4.2 Programming the Microcontroller 27

4.2.1 Transfer the program to PIC microcontroller 27

4.2.2 Baud rate 29

4.3 Setup PC for Bluetooth interface 30

4.3.1 USB dongle setup (IVT BlueSoleil) 30

4.4 UART setting 33

Page 11: ahmed project

ix

5 HARDWARE DEVELOPMENT

5.1 Heart Rate Sensor 36

5.2 Photoplethysmograph (PPG) 36

5.2.1 Sensor 37

5.2.2 Amplier 38

5.3 Microcontroller as host 40

5.4 Bluetooth 41

5.4.1 General Bluetooth Characteristics 41

5.4.2 What is Bluetooth Used For? 42

5.4.2 Manufacturers' Acceptance 42

6 RESULT AND DISCUSSION

6.1 Hardware 43

6.1.1 Sensor module 44

6.1.2 Microcontroller module 44

6.1.3 Bluetooth transmitter module 45

6.2 Result Analysis 46

6.3 Discussion 48

7 CONCLUSION AND SUGGESTION

7.1 Conclusion 49

7.2 Suggestions 50

REFERENCES 52

APPENDICES A-B 54-61

Page 12: ahmed project

x

LIST OF TABLES

NO. OF TABLES TITLE PAGE

2.0 Bluetooth Frequency Band 10

3.1 Baud Rate Formula 18

Page 13: ahmed project

xi

LIST OF FIGURES

NO. OF FIGURES TITLE PAGE

2.0 Host to host communication through Bluetooth 12

Transceivers

2.1 PICF877A pin diagrams 15

2.2 Block Diagram of PIC16F877A 16

2.3 USART Transmits Block Diagram 20

2.4 Asynchronous Meter Transmission 20

3.0 Proposed System 24

3.1 Setup/operation 25

4.1 mikroC IDE 27

4.2 PIC bootloader device 28

4.3 IC programmer graphical user interface (GUI) 29

4.5 Bluetooth setup 30

4.6 Searching for devices 31

4.7 Service Discovery finished 32

4.8 Bluetooth setup for port 33

4.9 Bluetooth connection 33

4.10 Flow chart for microcontroller to communicate with 34

Bluetooth transceiver.

5.0 Sensor 38

5.1 Constructing the sensor 38

5.2 Pulse plethysmograph amplifier circuit 39

5.3 Schematic of Bluetooth module with PIC16F877A 40

6.0 Sensor module 44

6.1 5 volt power supply 45

6.2 Microcontroller 45

Page 14: ahmed project

xii

6.3 Bluetooth module 46

6.4 Hardware overview 46

6.5 Amplifier 47

Page 15: ahmed project

xiii

LIST OF ABBREVIATIONS

A - Ampere

PC - Personal Computer

LANs - Local Area Network

PAN - Personal Area Network

USB - Universal Serial Bus

CPU - Central Processing Unit

EEPROM - Electricity Erasable Read-Only Memory

GUI - Graphic User Interface

IR - Infrared

MCU - Microcontroller Unit

PIC - Programming Interrupt

RAM - Read Access Memory

ROM - Read Only Memory

V - Voltage

DC - Direct current

D.O.F - Degree of freedom

RF - Radio Transceiver

LM - Link Manager

SPP - Serial Port Profile

USART - Universal Synchronous Asynchronous Receiver Transmitter

BRG - Baud Rate Generator

MEDAC - Medical Association Counsils

PPG - Plethysymography

IBI - Inter beat interval

ISM - Indusrial Scientific Medical

SCI - Serial Communication Interface

Page 16: ahmed project

xiv

DECT - Digital Enhanced Cordless Telecommunications

IrDA - Infrared Data Association

WDT - Watch Dog Timer

VLSI - Very Large Scale Integrated

FH - Frequency Hop

Page 17: ahmed project

xv

LIST OF APPENDICES

NO. OF APPENDIX TITLE PAGE

A KC-21 Wirefree Bluetooth module 54

B Programming Source Code 60

Page 18: ahmed project

1

CHAPTER 1

INTRODUCTION

This chapter discusses the term Plethysmograhpy. Why do we need to use

wireless? This question will be considered in details in this chapter. The objectives and a

brief review on some of the Bluetooth module will also be presented in this chapter.

1.1 Background

Telemedicine is the most important step in cutting costs and increasing service

quality in health care [1]. The traditional telemedicine systems mostly enable

communication between health professionals in order to give doctors in remote locations

access to specialist’s knowledge and monitoring of patients remotely for home care or

emergency applications. Essentially, these systems provide an extension of hospital

environment and connect diagnostic equipment at home with hospitals using fixed

telephone or satellite networks. Although these systems provide many benefits for its

users there are still many limitations.

Page 19: ahmed project

2

One of the main limitations is the lack of mobility that hinders their usage in

many scenarios. Beside that, a more general problem of today’s health care is the

insufficient availability of data conceding the status and medical history of the patient,

both to the medical personnel and to the patient himself. Frequent measurements of vital

signs could give indications about the current status of chronic illnesses and are necessary

for optimization of the treatment, but would incur significant cost.

Recent advancements in development of short-range (Bluetooth) and wide area

wireless technologies have made possible development of new generation of telemedicine

systems that should provide mobile, wearable and flexible health monitoring systems.

Such systems will enable constant monitoring of health data and constant access to the

patient regardless of patient’s current location or activity and with a fraction of cost of the

regular face-to-face examination [2].

1.2 Objective

The main objective of this project is to construct a heart rate monitor by using the

wireless transmission to a receiver which displays the heart rate measured in beats per

minute.

Basically, the system consists of software and hardware system. The software

consists of Bluetooth file transfer module. At hardware part, system consists of heart rate

detector circuits and microcontroller circuits. The microcontroller is continuously waiting

for the data from censor circuits before transmit the data to Bluetooth module.

Page 20: ahmed project

3

1.2 Scope

The scope of the project covers the construction of the following modules;

• Sensor module

• Transmitter Module

• Receiver Module

• Base Station Module

This project also makes use of microC programming to program microcontroller

and use Bluetooth device to transmit and receive signal.

1.4 Development Challenges

The main challenge for this project is to build a Bluetooth connection between the

computer and the Bluetooth device. At the computer, before a Bluetooth connection is

established some settings need to be done at computer such as device management and

device discovery. At the hardware part, in order to connect to the computer, command is

send from the microcontroller to KC-21 (Bluetooth Device).

Another challenge is the unstable and high sensitivity nature of the KC-21. As

KC-21 is very sensitive, every time when the input voltage is changed, the Bluetooth

connection will be lost. This problem always occurs when the sensor circuit is on. When

sensor circuit is on, input voltage for KC-21 will change as more voltage is needed at the

sensor circuit. In order to solve this problem, 2 power supplies are needed; 1 for the

Bluetooth and the other 1 for the sensor circuits.

Page 21: ahmed project

4

1.5 Thesis Outline

Chapter two covers the details of research undertaken at the start of the project.

Bluetooth profile, Bluetooth architecture and Bluetooth protocol as well as useful books

and websites on relevant topics are covered extensively. Introduction to

Plethysysmography and microcontroller are also discussed in this chapter.

Chapter three entitled “Methodology and Approach” discusses the overall system

of the project. Block diagrams of the project system are formed based on the research

conducted. The system functionality is also covered in this chapter.

Chapter four describes the software development for the Bluetooth system. This

chapter is divided into three parts: Bluetooth setting, sensor circuit setting and

microcontroller Assembly language. Bluetooth setting discusses the procedure to set up a

wireless serial port connection by using Bluesoleil program.

In chapter five, hardware development is discussed. This chapter covers the

circuit diagram for PIC microcontroller, KC-21 (Bluetooth Device) and PPG sensor.

Tools like PPG sensor and USB Bluetooth Adapter will also be discussed in this chapter.

In chapter six, the different function of the project including both hardware and

software are reviewed. This chapter also uses scenario to reflect the project flow in a

systematic way. A conclusion is drawn in the chapter six. Chapter six also discussed any

possible new project that could be extended from current project and any improvement

that could be made.

Page 22: ahmed project

5

CHAPTER 2

LITERATURE REVIEW

2.1 Heart Rate Sensor

2.1.1 Introduction

When the heart beats, a pressure wave moves out along the arteries at a few

metres per second (appreciably faster than the blood actually flows). This pressure wave

can be felt at the wrist, but it also causes an increase in the blood volume in the tissues,

which can be detected by a plethysmograph [9].

2.1.2 Photoelectric Plethysmography (PPG)

The hardware and software for the MEDAC photoelectric plethysmograph

(PPG) represent an integrated system for real time monitoring of relative changes in

peripheral blood flow and for recording heart rate using an easy to attach sensor. Under

appropriate conditions, the software can derive the following measures from the PPG

signal: relative blood volume pulse height, pulse wave rise time, pulse wave fall time, the

inter-beat-interval (IBI), and heart rate [2,3].

Page 23: ahmed project

6

Plethysmography is a generic term referring to a variety of techniques for

monitoring volume changes in a limb or tissue segment. Volume changes occur in a

pulsatile manner with each beat of the heart as blood flows in and out of a portion of the

body. The study of vascular activity by fluid displacement methods dates back to at least

1890. More contemporary techniques include strain gauge, pneumatic, impedance,

doppler, and photoelectric plethysmography [2].Photoelectric plethysmography (PPG)

was developed in both Germany and the United States in the 1930's [3,4]. Recent

advances in photoelectronics make it possible to utilize photoelectric plethysmography as

a sensitive physiological monitoring technique that may be practically applied in a

clinical setting.

A reflectance PPG sensor contains a light source to illuminate a segment of tissue

(finger tip, ear lobe, etc.) and a photodetector to monitor returning light. Living tissue is

transparent to red and infrared light while nonhemolized blood is relatively opaque in this

spectral range. Consequently, light in the appropriate frequency range will be absorbed

by whole blood. As the blood volume changes (increases or decreases), the amount of

light absorbed or reflected will change as well.

In a typical application, the PPG sensor might be placed on a finger. With each

heart beat, a surge of blood is forced through the vascular system, expanding the

capillaries in the finger, and changing the amount of light returning to the photodetector.

The electrical resistivity of the photodetector changes as a function of the amount of light

falling on it. This change in resistance results in a change in the electrical current flowing

through the detector circuit. In this way, the dynamic activity of the vasculature is

translated into a signal that can be monitored electronically [5].

2.1.3 PPG Sensor Characteristics

The PPG detection assembly consists of a reflectance transducer with an integral

thermistor located proximal to the optical site. The light source utilizes two infrared

emitters with principal spectral output at 940nm, sufficiently close to the isobestic point

Page 24: ahmed project

7

of hemoglobin to make it virtually immune to variations in oxygen saturation [4]. The

effects of oxygen saturation (SaO2) upon optical absorption can be as great as 3.5:1 at

660nm, while they are negligible in this range.

The receiver is a large area PIN photodiode in a back-biased current metering

configuration, which provides low noise and high optical linearity, particularly in

comparison with cadmium-sul_de photocells. The NeuroDyne PPG includes an ambient

light level compensation circuit to minimize the influence of any variation in background

illumination. The light weight and small size (0.5 x 1.0 x 0.2") of the PPG sensor

assembly, coupled with the high signal-to-noise ratio of the optical system, allows

monitoring of peripheral flow in sites such as the fingertip, earlobe, toe, carotid artery,

temporal artery, and supraorbital artery [5].

2.1.4 PPG as a Source of Cardiovascular Information

The surge of blood through the vasculature with each cardiac cycle is known as

the pulse pressure wave or blood volume pulse. The ability to monitor the blood volume

pulse on a beat to beat basis provides a graphic display of the dynamic activity of the

cardiovascular system that can not be obtained with an indirect measure like skin

temperature.

In addition to monitoring the raw PPG wave form, NeuroDyne software routines

are designed to detect the peaks and troughs of each pulse pressure wave. Having

identified an individual wave, the software calculates relative pulse height, pulse wave

rise time, and fall time. The interval between pulse wave peaks corresponds to the inter-

beat-interval of the heart (IBI).

In most recording circumstances, variations in the height of the wave (pulse

height) are primarily related to changes in the relative degree of constriction or dilation of

the peripheral vasculature (discussion of exceptions below). Increases in the height of the

blood volume pulse are generally a function of increased blood flow (vasodilatation) and

Page 25: ahmed project

8

decreases correspond to decreased blood flow (vasoconstriction). The actual form (shape)

of the wave is indicative of the overall tone of the vasculature.

Though not commonly encountered in clinical biofeedback monitoring situations,

changes in cardiac output can exert an influence on the height of the pulse pressure wave.

If peripheral resistance remained constant and cardiac output increased, then pulse height

would be expected to increase. Cardiac output is a function of stroke volume X heart rate.

Significant increases in cardiac output generally occur with vigorous exercise and

extreme arousal, and decreases occur with cardiac failure [5].

2.1.5 Using the PPG Clinically

Instructions for attaching the PPG sensor, reducing the likelihood of artifact, and

limitations on PPG recording can be referred from the internet. Using the PPG Sensor,

Pulse height and heart rate information are frequently used in stress assessment

monitoring and as clinical biofeedback modalities in work with hypertension, migraine

headache, Raynaud's Disease, and in generalized relaxation training. Pulse height

feedback is generally directed at increasing the height of the pulse pressure wave which,

as described above, normally corresponds to increased vasodilatation. It is recommended

that heart rate and skin temperature be monitored as numeric displays whenever you are

carrying out pulse height training; access to these additional measures will provide the

broadest information on cardiovascular activity [11].

2.2 Bluetooth

2.2.1 Bluetooth Application

Living in a wireless world is not so far away. Bluetooth may be the technology

that brings us closer to that end. It is estimated that before 2002, Bluetooth will be a

built-in feature in more than 100 million mobile phones and in several million other

Page 26: ahmed project

9

communication devices, ranging from headsets and portable PC’s to desktop computers

and notebooks. Bluetooth is designed to operate at 2.400-2.4835 (GHz) with up to 1

Mbps. Bluetooth is designed to work in conjunction with other Third Generation (3G)

technologies. The Bluetooth technology is the foundation of the new IEEE 802-15

WPAN Standard (Wireless Private Area Network). Bluetooth and IEEE standards groups

are currently working on potential interference issues between 802-11 that covers

wireless LANS and 802-15. IEEE has formed the 802-15 Coexistence Task Group 2 in

an effort to resolve these interference issues. Bluetooth can also be a complimentary

technology of other wireless standards such as DECT (Digital Enhanced Cordless

Telecommunications) and IrDA (Infrared Data Association). It is believed Bluetooth

technology has the potential to change the way we think about being “connected”. Using

Bluetooth and Third Generation (3G) telephony we could truly be wirelessly connected to

everything around us that is Bluetooth enabled [14].

2.2.2 What is Bluetooth?

Bluetooth is a de-facto open standard for short-range digital radio. It is designed

to operate in the unlicensed ISM (Industrial, Scientific, Medical applications) band,

which is generally available in most parts of the world, refer to table 2.0. The

specification includes air interface protocols to allow several Bluetooth applications to

intercommunicate simultaneously, and to overcome external sources of interference such

as domestic and commercial microwave ovens. The short range referred to above is

defined as up to 10 meters in normal operation although greater range/penetration can be

achieved through higher output powers under some circumstances [13].

Page 27: ahmed project

10

Table 2.0: Bluetooth Frequency Band

AREA FREQUENCY

BAND (GHz)

BLUETOOTH

CHANNELS

USA, Europe

and most other

countries

2.400 - 2.4835 79

Spain 2.445 - 2.475 23

France 2.4465 - 2.4835 23

The aim of the promoters of Bluetooth is to enable the intercommunication of just

about any piece of apparatus with any other and consequently one of the main constraints

on the design must be cost. When the Infra Red Interface, common on mobile phones and

PCs today, was conceived it was understood that to persuade equipment manufacturers to

implement this interface, the cost of implementation had to be low. The target cost, set at

$5, was achieved and more than 90% of portable PCs and an increasing number of

mobile phones now have an IR interface built-in.

A sophisticated radio interface is more complicated (and more flexible) than the

IR interface and therefore more expensive. The price target of $10 per unit however

seems to be realistic especially if all our homes will eventually have half a dozen or so

Bluetooth equipped items operating in them, driving quantities to very high numbers.

In addition to cost, size matters. With ever-decreasing form factors and weight,

any new addition to a piece of electronic apparatus must be small, light and consume

minimum power from the host system or separate battery. The Bluetooth implementation

is feasible in a very small footprint comprising a single chip and associated RF

components, and should be relatively easy to install in anticipated applications. Its low

output power and sophisticated power conservation design, ensures minimum power

consumption.

Bluetooth has the potential for impacting many areas, including applications that

would have been inconceivable a few years ago e.g. a fridge-freezer telling a microwave

Page 28: ahmed project

11

oven what ingredients are available, allowing the microwave to suggest menu options!

However, one particular area where Bluetooth will have a significant impact is in the

support of other wireless delivery mechanisms such as cellular telephony. While national

networks are suited to delivering communication on the move or wireless to any location,

purely local interconnection is better handled by a local communication system.

To deliver telephony based services from one undefined location to another, and

to distribute the services and functions at those locations requires a hybrid solution, at the

core of which is a cellular handset with a built-in Bluetooth transceiver.

2.2.3 Bluetooth Technology and Transceiver

Bluetooth Technology is standard for short-range radio communication. It is a

low cost bi-directional (2 ways) wireless interface between mobile devices that provides

low power consumption. Bluetooth Transceiver referring to Bluetooth Transmitter and

Receiver and every Bluetooth node has Bluetooth Transceiver. The aim is to eliminate

the usage of cables. Bluetooth system operates in worldwide unlicensed 2.4GHz

Industrial-Scientific-Medical (ISM) frequency band. Bluetooth devices can form a

network. The basic network is Piconet where there are a master node and other act as

slave node/s. At least 2 nodes are required to form Bluetooth network, either one of the

nodes can be master. The role of master is just to search and initiate the connection, once

the link is established; the role of each node is equal.

Page 29: ahmed project

12

Figure 2.0: Host to host communication through Bluetooth Transceivers

Bluetooth transceiver is a wireless transceiver that transmits and receives signal

wirelessly through Bluetooth protocol, thus a host, or in other words a controller is

necessary if data processing is required in the application. As shown from the above

figure 2.0, there are two hosts (Host 1 and 2, it can be microcontroller, computer, PDA,

etc) and two Bluetooth transceivers. Both host need to communicate (exchange data),

while Bluetooth transceiver is the tools to transfer the data between host. Thus, to process

data and operate Bluetooth transceiver, a controller is necessary. There are few methods

to connect Bluetooth transceiver to host, where most common used are UART and USB.

KC Bluetooth transceiver use UART to communicate. SPP (Serial Port Profile) is a

Bluetooth standard profile which provides the platform for a host to communicate with

Bluetooth transceiver serially [13,15].

Page 30: ahmed project

13

2.3 Microcontroller

Microcontroller is a very large scale integration chip (VLSI chip) and

implemented into a single chip. A microcontroller contains the following features:

• Built-in memory (ROM and RAM)

• Timer

• Analog to digital converter

• Serial I/O interfaces

• Parallel I/O interfaces

2.3.1 PIC16F877A

The PIC16F877A microcontroller [21] from Microchip is chosen since its

easiness to use, high speed and its cost compare to other microcontrollers. PIC16F877A

microcontroller has the following features:

• High performance RISC CPU

• Only 35 single word instructions to learn

• Operating speed: DC - 20 MHz clock input

• DC - 200 ns instruction cycle

• Up to 8K x 14 words of FLASH Program Memory,

• Up to 368 x 8 bytes of Data Memory (RAM)

• Up to 256 x 8 bytes of EEPROM Data Memory

• Pinout compatible to the PIC16C73B/74B/76/77

• Watchdog Timer (WDT) with its own on-chip RC oscillator for reliable operation

• Programmable code protection

• Low power, high speed CMOS FLASH/EEPROM technology

• Fully static design

Page 31: ahmed project

14

• Single 5V In-Circuit Serial Programming capability

• In-Circuit Debugging via two pins

• Processor read/write access to program memory

• Low-power consumption

• Synchronous Serial Port (SSP) with SPI� (Master mode) and I2C�

(Master/Slave)

• Universal Synchronous Asynchronous Receiver Transmitter (USART/SCI) with

9-bit address detection

• Parallel Slave Port (PSP) 8-bits wide, with external RD, WR and CS controls

(40/44-pin only)

Figure 2.1 shows the PIC16F877A pin diagrams and Figure 2.2 shows the Block

diagram of PIC 16F877A.

Page 32: ahmed project

15

Figure 2.1: PICF877A pin diagrams

Page 33: ahmed project

16

Figure 2.2 Block Diagram of PIC16F877A

Page 34: ahmed project

17

2.3.2 Universal Synchronous Asynchronous Receiver Transmitter (USART)

Transmitter (USART) module is one of the two serial I/O modules. (USART is

also known as a Serial Communications Interface or SCI) [17,21]. The USART can be

configured as a full duplex asynchronous system that can communicate with peripheral

devices such as CRT terminals and personal computers, or it can be configured as a half

duplex synchronous system that can communicate with peripheral devices such as A/D or

D/A integrated circuits, serial EEPROMs etc. The USART can be configured in the

following modes:

• Asynchronous (full duplex)

• Synchronous - Master (half duplex)

• Synchronous - Slave (half duplex)

Bit SPEN (RCSTA<7>) and bits TRISC<7:6> have to be set in order to configure

pins RC6/TX/CK and RC7/RX/DT as the Universal Synchronous Asynchronous

Receiver Transmitter. The USART module also has a multi-processor communication

capability using 9-bit address detection.

2.3.3 USART Baud Rate Generator (BRG)

The BRG supports both the Asynchronous and Synchronous modes of the

USART. It is a dedicated 8-bit baud rate generator. The SPBRG register controls the

period of a free running 8-bit timer. In Asynchronous mode, bit BRGH (TXSTA<2>)

also controls the baud rate. In Synchronous mode, bit BRGH is ignored.

Table 2.1 shows the formula for the computation of the baud rate for different

USART modes which only apply in Master mode (internal clock). Given the desired baud

Page 35: ahmed project

18

rate and FOSC, the nearest integer value for the SPBRG register can be calculated using

the formula in Table 2.1. From this, the error in baud rate can be determined. It may be

advantageous to use the high baud rate (BRGH = 1), even for slower baud clocks. This is

because the FOSC/(16(X + 1)) equation can reduce the baud rate error in some cases.

Writing a new value to the SPBRG register causes the BRG timer to be reset (or

cleared). This ensures the BRG does not wait for a timer overflow before outputting the

new baud rate.

Table 2.1: Baud Rate Formula

2.3.4 USART Asynchronous Mode

In this mode, the USART uses standard non-return-tozero (NRZ) format (one

START bit, eight or nine data bits, and one STOP bit). The most common data format is

8-bits. An on-chip, dedicated, 8-bit baud rate generator can be used to derive standard

baud rate frequencies from the oscillator. The USART transmits and receives the LSb

first. The transmitter and receiver are functionally independent, but use the same data

format and baud rate. The baud rate generator produces a clock, either x16 or x64 of the

bit shift rate, depending on bit BRGH (TXSTA<2>). Parity is not supported by the

hardware, but can be implemented in software (and stored as the ninth data bit).

Asynchronous mode is stopped during SLEEP. Asynchronous mode is selected by

clearing bit SYNC (TXSTA<4>). The USART Asynchronous module consists of the

following important elements:

Page 36: ahmed project

19

• Baud Rate Generator

• Sampling Circuit

• Asynchronous Transmitter

• Asynchronous Receiver

2.3.5 USART Asynchronous Transmitter

The USART transmitter block diagram is shown in Figure 2.3. The heart of the

transmitter is the transmit (serial) shift register (TSR). The shift register obtains its data

from the read/write transmit buffer, TXREG. The TXREG register is loaded with data in

software. The TSR register is not loaded until the STOP bit has been transmitted from the

previous load. As soon as the STOP bit is transmitted, the TSR is loaded with new data

from the TXREG register (if available). Once the TXREG register transfers the data to

the TSR register (occurs in one TCY), the TXREG register is empty and flag bit TXIF

(PIR1<4>) is set. This interrupt can be enabled/disabled by setting/clearing enable bit

TXIE ( PIE1<4>). Flag bit TXIF will be set, regardless of the state of enable bit TXIE

and cannot be cleared in software. It will reset only when new data is loaded into the

TXREG register. While flag bit TXIF indicates the status of the TXREG register, another

bit TRMT (TXSTA<1>) shows the status of the TSR register. Status bit TRMT is a read

only bit, which is set when the TSR register is empty. No interrupt logic is tied to this bit,

so the user has to poll this bit in order to determine if the TSR register is empty.

Transmission is enabled by setting enable bit TXEN (TXSTA<5>). The actual

transmission will not occur until the TXREG register has been loaded with data and the

baud rate generator (BRG) has produced a shift clock (Figure 2.4). The transmission can

also be started by first loading the TXREG register and then setting enable bit TXEN.

Normally, when transmission is first started, the TSR register is empty. At that point,

transfer to the TXREG register will result in an immediate transfer to TSR, resulting in an

empty TXREG. A back-to-back transfer is thus possible. Clearing enable bit TXEN

during a transmission will cause the transmission to be aborted and will reset the

transmitter. As a result, the RC6/TX/CK pin will revert to hi-impedance. In order to

Page 37: ahmed project

20

select 9-bit transmission, transmit bit TX9 (TXSTA<6>) should be set and the ninth bit

should be written to TX9D (TXSTA<0>). The ninth bit must be written before writing

the 8-bit data to the TXREG register. This is because a data write to the TXREG register

can result in an immediate transfer of the data to the TSR register (if the TSR is empty).

In such a case, an incorrect ninth data bit may be loaded in the TSR register [21].

Figure 2.3: USART Transmits Block Diagram

Figure 2.4: Asynchronous Meter Transmission

Page 38: ahmed project

21

CHAPTER 3

METHODOLOGY AND APPROACH

This chapter discusses similar projects and also the aspects or factors that

must be taken into consideration in developing the project. This chapter also discusses

the design stage including the electronic design, hardware design and material selection.

This chapter also describes the tools used, assumptions, methodology and approach of

the project as well as the software development flow, hardware development flow of the

proposed system.

3.1 Tools Used

Basically, the system consists of both software and hardware system.

• Hardware

o Infrared LED and phototransistor LED is used to detect the pulse rate at

finger.

o CYTRON L4128D PIC programmer is used to load .HEX file into

Microcontroller.

o KC Wirefree Bluetooth Module Starter Kit SKKCA-21 is used as wireless

Page 39: ahmed project

22

module.

o Bluetooth USB Dongle is used as wireless adapter at computer.

• Software

o mikroC software is used to write programming source code for the

microchip microcontroller.

o IC Prog is used to load the .HEX file from the assembly language to the

microchip microcontroller.

o Bioexplorer program is used to detect the devices and view the heart rate

signal.

3.2 Assumptions

Some assumptions were made in this project:

• The distance between the computer and sensor is not more than 20

meter.

• The heart rate pulse will not be fully accurate because of surrounding

effect such as, heat and light.

3.3 Project Methodology and Approach

The project is started with the software development. Software provides this

project with strong, reliable and stable framework. Hardware is developed in later stage

to refurnish the system with some necessary functions. Below are the procedures set for

the project implementation:

1. Research on necessary project components

Finding suitable software and hardware for project

Page 40: ahmed project

23

2. Case study on Bluetooth in items tracking

Study how Bluetooth transmits and receives signal

3. Identify suitable hardware for the project

Choose the suitable Bluetooth and sensor for the project

Choose the suitable microcontroller

4. Identify the tools for the project

• Software

IC Prog used for loading the .HEX file into microcontroller.

mikroC software is used to write the source code for the microchip

microcontroller.

Bioexplorer program is used to detect the devices and view the heart rate

signal.

• Hardware

Find Bluetooth hardware with suitable operating profile.

Suitable microcontroller is chosen and all suitable components for sensor

circuit is listed out.

5. Software Development

• Learn software language.

6. Hardware Development

• Integrated the complete software part with Bluetooth.

• Test and verify software in the new environment.

• Test and debug overall system complete with software and hardware part.

• Enhance the system reliability and stability.

Page 41: ahmed project

24

3.4 Proposed System

Figure 3.0: Proposed System

Figure 3.0 shows the proposed system for the project. The pulse rate will be

detected by using PPG method. The sensor unit (clothes peg) is clamped on the patient’s

finger. The data from this module will be sent to the Analog Digital Converter and

UART. Data from this module will then be sent to the Bluetooth Module.

From the Bluetooth module, the data will be sent to the USB dongle which is

interfaced to the computer. Communication link between Bluetooth module and USB

dongle will be establisbed by using Bluesoliel program. Finally, Bioexplorer program

will view the signal from the devices connection. Figure 3.1 shows the proposed setup

and operation for the wireless module.

Sensor Module ADC UART Bluetooth Module

Bluetooth USB doggle

Pulse

Computer

Page 42: ahmed project

25

Figure 3.1: Setup/operation

Page 43: ahmed project

26

CHAPTER 4

SOFTWARE DEVELOPMENT

The Bluetooth module (KC-21) is capable of sending data to the computer. This

chapter explains the software design as well as the implementation of the Bluetooth

setting based on the methodology and scope mentioned earlier. It gives a more detailed

explanation of what is done with software development. The programming tools used are

microC, IC Prog and Bioexplorer.

4.1 MicroC

MikroC is a powerful, feature rich development tool for PICmicros. It is designed

to provide the programmer with the easiest possible solution for developing applications

for embedded systems, without compromising performance or control.

PIC and C fit together well: PIC is the most popular 8-bit chip in the world, used

in a wide variety of applications, and C, prized for its efficiency, is the natural choice for

developing embedded systems. MikroC provides a successful match featuring highly

advanced IDE, ANSI compliant compiler, broad set of hardware libraries, comprehensive

Page 44: ahmed project

27

documentation, and plenty of ready-to-run examples. Figure 4.1 shows the microC

Integrated Drive Electronics (IDE).

Figure 4.1: mikroC IDE

4.2 Programming the Microcontroller

The first step is to install the software, featuring on how to setup microC and boot

loader for the purpose of programming and burning the program into the microcontroller.

C language is used as the programming language for the microcontroller.

4.2.1 Transfer the program to PIC microcontroller

IC prog was developed by Bonny Gijzen as a tool to load a program into

microcontroller's EEPROM. This specially design software fit with any version of

Microchip microcontroller. The procedure for using the IC prog is as follows:

Page 45: ahmed project

28

i. Switch on the PC.

ii. Connect the microcontroller board to the parallel port of the PC.

iii. Run the IC prog.

iv. Set the device for the microcontroller.

v. Set the oscillator and the write enable.

vi. Click file open and select .HEX file.

vii. Click program all to burn the entire HEX file into EEPROM.

viii. IC prog will verify the code.

ix. If there is no error, the HEX file is successfully loaded to the chip.

x. Release the cable that attach to PC parallel port.

xi. Chip is ready to use.

Figure 4.2 shows the PIC bootloader device. This is Universal Serial Bus

(USB) type which can directly be attached to the computer. The other type is

serial communication type. Figure 4.3 shows the process of burning program

onto the PIC microcontroller using GUI.

Figure 4.2: PIC bootloader device

Page 46: ahmed project

29

Figure 4.3: IC programmer graphical user interface (GUI)

4.2.2 Baud rate

The default baud rate for SKKCA-21 is 115200. The following code illustrates

how to configure the baud rate of SKKCA-21.

Page 47: ahmed project

30

4.3 Setup PC for Bluetooth interface

4.3.1 USB dongle setup (IVT BlueSoleil)

Before the USB dongle can be used, a communication link has to be established

between the Bluetooth Module and Bluetooth Dongle using IVT BlueSoleil. Following

are the steps of installing and establishing a link between the two;

• Install the software IVT BlueSoleil using CD included with the USB dongle

• Once the software has been successfully installed, plug in the USB dongle

and run the software

• Switch on the power for the circuit with the SKKCA-21

• On the screen, you should be able to see a window as in figure 4.5. Click the

orange ball in the center of the window or press F5

Figure 4.5: Bluetooth setup

Page 48: ahmed project

31

• Once the Bluetooth module is detected, it will appear in the window. Figure

4.6 shows the program searching for devices and Figure 4.7 shows the

discovery finished.

Figure 4.6: Searching for devices

• Next, double click on the symbol of the Bluetooth module. The software

will automatically select the method to connect with the Bluetooth device.

Page 49: ahmed project

32

Figure 4.7: Service Discovery finished

• Right click on the symbol to select Connect->Bluetooth serial port service. Figure

4.8 shows the setup for Bluetooth port.

Page 50: ahmed project

33

Figure 4.8: Bluetooth setup for port

• A window will appear with the designated serial port. Click yes to proceed.

Figure 4.9 shows the Bluetooth connection that has been established.

Figure 4.9: Bluetooth connection

4.4 UART setting

Of course, there must be some configurations for microcontroller too. The most

important configuration is UART. UART depends on timing or the baud rate, therefore

the most important task is to configure the baud rate of microcontroller.

Page 51: ahmed project

34

The UART is configured making it ready to communicate with Bluetooth

module. The settings are:

i. Baud rate = 115200 bps or 115.2 Kbps

ii. Data bits = 8

iii. Parity = none

iv. Stop bit = 1

The settings have to be done using programming language of the microcontroller.

As an example, for PIC microcontroller, developer has to use assembly language or C

language to configure these settings.

Figure 4.10: Flow chart for microcontroller to communicate with Bluetooth

transceiver

Page 52: ahmed project

35

Figure 4.10 shows a flow chart of general concept for microcontroller to

communicate and process data from KC Wirefree Bluetooth transceiver. After

configuring UART engine of microcontroller, program should wait for data from

UART’s receiver buffer. Store the received data array and checked whether the “Enter” is

received. If “Enter” is not yet received, continue to wait and keep receiving data. If

“Enter” is received, process the data array stored and decide which mode to enter or

which AT command to be sent? For example, when the received array of data is “ATZV

BDAdress 00043E008137”, microcontroller should send “AT+ZV SPPConnect

000000E41213” to Bluetooth transceiver. This data array should be sent to transmitter

buffer. If “AT-ZV –BypassMode–” is received, the microcontroller has entered bypass

mode and AT command should NOT be sent to Bluetooth transceiver, except RMC is

used. This is an example of programming concept, a better algorithm can be written for

microcontroller. What is AT command? AT command is a language originally used by

modem. Now it has been applied in Bluetooth SPP. Every AT command start with AT

and end with “enter” or <CR><LF> (i.e. “<CR>\n” in C, or in Hex value is 0x0D 0x0A).

Some common description of AT command in KC Serial:

• “AT+parameter” is command send from host to module or serial adaptor.

• “AT–parameter” is command send from module to host.

• Every AT command must start with “AT” or 0x41 0x54 in Hex value.

• Every AT command must be ended with “Enter” or 0x0D 0x0A in Hex value.

There are 2 modes in Bluetooth configuration. First mode is Command mode, this

mode indicate that all data send from host is a command for Bluetooth transceiver, and

data send from Bluetooth transceiver to host is event reporting status of Bluetooth

transceiver. Second mode is Bypass mode, this mode can only appear when connection

between 2 Bluetooth transceivers is established. In Bypass mode, every single byte of

data from host will be sent over Bluetooth wireless link to the other Bluetooth node.

Page 53: ahmed project

36

CHAPTER 5

HARDWARE DEVELOPMENT

5.1 Heart Rate Sensor

5.2 Photoplethysmograph (PPG)

A photoplethysmograph (PPG) is an optically obtained plethysmograph, a

volumetric measurement of an organ. A PPG is often obtained by using a pulse oximeter

which illuminates the skin and measures changes in light absorption [5]. A conventional

pulse oximeter monitors the perfusion of blood to the dermis and subcutaneous tissue of

the skin.

Plethysmograph comes from the Greek "plethysmos" for increase and is a term

for a "fullness" (ie change in volume) measuring device. Over the years, all sorts of

Heath-Robinson devices have been used but described here is a photoelectric pulse

plethysmograph, which is robust and easy to make and which will allow the beating of

the heart to be recorded without the need to make direct electrical connections to the

body [7].

Page 54: ahmed project

37

5.2.1 Sensor

The sensor consists of a light source and photodetector; light is shone through the

tissues and variation in blood volume alters the amount of light falling on the detector.

The source and detector can be mounted side by side to look at changes in reflected light

or on either side of a finger or earlobe to detect changes in transmitted light. The

particular arrangement here uses a wooden clothes peg to hold an infra red light emitting

diode and a matched phototransistor. The infra red filter of the phototransistor reduces

interference from fluorescent lights, which have a large AC component in their output.

Figure 5.0: Sensor

The peg is drilled with 3mm holes to take the led, the phototransistor, the pair of

wires linking the two and the 2-core screened output cable, as shown in figure 5.0. The

holes for the led and phototransistor are drilled in one go so that they line up. The ends of

each side of the peg are filled on the inside to enlarge the gap and pieces of black closed-

cell foam (cannibalized from a mouse mat and punched with 3mm holes) are stuck in

place (Super Glue / Crazy Glue) to improve grip and make a (more or less) light-tight

seal against the skin. At this point, the spring should be adjusted so that the peg will grip

an ear lobe while at the same time not being so tight that it excludes blood from a finger.

Pieces of strip-board glued to the peg are used to make connections to the wires; two

copper strips wide for the led (anode and cathode connections) and three for the

Page 55: ahmed project

38

phototransistor side (collector, emitter and led cathode, and led anode - led wires coming

through the peg from the other side). The light-emitting diode (Siemens SFH487) and the

phototransistor (Siemens SFH309FA) are wedged in their holes and soldered to their

respective pieces of strip board. Neither component is critical nor will many other types

work. The wires are then soldered in place; the screen of the connecting lead is soldered

to the emitter and cathode copper pad. Once everything has been checked and proved to

work, the connections and the backs of the components should be covered with a bead of

an opaque silicone rubber caulk which will insulate and keep out extraneous light. All

bare wires should be covered, figure 5.1 shows the schematic on constructing the sensor.

Figure 5.1: Constructing the sensor

5.2.2 Amplier

The amplifier (see figure 5.2) uses an LM358 dual op amp to provide two

identical broadly-tuned band pass stages with gains of 100. Again, the type of op amp is

not particularly critical, as long as it will work at 6V and drive the output rail to rail. The

signal frequencies are boxed in by movement artefacts at the low end (generated by the

peg moving and distorting the underlying tissues; light pegs are better) and at the top end

Page 56: ahmed project

39

by mains-hum interference. The circuit runs from a single 6 Volt battery and the output

zero is offset by about 1 Volt by referring everything to an internal common line at a

voltage set by a pair of forward-biased silicon diodes. This is convenient for interfaces

with a 0-5Volt input. The potentiometer allows the overall gain to be adjusted so as to

prevent clipping on large signals. Components are not critical but the two 2.2 µF

capacitors must be able to stand some reverse bias so they should be non-polarized or

tantalum. The circuit can easily be made up on a small piece of strip board.

Figure 5.2: Pulse plethysmograph amplifier circuit

5.3 Microcontroller as host

KC Wirefree module can be interfaced with microcontroller. Most applications

would likely use microcontroller as Bluetooth transceiver host. Microcontroller can be

host of master or slave node [20]. Which types of microcontroller are suitable to be host

of Bluetooth module? The microcontroller must have these capabilities:

• UART (Universal Asynchronous Receiver and Transmitter)

• Re-programmable (for development purpose)

• I/O port (Application purpose)

Page 57: ahmed project

40

Any microcontroller with these capabilities is able to become host for Bluetooth

transceiver. There are many types of microcontroller come with these capabilities; one of

them is PIC16F and PIC18F series of microcontroller. Motorola, Atmel, Philip and many

other brand of microcontroller also come with these capabilities. No restriction of

microcontroller types and brands. However, PIC seems to be the cheapest and easiest to

develop type of microcontroller in the market. The main concept to interface Bluetooth

module with microcontroller is UART connection. The Rx pin of microcontroller must be

connected to Tx pin of Bluetooth module, while the Tx pin of microcontroller to Rx pin

of Bluetooth module. Voltage will be another important element in this interface. Most

microcontrollers operate at 5V while Bluetooth module operates at 3.3V. The board

should have voltage regulator for both device. Furthermore, voltage from microcontroller

must not overload Bluetooth module. To ensure this, a voltage divider is required for

UART connection. Tx of microcontroller will supply 5V logic to Rx of Bluetooth

module. Direct connection might spoil Bluetooth module slowly. It is good to have

voltage divider for this connection. Figure 5.3 shows the connection if microcontroller is

used as host for Bluetooth module.

Figure 5.3: Schematic of Bluetooth module with PIC16F877A

Page 58: ahmed project

41

5.4 Bluetooth

Bluetooth is a new technology for wireless connectivity. It is a universal radio

interface in 2.45GHz frequency band that enables portable electronic devices to connect

and communicate wirelessly via short-range, ad hoc networks. The Bluetooth system is a

low cost (about RM 200 per unit) wireless interface between mobile devices that provides

low power consumption. In order to use Bluetooth, a devices must be compatible with

certain Bluetooth profiles.

5.4.1 General Bluetooth Characteristics

Bluetooth characteristics include:

• Operates in the 2.4 GHz Industrial-Scientific-Medical (ISM) band.

• Uses Frequence Hop (FH) spread spectrum, which divides the frequency band

into a number of hop channels. During a connection, radio transceivers hop

from one channel to another in a pseudo-random fashion.

• Supports up to 8 devices in a piconet (two or more Bluetooth units sharing a

channel).

• Built-in security.

• Non line-of-sight transmission through walls and briefcases.

• Omni-directional.

• Supports both isochronous and asynchronous services; easy integration of

TCP/IP for networking.

• Regulated by governments worldwide.

Page 59: ahmed project

42

5.4.2 What is Bluetooth Used For?

Bluetooth will enable users to connect to a wide range of computing and

telecommunications devices without the need to buy, carry, or connect cables. It delivers

opportunities for rapid, ad hoc connections, and in the future, possibly for automatic,

unconscious, connections between devices. Bluetooth's power-efficient radio technology

can be used in many of the same devices that use IR:

• Phones and pagers

• Modems

• LAN access devices

• Headsets

• Notebook, desktop, and handheld computers.

5.4.3 Manufacturers' Acceptance

Bluetooth enables portable electronic devices to connect and communicate

wirelessly via short-range, ad hoc networks. It is a universal radio interface in the 2.45

GHz frequency band that has gained the support of Ericsson, Nokia, IBM, Toshiba, Intel,

and many other manufacturers. In order to function on a worldwide basis, Bluetooth

requires a radio frequency that is license-free and open to any radio. The 2.45 GHz, ISM

band satisfies these requirements, although it must cope with interference from baby

monitors, garage door openers, cordless phones and microwave ovens, which also use

this frequency.

Page 60: ahmed project

43

CHAPTER 6

RESULT AND DISCUSSION

This chapter discusses the result obtain from the system. The result will be

discussed in three parts which are hardware, software and hardware and software

interface. Hardware consists of sensor module and microcontroller. The software part

consists of Bluetooth connection. An overall discussion for this project will be made at

the end of this chapter.

6.1 Hardware

The wireless module used in this project is Bluetooth. The Bluetooth tool used in

this project is Bluetooth adapter. The problem will be more on how to communicate the

USB Bluetooth device with the microcontroller through Universal Serial Port (USB). For

this project the USB-Bluetooth dongle that communicates with the board under

Windows-XP is used.

The amplifier uses an LM358 dual op amp to provide two identical broadly-tuned

band pass stages with gains of 100. The circuit runs from a single 6 Volt battery and the

output zero is offset by about 1 Volt by referring everything to an internal common line at

Page 61: ahmed project

44

a voltage set by a pair of forward-biased silicon diodes. The potentiometer allows the

overall gain to be adjusted so as to prevent clipping on large signals.

6.1.1 Sensor module

The main purpose of this module is to detect the pulse rate. Figure 6.0 shows the

sensor module in this project.

Figure 6.0: Sensor module

6.1.2 Microcontroller module

This module consists of 5 volt power supply, Analog Digital Converter and

UART. Figure 6.2 shows the microcontroller module and figure 6.1 shows the 5 volt

power supply used for microcontroller.

Page 62: ahmed project

45

Figure 6.1: 5 volt power supply

Figure 6.2: Microcontroller

6.1.3 Bluetooth transmitter module

This module consists of KC-21 wirefree bluetooh device. This module functions

as data transmitter to the computer. Figure 6.3 shows the Bluetooth module and figure 6.4

shows the overall hardware.

Page 63: ahmed project

46

Figure 6.3 Bluetooth module

Figure 6.4 Hardware overview

6.2 Result Analysis

In order to check if the circuit is working the overall circuit is divided into two

parts and checked them individually, and followed by a complete test of the circuit.

Sensor Circuit

Microcontroller Circuit

Bluetooth Module KC-21

5 Volt Power Supply

9 Volt Power Supply

Page 64: ahmed project

47

Test has been done with respect to circuit of figure 5.2 and 6.5 at designated pins

using Signal Generator and oscilloscope.

Figure 6.5: Amplifier

In theory, with respect to circuit in figure 5.2, with values of R1 equal to 10k and R2

equal to 1M the Gain should be:

Av = -R2/R1

Av = 100000/1000

Av = -100

To facilitate the test a sinusoidal voltage signal of 1Khz is applied to the input (pins 2

and 3) and output (pin 1) to observed on the oscilloscope. To determine the gain the

amplitude of the input and output waveforms are measured and the gain calculated as

follows:

Output = 500mv x 10 = 5000

Input = 50mv = 50

So the Av = Vout/Vin

Av = 5000/50 = 100

Similar test for gain is done to the input (pins 5 and 6) and output (pin 7) with

following result:

Output = 500mv x 10 = 5000

Input = 50mv = 50

So the Av = Vout/Vin

Av = 5000/50 = 100

Page 65: ahmed project

48

6.3 Discussion

There are many problems encountered while developing this system. This project

requires some setup involving the Windows XP operating system. These are the few

issues arose from initial stage and some early forecast of issues that also arise during the

second stage of the project. The problem are:

• Sensor Module failed to communicates with the Bluetooth transmitter.

• Bluetooth Serial Port module. There are many serial port created and used by

DLINK’s Bluetooth driver. The right port must be chosen in the client and server

application. To reduce this problem, only important Bluetooth features are

installed to reduce confusion in port number and port function.

• Lack of programming skill: Interface between USB dongle and Computer.

Page 66: ahmed project

49

CHAPTER 7

CONCLUSION AND SUGGESTION

This chapter discusses the suggestion of future work for the project and

conclusion will be made according to the project development. This thesis has discussed

the development of the sensor module and interfacing with Bluetooth transmitter and

receiver.

7.1 Conclusion

As a conclusion, all the objectives which have been stated in the previous chapter

have partly been met. In this project, basic component are used to build the system’s

prototype. The component and their function are:

• Microcontroller, PIC16F877A is used as a data processor and controller.

• USB Bluetooth adapter as interface between user computer and KC-21

(microcontroller).

• KC-21 is used as Bluetooth device at hardware part (microcontroller).

• Plethysysmography (PPG) is used as heart rate detector.

• Bioexplorer is used as a tool to detect the device and view the signal.

Page 67: ahmed project

50

The Bluetooth concept offers several benefits compared with other techniques.

The main advantages of Bluetooth are minimal hardware dimensions, the low price on

Bluetooth components and the low power consumption for Bluetooth connections.

Bluetooth is set to be a communication standard, which through its small size,

considerable functionality and flexibility and very low cost, will find its way into many

modern devices, offering control and information easily and simply. The new generation

of cellular telephony systems while offering national coverage and mobility could never

provide a cost effective interconnection of so many devices, but coupled with Bluetooth,

localized groups of equipment can be interconnected wherever they are and wherever

they're going. Bluetooth will thus extend the reach and scope of cellular systems well

beyond today's horizons.

Lastly, taking into account issues related to the completion of the project, it is

hereby suggested that the project be continued and futher developed in the area of

software and hardware enhancement.

7.2 Suggestions

In order to improve the project function and implementation in the future, several

suggestions are proposed:

• Use of mobile phone to replace personal computer. There are many types of

mobile phone with Bluetooth features. Research should be done to find new

method in order make this system functions using mobile phone. If the mobile

phone replaces the computer, the system will be more convenient and

practical.

• Use of different types of techniques to detect the heart rate. There are number

of methods and technique to detect the heart rate, for example ECG and

optical sensor. This kind of method is more accurate than PPG method. But

Page 68: ahmed project

51

the main problem is that, this method is more difficult to design and

implement.

• Using different types of wireless module. For this project the maximum

distance between computer and hardware is 20 meter. Therefore, other types

of wireless media can be used in order to extend the practical range.

Page 69: ahmed project

52

REFERENCES

1. Roland Berg& & Partner GmbH Munchen, “Telemarik im

Geswtdheitswesen”, http://www.rberger.de, August 1997.

2. Jennings, J. R., Tahmoush, A. J., & Redmond, D.P. (1980). Non-invasive

measurement of peripheral vascular activity. In I. Martin & P. H. Venables

(Eds.), Techniques in Psychophysiology. John Wiley & Sons, Ltd.:New York.

3. Brown, C. C. (1967). The techniques of plethysmography. In C. C. Brown

(Eds.), Methods in Psychophysiology. Baltimore: Williams & Wilkins

Company.

4. Mendelson, Y. & Peura, R. A. (1984). Noninvasive transcutaneous monitoring

of arterial blood gases. IEEE Trans. Biomed. Eng., 31, 792-800.

5. Shelley, K. H., R. G. Stout, et al. (1999). "The use of joint time frequency

analysis of the pulse oximeter waveform to measure the respiratory rate of

ventilated patients." Anesthesiology 91(3A): A583.

6. M. Malik, "Guidelines: Heart rate variability Standards of measurement,

physiological interpretation, and clinical use", Eur Heart J., vol. 17, pp354–38,

1996.

7. B. Hertzman, "Photoelectric plethysmograph of the finger and toes in man,"

Proc. Soc. Exp. Biol. Med., vol. 37, pp. 1633-1637, 1937.

8. Larsen, P. B., Schnerderson N. & Pasin R. D. C. (1986). Physiological bases

of cardiovascular psychophysiology. In M. G. H. Coles, E. Donchin & S. W.

Porges (Eds.), Psychophysiology: Systems, Processes and Applications. New

York: Guilford Press.

9. M. J Drinnan, J. Allen, and A. Murray, "Relation between heart rate and pulse

transit time during paced respiration", Physiol. Meas. vol. 22, pp425–432,

2001.

10. Bruner, J. M. R. (1981). Comparison of direct and indirect methods of

measuring arterial blood pressure. Medical Instrumentation, 15, 11-12.

Page 70: ahmed project

53

11. Lee, B.Y., Trainor, F.S., Thoden, W.R., Kavner, D. (1981). Handbook of

Noninvasive Diagnostic Techniques in Vascular Surgery, New York:

Appleton-Century-Crofts.

12. X. F. Teng and Y. T. Zhang, "Continuous and Noninvasive Estimation of

Arterial Blood Pressure Using a Photoplethysmographic Approach," presented

at A New Beginning for Human Health: Proceedings of the 25th Annual

International Conference of the IEEE Engineering in Medicine and Biology

Society, Sep 17-21 2003, Cancun, Mexico, 2003.

13. Srdjan Krco, “Bluetooth Based Wireless Sensor Network:Implemenfation

Issues and Solutions”, Invited paper, Proc. Of the Telfor 02 conference,

Belgrade November 2002.

14. Foerster, J., et al., Ultra-Wideband technology for short- or medium-range

wireless communications. Intel Technology Journal. 2001; (2):, 2001.

15. Hirt, W. and D. Porcino. Pervasive Ultra-wideband Low Spectral Energy

Radio Systems (PULSERS). In WWRF7. 2002. Eindhoven,

16. Shelley, K. H., R. G. Stout, et al. (1999). "The use of joint time frequency

analysis of the pulse oximeter waveform to measure the respiratory rate of

ventilated patients." Anesthesiology 91(3A): A583.

17. Peter Spasov (2005). Microcontroller Technology. Fifth edition. Sir Sandford

Fleming College: Prentice Hall.

18. Sensor Module literature at http://www.electronics.dit.ie.com

19. Bluetooth Technology literature at http://www.bluetooth.com

20. Signal Processing literature at http://www.picotech.com

21. Microcontroller data sheet at http://www.microchip.com

Page 71: ahmed project

54

APPENDIX

Page 72: ahmed project

55

APPENDIX A

KC-21 Wirefree Bluetooth Module

Page 73: ahmed project

56

Page 74: ahmed project

57

Page 75: ahmed project

58

Page 76: ahmed project

59

Page 77: ahmed project

60

APPENDIX B

Programming Source Code

/*

* Project name:

ADC_USART (Transferring ADC data on Serial port)

* Description:

The code performs AD conversion and sends results (the upper 8 bits) via

USART.

* Test configuration:

MCU: PIC16F877A

Dev.Board: EasyPIC3

Oscillator: HS, 08.0000 MHz

Ext. Modules: -

SW: mikroC v6.0

* NOTES:

None.

*/

unsigned short temp_res;

void main() {

USART_Init(115200); // Initalize USART (115200 baud rate, 1 stop bit, ...

// Select Vref and analog inputs, in order to use ADC_Read

ADCON1 = 0; // All porta pins as analog, VDD as Vref

TRISA = 0xFF; // PORTA is input

do {

// Read ADC results and send the upper byte via USART

Page 78: ahmed project

61

temp_res = ADC_Read(2) >> 2;

USART_Write(temp_res);

} while (1); // endless loop

}