Professional Documents
Culture Documents
Another semester has passed, but this is one I will remember longer than
others. I feel privileged to grow up in a time were it is easier than ever to study,
travel and explore whatever world one wants to explore. I am also very grateful
to be one of the many students who every year has the chance to spend one
semester in another European country, through the ERASMUS network.
My semester was spent in Latvia’s capital Riga, where I did my master thesis
work. The result of the work is an application which is not completely developed,
and the work with the application will continue after I hand over the project.
My intention is consequently to write a report, where I share my experiences of
working on the application and present my solutions for the person or persons
who continue my work, or similar works. Another intention of my report is
to present arguments for why new applications using photoplethysmography
(PPG) should be developed. This is done by a presentation of recent studies in
the field.
1
ACKNOWLEDGEMENT
Many thanks to Prof. Janis Spigulis and PhD student Renars Erts at the
University of Latvia, Institute of Atomic Physics and Spectroscopy. They made
me feel welcome and well taken care of during my time at the institute. The
inspiration and supervision they have given is invaluable. I am also grateful
to Prof. Göran Salerud at Linköping University, the Department of Biomedical
Engineering. Besides all work with the examination of the project, he has helped
me with the coordination of the exchange program.
Finally also thanks to Aino Järveläinen for being supportive and for helping
with the proofreading of the thesis.
Rasmus Andersson
Linköping, September 2006
2
CONTENTS
1 Preface 5
1.1 Background . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.2 Problem definition . . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.3 Outlines of the thesis . . . . . . . . . . . . . . . . . . . . . . . . . 5
1.4 Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
2 Photoplethysmography 7
2.1 History . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.2 Basic principles . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
2.3 Contour of the PPG-signal . . . . . . . . . . . . . . . . . . . . . 8
4 PPG-systems 13
4.1 General system . . . . . . . . . . . . . . . . . . . . . . . . . . . . 13
4.2 Commercial applications . . . . . . . . . . . . . . . . . . . . . . . 14
4.3 Dual and multi-channel applications . . . . . . . . . . . . . . . . 14
5 Environment of developing 15
5.1 Microcontroller . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.2 Development board . . . . . . . . . . . . . . . . . . . . . . . . . . 15
5.3 Compiler . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17
6 Application developing 18
6.1 Starting-points . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.2 Flow diagram . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 18
6.3 Limitations . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 19
6.4 Real time systems . . . . . . . . . . . . . . . . . . . . . . . . . . 19
7 Application Overview 21
7.1 Sampling and presentation . . . . . . . . . . . . . . . . . . . . . . 21
7.2 USART . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 21
7.3 Heart rate estimation . . . . . . . . . . . . . . . . . . . . . . . . 22
3
8 Implementation 23
8.1 Interrupts . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.2 Circular ques . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 23
8.3 Presentation on GLCD . . . . . . . . . . . . . . . . . . . . . . . . 24
4
1.
PREFACE
The work with this theses was mainly carried out at the Institute of Atomic
Physics and Spectroscopy at the University of Latvia. The defending took place
at the Department of Biomedical Engineering at the university of Linköping.
1.1 Background
This thesis has been divided into two parts, one part being the more theo-
retical part, which includes chapters 2-5. Chapter 2 and 3 are related to photo-
plethysmography and the research of this area. These two chapters are a result
of a literature overview, which has been one part of the task for the thesis. In
chapter 4 a brief overview of existing application is done. Chapter 5 is more
5
technical in it´s nature and introduce the equipment which has been used to
follow out the task. Here the features and performances of the microcontroller
and developmentboard are presented.
The second part includes the remaining chapters and is an analysis of the
performance. Chapter 6 is dedicated to describe the basic performances which
the system shall be able to perform. The limitation and problems are also
analyzed here. The report continues with one chapter which is an overview of
the result of the work and how to use the system. A brief description of the
implementation is presented in chapter 8. In the last two chapters a discussion
on the result is done, as well as a summarisation of the final conclusion.
1.4 Method
The task of the thesis was defined by my supervisor. During the work some
circumstances in the requirements has led to changes in the task.
The studies have contained a literature overview of photoplethysmography
and a pilot study to investigate the possibilities of the development environment.
The literature overview has been used to lay the basis for what features and
performances the application has.
6
2.
PHOTOPLETHYSMOGRAPHY
2.1 History
In the mid 1930’s the first reports of how to measure blood volume changes
in tissue with light was published. One of the first scientists who did research
in this area was Hertzman who published his first paper in the area 1937 [7].
He continued with research during the three decades to come, and built a solid
base for PPG. Contemporaries to Hertzman demonstrated changes in skin blood
flow due to external influences. During the first four decades many applications
where PPG was applied to the skin were founded. For example investigations
of the effects of drugs, and assessment of the effectiveness of vascular surgery
[5].
The early set-ups utilized tungsten lamps as light sources [5], and this light
had a broad spectra of wavelengths. Today the development of semi-conductor
technology has caused that Light Emitted Diodes (LED:s) is the most common
light source, and the effects of different wavelengths has been exhaustively inves-
tigated. Other research in the area has made a survey of frequencies components
in the signal.
Normally one looks at the body as rigorous, as something which visible light
cannot penetrate. For soft tissue this is definitely true, which is best illustrated
if you imagine how you hold your hand against a strong lamp in a dark room.
You can see that some light transverses, and this light is often colored red. The
red color occur because of the absorbtion in blood cells. Some light is also
reflected in tissue, but also in this light some wavelengths have been absorbed
more than others. The basic idea of photoplethysmography is to detect this light,
7
transmitted or reflected, and observe the changes of intense. The intensity is
presumed to change by the pulsation of blood in vascular.
The complexity of the PPG-signal makes it difficult to tell what the expec-
tations of a PPG-signal could look like. The signal depends of wavelengths of
light, signal processing, and what is measured. A commonly used simplification
is to refer to all low frequency components as DC-components [17]. The more
high frequency components that originate from the heart rate, and often the
focus of the studies, are referred to as the AC-components (see figure 1).
8
Figure 2: An typical ppg-curve for one pulse wave initialized by heart-beat
9
3.
RESEARCH IN THE AREA
This chapter was written with the purpose of rendering research in the area.
In particular it is oriented towards analyzing what has happened recently in the
area, and why the need for new applications has arisen. Thereby the chapter
also works as a background for my task. Some of the research which is presented
is out of outside the limits for the task, and is included as a reminder of why
other applications can be needed for other tasks.
Table 1: Frequencies of the signal components of the PPG-signal for adults. [17]
By using multiple channels you can detect and compare PPG-signals from
different parts of the body. Several of the more recent studies have used equip-
ment which simultaneously have detected PPG-signals in various body sites [1]
10
[2] [3] [4] [12] [14] [13] [6]. The studies of J Allen and A Murray investigate
differences between bilateral PPG-signals detected on anatomically symmetric
sites on the human body (for example both index fingers) [1] [2] [3] [4]. The
characteristics of the PPG-signals from two anatomically symmetric sites can
be supposed to be highly correlated for a healthy subject [1]. It is accepted that
arterial stiffness increase through ageing, and this includes a changing in the
shape of the PPG-signal. The Pulse Transit Time(PTT) seems to be decreased
as a function of the subject’s age and systolic blood pressure [12] and older sub-
ject’s also seem to have an elongation of the systolic rising edge and a damping
of the dicrotic notch [3] [4].
This work was expended by studies at the University of Latvia, these studies
propose that multi-channel PPG can be used to detect several occasions of
changed resistance in vessels [13]. More specifically, it has been shown that the
benefit of using multi-channel PPG is for diagnosing arterial stenosis in legs [6].
Figure 3: The difference between Pulse Wave Transit Time for two channels.
The principle R Erts et al. uses in the study is that increased resistance in
vessels brings increased Pulse Wave Transit Time (PWTT) [6]. PWTT means
the time between heart contraction and the resulting beginning of the steep raise
in the PPG signal curve. The signals recorded from anatomically symmetric
sites of the human body is compared and in a healthy subject their should only
be a negligible time delay between the two channels (as in figure 3).
11
3.3 Mean-algorithms
The complexity of the signal and its sensitiveness for disruptions, makes it
interesting of mean-algorithms for the signal. Normally these are taken out over
a single pulse period. A proposal for how to do this was suggested by J Spigulis
et. al. by the single pulse photoplethysmography (SPPPG)-algorithm [15]. The
use of this algorithm gives a better validity when you calculate information from
the curve, or just watch its general shape.
12
4.
PPG-SYSTEMS
13
4.2 Commercial applications
In the research of this field there has been nearly as many applications
developed as there has been studies. Recently some applications with multi
channels has been introduced. One application is used in J. Allen and A. Mur-
ray’s research of bilateral examinations [1] [2]. The application first has elec-
tronic amplifiers then it is digitalized via a DAQ-card (National Instruments
AT-MIO-16-2). The signal processing is then done in MATLAB, using their
functions for digital processing. The system is using a butterworth filter for
both low-pass-filtering and high-pass-filtering (0.5 & 20 MHz). Another multi-
channel system has been used at the University of Latvia, with four channels
for PPG-measurement [13] [6]. The system is similar in edification, and also
uses a computer for monitoring.
14
5.
ENVIRONMENT OF DEVELOPING
This fifth chapter is separated from the other theory chapters in the aspect
that this is concentrated on the technical equipment used for developing. Here
the development tools which have been used in the project are introduced.
5.1 Microcontroller
The microcontroller chosen for this system is a PIC18F4620. The device has
40 pins, and is equipped with 4 timer modules and an A/D-converter with 13
channels. The program memory constitutes of as flash memory at 64 Kbytes,
and the data memory constitutes of a SRAM at 3986 bytes and a EEPROM at
1024 bytes. [10]
The proportionately big amount of storage, comparing to other microcon-
trollers in the PIC18-family, is needed to enable a buffer from samples of the
multi-channels. Since the system does not include an extern oscillator the intern
oscillator in the microcontroller is used. The microcontroller can without using
the 4x Phase Look Loop (PPL) feature, work with frequencies up to 8 MHz
[10].
The microcontroller is also equipped with several solutions for communica-
tion. Beside the Master Synchronous Serial Port(MSSP), there also is a mod-
ule for Enhanced Universal Synchronous Receiver Transmitter (EUSART). The
EUSART is useful for communication with computers.
15
The serial communication from the development board uses the RS-232 Stan-
dard (EIA232 Standard). The board can easily be connected by a DB9-male
socket and can be read from a standard communication-port of a computer [16].
16
5.3 Compiler
17
6.
APPLICATION DEVELOPING
6.1 Starting-points
18
samples during the interrupts, which take place with a constant sample time.
When the interrupt routine has been run, the program continues at the same
address it was on when the interrupt occurred. If the user gives a command to
stop the sampling, the program freezes in a standby mode which waits for the
user to start sampling again. The GLCD-screen shows the PPG signal curve up
to the point where the stop was commanded. During this process the processor
is still active and not stand by in the sense that it requires a minimum of power
supply.
6.3 Limitations
In section 6.1 some demands on the application were presented. The need for
multi-channeled detecting is linked to the examination of time-shifts from two
different layers (see also section 3.2). The major problem which occurs when
using more than one channel is time-related. The monitoring of one sample in
the signal on the GLCD-screen calls for approximately 1 to 5 ms1 . Attaining
a good resolution, for example a heart rate of 80 beats per minute, means
there are 15 ms for computation between two samples. To keep the system in
realtime, one has to do as many communications to GLCD as there are number
of channels, a fact which sharply limits the number of possible channels.
The system is limited to only using one microcontroller. For example using
an extern oscillator, a higher working frequency could be gained. The sys-
tem is supposed to work in real-time and has no external memory storage.
This limitation implies that there are for example no functions for calculating
a SPPPG-curve (see 3.3)
The concept real time system is nowadays more widely used, and can be
confusing. So that is why there is a need to explain how the concept is construed
and how the application can be called a real time system.
19
The application works with a constant sample time, which of course is im-
portant to gain a scientific result. To get this system to work in real time it
needs to compute and monitor the samples faster than it takes to get a new
sample. In the program flow events (i.e. Clear Screen, Calculate Heart Rate)
which sometimes exceed this time, have to take place. This is why samples have
to be stored in a que. The que has place for extra elements when time requiring
events take place, but the number of elements in the que converges over time.
This gives that the time from a sample being sampled to getting monitored,
never exceeds the number of elements in que multiplied by sample time.
20
7.
APPLICATION OVERVIEW
In this chapter there will be a presentation of the system and its functions.
7.2 USART
21
are used for the number, 2 bits for identify channel(prepared for four channels),
and 2 bits are for differentiating the four sample rates. Remaining 2 bits are
used for identification. First the most significant byte is sent, which contain one
bit set to one which identifies that it is the most significant byte. The second
byte has 1 bit for identification and 7 bits for the value. The most significant
bit is zero, and indicate that it is the less significant byte. The second equals
to the corresponding bit in the most significant byte.
Figure 7: The USART-conversation divides the value and sends the information
with two bytes with extra information of which channel it belongs to
There has been a function implemented for heart rate estimation in the
application. The application searches for minimums (eg. maximums because the
signal is sampled mirrored) in the sampled data. This is a simple function which
just takes the adjacent values into calculation for each point. This makes the
calculations as simple as possible for a faster processing. The found minimum
is controlled so that it is not a dicrotic notch, by controlling its amplitude.
22
8.
IMPLEMENTATION
8.1 Interrupts
The interrupts occur with constant time and the samples have to be saved
somewhere to be computed later and to be monitored on the GLCD-screen. For
this purpose the circular que is being used. This que contains 115 integers in an
23
array, where the values can be saved. It also contains variables for controlling
the starting point of the que and its number of elements. The que works as a
buffer. To control that no overflow occurs one byte has also been declared to
verify this.
Figure 8: The circular que store all data in pairs, containing sample value and
a pointer to the next pair.
The most important difference between this application and already devel-
oped multi-channel applications is the presentation on the GLCD-screen in real
time. When no external storage can be used the time to compute and present
the data cannot exceed the sample time (See 6.4). The functions used in the
program to communicate with GLCD-screen for writing or clearing the screen
require a relatively great amount of time. The program solely uses functions
from a predefined library by the Mikroelektrika team.
24
9.
RESULTS AND DISCUSSION
9.1 Evaluation
The application has been evaluated and compared with a two channel system
which monitor PPG signals on a desktop computer. The reference system was
hard to calibrate with a good result of both channels without noise. Evaluating
in one signal gave a valid result (See 9) for the application. The result was
verified on both channels. In the two signal mode an unknown process made
disturbance on the signals, which made the resolution poor.
Even if the attempt to make out the PPG signal curve on the GLCD in
two signal mode failed, easier signals were successfully detected and monitored.
It also appeared that if each sample was made as a mean value estimation of
several quick sampled values from the AC/DC converter, a better result was
given. This affirms the assumption that the disturbance is composed by noise.
The good result from detecting and monitoring a PPG signal curve (without
mean value estimation) from the one channel mode leads to the assumption that
the noise originates before the AC/DC transformation.
Also the heart rate function has been evaluated. The function was evaluated
only in single channel mode. The estimation gave a pleasant value most of
25
Figure 10: An examination in the two channel mode. Disturbance makes the
signal unusable.
times, but was sensitive for noise in the signal. With knowledge of the signal’s
characteristic, a better function for finding local extreme points can easily be
created. For example taking more values in consideration for calculations is
assumed to give a better result. The problem with this is that the calculations
tend to be time requiring and conflict with the real time demands.
The result of this work is an application which can present two signals syn-
chronously detected on a GLCD-screen. The advantage compared to earlier
applications which can perform examinations on multiple sites is that no com-
puter is needed. The application can in that way be called more portable, and
more user-friendly.
For some analysis of the PPG signal (i.e. mean-algorithms), data from longer
investigation times is needed. External storage is necessary for this occasion.
To satisfy this demand, a function for serial communication has been build in,
using EUSART. One limitation which still stands is a poorer resolution in the
signal compared with a system which does not compute data in real time.
26
10.
CONCLUSIONS AND FUTURE WORK
One of the the major limitations of why it seems difficult to present more
than two signals at the same time on the GLCD-screen, is the time limit. To
improve the performance of the application a solution with an extern oscillator
is suggested.
Greater application with one microcontroller for each channel may also be an
interesting solution. Each microcontroller can then do all the processing of the
signal, and the parallel computing decreases the need for time. A disadvantage
is that the costs for an application like this will be higher.
While the programming is done solely in C, there may also be many improve-
ments to do in the code if it is improved by better solutions in the assembler.
27
REFERENCES
[12] M. Nitzan, B. Khanokh, and Y. Slovik. The difference in pulse transit time
to the toe and finger measured by photoplethysmography. Physiol. Meas.,
23:85–93, 2002.
28
[13] J. Spigulis. Optical noninvasive monitoring of skin blood pulsations. Appl.
Opt., 44:1850–1857, 2005.
[14] J. Spigulis, R. Erts, I. Kukulis, M. Ozols, and K. Prieditis. Optical multi-
channel sensing of skin blood pulsations. Proc. SPIE, 5459:46–53, 2004.
29
Functions and procedures
File q.h and q.c certain all functions and definitions witch uses the buffer.
Table 3: Q.H
Struct Variables Description
circular que
int elements[MAXELEMENTS] An array with integers.
int front Which element is first in que.
int rear Which element is in the back.
int nr of elements Number of elements in que.
char overflow Equals 1 if there have been an overflow.
unsigned int max Maximum value in que.
unsigned int min Minimum value in que.
unsigned int interval Max - Min
unsigned short old y Last presented value (scaled)
unsigned short channel coor Movement in y-led
int heart rate Distance between sys. peaks
30
Table 4: Q.H
char empty Q(circular que *q) Empty the que be setting front to
rear, zero the nr of elements and
clear possible overflows.
void de Q(circular que *q) Delete the element first in que by
move front one step and decrease
nr of elements with one.
int read Q(circular que *q, int pos) Returns the value of the element at
position pos in que. Pos = 1 means
that front element is returned.
int max Q(circular que *q) Returns the maximum value of the
elements in que.
int min Q(circular que *q) Returns the minimum value of the
elements in que.
int pos of next systolic max Q Find the next local max in que,
(circular que *q, int pos, int ma, int mi) starts at position pos, and step
until an max with value higher
than 90 % of max is found.
void init Q(circular que *q) Initialize que.
void add Q(circular que *q, int value) Add an new element to que on last
last place in que.
void calc values Q( Refresh values as max, min,
circular que *q1, circular que *q2, float s fr) heart rate and interval.
void send USART(char SETTINGS, Send first value in que by USART,
char sample rate, circular que *q1, if channel is set. See also heading
circular que *q2) USART-transmission.
void scale and write( Scale and write value to the screen,
char SETTINGS, char w p, circular que *q) if channel is set. Notice that
signal is mirrored up-side-down.
void clear and redraw screen( Clear screen, write values about
char SETTINGS, circular que *q1, settings and heart rate to it.
circular que *q2)
31
Table 5: FUNCS.H
#Define Replace with Description
MAXELEMENTS 118 Number of elements in ques.
WIN HEIGHT 20 Number of pixels from
maximum to minimum on GLCD-Screen.
WIN WIDTH 128 Number of pixel from left to right on screen.
PRESENT SAMPLE 80 Position in que for element which are
presentet on GLCD-Screen.
DIFF CHANNELS 13 Movement of second channel in
y direction on GLCD-Screen.
Enable To Read T0CON.TMR0ON Controls the TIMER0 (1=on, 0=off).
32
Flowdiagram
33