You are on page 1of 34

HEART RATE MEASUREMENT FROM FINGERTIP

Introduction:
Heart rate measurement indicates the soundness of the human cardiovascular system. This
project demonstrates a technique to measure the heart rate by sensing the change in blood
volume in a finger artery while the heart is pumping the blood. It consists of an infrared LED
that transmits an IR signal through the fingertip of the subject, a part of which is reflected by
the blood cells. The reflected signal is detected by a photo diode sensor. The changing blood
volume with heartbeat results in a train of pulses at the output of the photo diode, the
magnitude of which is too small to be detected directly by a microcontroller. Therefore, a
two-stage high gain, active low pass filter is designed using two Operational Amplifiers
(OpAmps) to filter and amplify the signal to appropriate voltage level so that the pulses can
be counted by a microcontroller. The heart rate is displayed on a 3 digit seven segment
display. The microcontroller used in this project is PIC16F628A.

Theory
Heart rate is the number of heartbeats per unit of time and is usually expressed in beats per
minute (bpm). In adults, a normal heart beats about 60 to 100 times a minute during resting
condition. The resting heart rate is directly related to the health and fitness of a person and
hence is important to know. You can measure heart rate at any spot on the body where you
1

can feel a pulse with your fingers. The most common places are wrist and neck. You can
count the number of pulses within a certain interval (say 15 sec), and easily determine the
heart rate in bpm.
This project describes a microcontroller based heart rate measuement system that uses optical
sensors to measure the alteration in blood volume at fingertip with each heart beat. The
sensor unit consists of an infrared light-emitting-diode (IR LED) and a photodiode, placed
side by side as shown below. The IR diode transmits an infrared light into the fingertip
(placed over the sensor unit), and the photodiode senses the portion of the light that is
reflected back. The intensity of reflected light depends upon the blood volume inside the
fingertip. So, each heart beat slightly alters the amount of reflected infrared light that can be
detected by the photodiode. With a proper signal conditioning, this little change in the
amplitude of the reflected light can be converted into a pulse. The pulses can be later counted
by the microcontroller to determine the heart rate.

Circuit Diagram:
The signal conditioning circuit consists of two identical active low pass filters with a cut-off
frequency of about 2.5 Hz. This means the maximum measurable heart rate is about 150 bpm.
The operational amplifier IC used in this circuit is MCP602, a dual OpAmp chip from
Microchip. It operates at a single power supply and provides rail-to-rail output swing. The
filtering is necessary to block any higher frequency noises present in the signal. The gain of
each filter stage is set to 101, giving the total amplification of about 10000. A 1 uF capacitor
2

at the input of each stage is required to block the dc component in the signal. The equations
for calculating gain and cut-off frequency of the active low pass filter are shown in the circuit
diagram. The two stage amplifier/filter provides sufficient gain to boost the weak signal
coming from the photo sensor unit and convert it into a pulse. An LED connected at the
output blinks every time a heart beat is detected. The output from the signal conditioner goes
to the T0CKI input of PIC16F628A.

IR sensors and signal conditioning circuit


The control and display part of the circuit is shown below. The display unit comprises of a 3digit, common anode, seven segment module that is driven using multiplexing technique. The
segments a-g are driven through PORTB pins RB0-RB6, respectively. The units, tens and
hundreds digits are multiplexed with RA2, RA1, and RA0 port pins. A tact switch input is
connected to RB7 pin. This is to start the heart rate measurement. Once the start button is
pressed, the microcontroller activates the IR transmission in the sensor unit for 15 sec. During
this interval, the number of pulses arriving at the T0CKI input is counted. The actual heart
rate would be 4 times the count value, and the resolution of measurement would be 4. You
can see the IR transmission is controlled through RA3 pin of PIC16F628A. The
microcontroller runs at 4.0 MHz using an external crystal. A regulated +5V power supply is
derived from an external 9 V battery using an LM7805 regulator IC.
See more at: http://embedded-lab.com/blog/?p=1671#sthash.Y8yFmktT.dpuf

Update (04/20/2013)

The sensor and signal conditioning unit used in this project is improved further and the new
design is available for purchase as Easy Pulse (see picture on left). The Easy Pulse sensor is
designed for hobby and educational applications to illustrate the principle of
photoplethysmography (PPG) as a non-invasive optical technique for detecting cardiovascular pulse wave from a fingertip. It uses an infrared light source to illuminate the finger
on one side, and a photodetector placed on the other side measures the small variations in the
transmitted light intensity. The variations in the photodetector signal are related to changes in
blood volume inside the tissue. The signal is filtered and amplified to obtain a nice and clean
PPG waveform, which is synchronous with the heart beat.
Software
The firmware does all the control and computation operation. In order to save the power, the
sensor module is not activated continuously. Instead, it is turned on for 15 sec only once the
start button is pressed. The pulses arriving at T0CKI are counted through Timer0 module
operated in counter mode without prescaler. The complete program written for MikroC
compiler is provided below. An assembled HEX file is also available to download.
Output
The use of this device is very simple. Turn the power on, and you will see all zeros on display
for few seconds. Wait till the display goes off. Now place your forefinger tip on the sensor
assembly, and press the start button. Just relaxed and dont move your finger. You will see
the LED blinking with heart beats, and after 15 sec, the result will be displayed.
References
The following papers were used as reference in making this project.
Design and development of a heart rate measuring device using fingertip by Hashem,
M.M.A. Shams, R. Kader, M.A. Sayed, M.A., International conference on computer and
communication engineering, 2010.
4

Heart rate measurement from the finger using a low cost microcontroller by Dogan Ibrahim
and Kadri Buruncuk.
Important note:
I am adding these paragraphs to provide further detail on the sensor and signal conditioning
part of this project.
The harder part in this project is the signal conditioning circuit that uses active low pass
filters using OpAmps to boost the weak reflected light signal detected by the photo diode.
The IR transmitting diode and the photo diode are placed closely but any direct crosstalk
between the two are avoided. Look at the following pictures to see how I have blocked the
direct infrared light from falling into the adjacent photo diode. Besides, surrounding the
sensor with an opaque material makes the sensor system more robust to changing ambient
light condition. I have used separate IR diode and photo diode, but you can buy reflective
optical sensor systems that have both the diodes assembled together. Heres an example from
Tayda Electronics.

The 150 ? resistance in series with the IR diode is to limit the current and hence the intensity
of the transmitted infrared light. The intensity of IR light should not be too high otherwise the
reflected light will be sufficient enough to saturate the photo detecting diode all the time and
no signal will exist. The value of this current limiting resistor could be different for different
IR diodes, depending upon their specifications. Heres my practical test circuit that I used to
find the appropriate value of the series resistor for the IR diode I used.

First I used a 68 ? resistor with a 470 ? potentiometer in series with the IR diode. Placing a
fingertip over the sensor assembly, I slowly varied the potentiometer till I found the output
LED blinking with heartbeat. Then I measured the equivalent resistance R and replaced the
68 ? and the potentiometer with a single resistor closest to R. But you can also keep the
potentiometer in your circuit so that you can always adjust it when needed. You should keep
your fingertip very still over the sensor while testing. Once you see the pulses at the output of
the signal conditioning circuit, you can feed them to a microcontroller to count and display.
Revised Version:
When I first built the Heart rate measurement through fingertip project, the infrared LED and
photodiode used for finger photoplethysmography were actually from salvaged parts, and
therefore, I could not provide specifications for them in the article. As a result of that it takes
quite a bit of time to replicate that project with a different set of IR LED and photodiode as
the values of the current limiting and biasing resistors may have to be changed for the new
sensor to work properly. Today, I am going to talk about a revised version of the same project
but with all the components specified this time. The new version uses the TCRT1000
reflective optical sensor for photoplethysmography. The use of TCRT100 simplifies the build
process of the sensor part of the project as both the infrared light emitter diode and the
detector are arranged side by side in a leaded package, thus blocking the surrounding ambient
light, which could otherwise affect the sensor performance. I have also designed a printed
circuit board for it, which carries both sensor and signal conditioning unit. I have named the
board Easy Pulse and its output is a digital pulse which is synchronous with the heart beat.
The output pulse can be fed to either an ADC channel or a digital input pin of a
microcontroller for further processing and retrieving the heart rate in beats per minute (BPM).

Theory
This project is based on the principle of photoplethysmography (PPG) which is a noninvasive method of measuring the variation in blood volume in tissues using a light source
and a detector. Since the change in blood volume is synchronous to the heart beat, this
technique can be used to calculate the heart rate. Transmittance and reflectance are two basic
types of photoplethysmography. For the transmittance PPG, a light source is emitted in to the
tissue and a light detector is placed in the opposite side of the tissue to measure the resultant
light. Because of the limited penetration depth of the light through organ tissue, the
transmittance PPG is applicable to a restricted body part, such as the finger or the ear lobe.
However, in the reflectance PPG, the light source and the light detector are both placed on the
same side of a body part. The light is emitted into the tissue and the reflected light is
measured by the detector. As the light doesnt have to penetrate the body, the reflectance
PPG can be applied to any parts of human body. In either case, the detected light reflected
from or transmitted through the body part will fluctuate according to the pulsatile blood flow
caused by the beating of the heart.
The following picture shows a basic reflectance PPG probe to extract the pulse signal from
the fingertip. A subjects finger is illuminated by an infrared light-emitting diode. More or
less light is absorbed, depending on the tissue blood volume. Consequently, the reflected light
intensity varies with the pulsing of the blood with heart beat. A plot for this variation against
time is referred to be a photoplethysmographic or PPG signal.

The PPG signal has two components, frequently referred to as AC and DC. The AC
component is mainly caused by pulsatile changes in arterial blood volume, which is
synchronous with the heart beat. So, the AC component can be used as a source of heart rate
information. This AC component
onent is superimposed onto a large DC component that relates to
the tissues and to the average blood volume. The DC component must be removed to measure
the AC waveform with a high signal-to-noise
signal noise ratio. Since the useful AC signal is only a very
small portion
ion of the whole signal, an effective amplification circuit is also required to extract
desired information from it.
Circuit diagram
The sensor used in this project is TCRT1000, which is a reflective optical sensor with both
the infrared light emitter and phototransistor placed side by side and are enclosed inside a
leaded package so that there is minimum effect of surrounding visible light. The circuit
diagram below shows the external biasing circuit for the TCRT1000 sensor. Pulling the
Enable pin high willl turn the IR emitter LED on and activate the sensor. A fingertip placed
over the sensor will act as a reflector of the incident light. The amount of light reflected back
from the fingertip is monitored by the phototransistor.

The output (VSENSOR) from the


the sensor is a periodic physiological waveform attributed to
small variations in the reflected IR light which is caused by the pulsatile tissue blood volume
inside the finger. The waveform is, therefore, synchronous with the heart beat. The following
circuit
it diagram describes the first stage of the signal conditioning which will suppress the
large DC component and boost the weak pulsatile AC component, which carries the required
information.

The output (VSENSOR) from the sensor is a periodic physiological waveform attributed to
small variations in the reflected IR light which is caused by the pulsatile tissue blood volume
inside the finger. The waveform is, therefore, synchronous with the heart beat. The following
circuit diagram describes the first stage of the signal conditioning which will suppress the
large DC component and boost the weak pulsatile AC component, which carries the required
information. - See more at: http://embedded-lab.com/blog/?p=5508#sthash.9Z4Aik2e.dpuf
http://embedded lab.com/blog/?p=5508#sthash.9Z4Aik2e.dpuf
In the circuit shown above, the
the sensor output is first passed through a RC high-pass
high
filter
(HPF) to get rid of the DC component. The cut-off
cut off frequency of the HPF is set to 0.7 Hz.
Next stage is an active low-pass
pass filter (LPF) that is made of an Op-Amp
Op Amp circuit. The gain and
the cut-off frequency of the LPF are set to 101 and 2.34 Hz, respectively. Thus the
combination of the HPF and LPF helps to remove unwanted DC signal and high frequency
noise including 60 Hz (50 Hz in some countries) mains interference, while amplifying the
low amplitude
tude pulse signal (AC component) 101 times.
10

The output from the first signal conditioning stage goes to a similar HPF/LPF combination
for further filtering and amplification (shown below). So, the total voltage gain achieved from
the two cascaded stages is 101*101 = 10201. The two stages of filtering and amplification
converts the input PPG signals to near TTL pulses and they are synchronous with the heart
beat. The frequency (f) of these pulses is related to the heart rate (BPM) as,
Beats per minute (BPM) = 60*f
A 5K potentiometer is placed at the output of the first signal conditioning stage in case the
total gain of the two stages is required to be less than 10201. An LED connected to the output
outpu
of the second stage of signal conditioning will blink when a heart beat is detected. The final
stage of the instrumentation constitutes a simple non-inverting
non inverting buffer to lower the output
impedance. This is helpful if an ADC channel of a microcontroller is used to read the
amplified PPG signal.

The operational amplifiers used in the instrumentation circuit described above are from the
MCP6004 IC, which has got four general purpose Op-Amps
Op Amps offering rail-to-rail
rail
input and
output over the 1.8 to 6V operating range. The picture below shows an assembled Easy Pulse
board designed using the above circuit.

11

Instead of fixing on the board, the TCRT1000 sensor can also be wired to the board through
header pins and jumpers. This way you have more flexibility in using the sensor. You can
hold the sensor between two fingers or you can face it down on the skin on your palm, and so
on.

12

The board operates from 3-5.5V and therefore, it can be used with both 3.3V and 5.0V
microcontroller families.
Operation of the board
The operation of the board is very simple. After powering the board from a 3-5.5V supply,
the Enable (EN) pin must be pulled high to activate the IR sensor. Next, place the tip of your
forefinger gently over the sensor on its face. Your finger should be still and should not press
too hard on the sensor. Within a couple seconds the circuit stabilizes and you will see the
LED flashing synchronously with your heart beat. You can feed the output signal (Vout) to
either a digital I/O or an ADC input pin of the microcontroller for measurement of the heart
beat rate in BPM. The output voltage waveform can also be viewed on an oscilloscope. I
connected Digilents Analog Discovery tool to check the input PPG and the output
waveforms from the two LPF stages. The following pictures show these signal waveforms as
displayed on the PC screen when .

13

The Easy Pulse output signal can be connected to a digital input pin of Arduino or ChipKIT
board to find its frequency. If you multiply the frequency by 60, you will get the heart rate in
14

BPM. I have written a demo code for chipKIT Uno32 and IO Shield to display the heart rate
on the OLED. The VCC, EN, VOUT, Gnd pins on the Easy Pulse board are connected to
3.3V, 5.0V, Pin 2, and Gnd pins of the I/O shield, respectively.

15

If you want the sensor to be separate from the board as described earlier, you will need a wire
to connect it to the board. The picture below shows a proper way of connecting the sensor to
the board using a 4-pin jumper wire. Since the pins or legs of the TCRT1000 are thinner than
the holes in the jumper wire, you may need to thicken them a little bit through soldering so
that it is hold tight.

16

Summary
Easy Pulse provides a reflective IR sensor with necessary instrumentation circuit to illustrate
the principle of photoplethysmography as a noninvasive technique for measuring heart rate.
In order for this sensor to work, the fingertip should be placed gently over the sensor and be
kept still. The sensor may also be wired to the board through a 4-pin jumper and header pins.
This gives more flexibility of using the sensor as you can place the sensor over the skin on
palm, or wrap around a fingertip using paper or duct tape. A more practical way of putting a
sensor would be in the form of a finger clip, like in commercial Pulse Oximeters, so that the
sensor performance would not be affected too much by a slight movement of the finger.
Revised Version 2:
The Easy Pulse sensor is designed for hobby and educational applications to illustrate the
principle of photoplethysmography (PPG) as a non-invasive optical technique for detecting
cardio-vascular pulse wave from a fingertip. It uses an infrared light source to illuminate the
finger on one side, and a photodetector placed on the other side measures the small variations
in the transmitted light intensity. The variations in the photodetector signal are related to
changes in blood volume inside the tissue. The signal is filtered and amplified to obtain a nice
and clean PPG waveform, which is synchronous with the heart beat. The original version of
Easy Pulse uses the TCRT1000 reflective optical sensor to sense the blood variation in the
finger tissue and outputs a digital pulse which is synchronous with the heart beat. Today, we
are pleased to announce the release of Easy Pulse Version 1.1, which has some improvements
over the original design. The new version provides both analog PPG waveform as well as
digital pulse signal as separate outputs. Easy Pulse Version 1.1 board is available for
purchase on Tindie. Recently, our Chinese distributor Elecrow has also started selling it for
$18.50, and they can ship it world-wide at lower cost.

17

Quick overview of Easy Pulse


The Easy Pulse sensor is based on the principle of photoplethysmography (PPG) which is a
non-invasive method of measuring the variation in blood volume in tissues using a light
source and a detector. Since the change in blood volume is synchronous to the heart beat, this
technique can be used to calculate the heart rate. Transmittance and reflectance are two basic
types of photoplethysmography. For the transmittance PPG, a light source is emitted in to the
tissue and a light detector is placed in the opposite side of the tissue to measure the resultant
light. Because of the limited penetration depth of the light through organ tissue, the
transmittance PPG is applicable to a restricted body part, such as the finger or the ear lobe.
However, in the reflectance PPG, the light source and the light detector are both placed on the
same side of a body part. The light is emitted into the tissue and the reflected light is
measured by the detector. As the light doesnt have to penetrate the body, the reflectance
PPG can be applied to any parts of human body. In either case, the detected light reflected
from or transmitted through the body part will fluctuate according to the pulsatile blood flow
caused by the beating of the heart.
The original Easy Pulse design was based on the reflectance approach and used TCRT1000
IR device as sensor. It could detect the pulse signal when an user places his/her fingertip on
the top of the sensor. While this sensor performed well, it was susceptible to a very small
movement of the finger. So, the user should keep the finger very steady to obtain the accurate
pulse signal. Easy Pulse Version 1.1 uses a more robust sensor (HRM-2155E) that operates in
transmission mode and fits tight around the fingertip, thereby it is less prone to motion.
The HRM-2511E sensor is manufactured by Kyoto Electronic Co., China, and operates in
transmission mode. The sensor body is built with flexible Silicone rubber material that helps
to keep the sensor tightly hold to the finger. Inside the sensor case, an IR LED and a
photodetector are placed on two opposite sides and are facing each other. When a fingertip is
plugged into the sensor, it is illuminated by the IR light coming from the LED. The
photodetector diode receives the transmitted light through the tissue on other side. More or
less light is transmitted depending on the tissue blood volume. Consequently, the transmitted
light intensity varies with the pulsing of the blood with heart beat. A plot for this variation
against time is referred to be a photoplethysmographic or PPG signal. The following picture
shows a basic transmittance PPG probe setup to extract the pulse signal from the fingertip.

18

The PPG signal consists of a large DC component, which is attributed to the total blood
volume of the examined tissue, and a pulsatile (AC) component, which is synchronous to the
pumping action of the heart. The AC component, which carries vital information including
the heart rate, is much smaller in magnitude than the DC component. A typical PPG
waveform is shown in the figure below (not to scale).

19

The PPG signal consists of a large DC component, which is attributed to the total blood
volume of the examined tissue, and a pulsatile (AC) component, which is synchronous to the
pumping action of the heart. The AC component, which carries vital information including
the heart rate, is much smaller in magnitude than the DC component. A typical PPG
waveform is shown in the figure below (not to scale). - See more at: http://embeddedlab.com/blog/?p=7336#sthash.kCW34SAF.dpuf
The two maxima observed in the PPG are called Sytolic and Diastolic peaks, and they can
provide valuable information about the cardiovascular system (this topic is outside the scope
of this article). The time duration between two consecutive Systolic peaks gives the
instantaneous heart rate.
Here are the features of Easy Pulse V1.1 sensor module.

Uses HRM-2511E transmission PPG sensor for stable readings

MCP6004 Opamp with rail-to-rail output capability for maximum signal swing

Separate analog and digital outputs

Potentiometer gain control for the analog output

Pulse width control for the digital output

Additional test points on board for analyzing signals at different stages of


instrumentation

Circuit diagrams
The following circuit shows the ON/OFF control scheme for the infra-red light source inside
HRM-2511E. Note that the Enable signal must be pulled high in order to turn on the IR LED.
The photodetector output (VSENSOR) contains the PPG signal that goes to a two-stage filter
and amplifier circuit for further processing.

20

The PPG signal coming from the photodetector is weak and noisy. So we need an amplifier
and filter circuits to boost and clean the signal. In Stage I instrumentation, the signal is first
passed through a passive (RC) high-pass filter (HPF) to block the DC component of the PPG
signal. The cut-off frequency of the HPF is 0.5Hz, and is set by the values of R (=68K) and C
(=4.7uF). The output from the HPF goes to an Opamp-based active low-pass filter (LPF). The
Opamp operates in non-inverting mode and has gain and cut-off frequency set to 48 and
3.4Hz, respectively. In order to achieve a full swing of the PPG signal at the output, the
negative input of the Opamp is tied to a reference voltage (Vref) of 2.0V. The Vref is
generated using a zener diode. At the output is a potentiometer (P1) that acts as a manual gain
control. The output from the active LPF now goes to Stage II instrumentation circuit, which
is basically a replica of the Stage I circuit. Note that the amplitude of the signal going to the
second stage is controlled by P1. The Opamp used in this project is MCP6004 from
Microchip, which is a Quad-Opamp device and provides rail-to-rail output swing.

Stage I filtering and amplification


The second stage also consists similar HPF and LPF circuits. The two-step amplified and
filtered signal is now fed to a third Opamp, which is configured as a non-inverting buffer
21

with unity gain. The output of the buffer provides the required analog PPG signal. The
potentiometer P1 can be used to control the amplitude of the PPG signal appearing at the
output of the buffer stage.

Stage II instrumentation circuit


The fourth Opamp inside the MCP6004 device is used as a voltage comparator. The analog
PPG signal is fed to the positive input and the negative input is tied to a reference voltage
(VR). The magnitude of VR can be set anywhere between 0 and Vcc through potentiometer
P2 (shown below). Every time the PPG pulse wave exceeds the threshold VR, the output of
the comparator goes high. Thus, this arrangement provides an output digital pulse
synchronous to heart beat. Note that the width of the pulse is also determined by VR. An
LED connected to the digital output blinks accordingly.

Digital pulse output circuit


22

The following picture shows the Easy Pulse Version 1.1 board. The boards were
manufactured by Elecrow, a company based in Shenzhen, China, which offers component
sourcing, PCB manufacturing and assembly services. It turned out really good. The power
supply, Enable, Analog PPG output (AO), and digital pulse output (DO) pins are accessible
through the J1 headers. The HRM-2511E sensor connects to the board through a 3.5mm
Audio Jack connector (J2). TP1 and TP2 are test pads on the circuit board that are connected
to the raw PPG output signal (VSENSOR) and Stage I output (a), respectively.

Part 2:
In Part 1 of this article, we briefly discussed about the principle of Photoplethysmography
(PPG) and its applications in retrieving vital information about the cardiovascular system.
The Easy Pulse sensor allows you to measure the pulse rate from fingertip using the
transmission mode PPG. The Easy Pulse Version 1.1 uses the HRM-2511-E sensor that fits
comfortably onto fingertip. Inside the sensor there is an IR LED that illuminates the finger
from one side. A photodetector placed on the opposite side and facing towards the IR LED
detects the transmitted light through the finger. The little variations in the transmitted light
intensity are synchronous with blood volume changes and hence with the pumping action of
the heart. The on-board electronics filters out the noise from the PPG signal and amplifies the

23

signal so that it is readable by a microcontroller. In this part, we continue our discussion of


Easy Pulse Version 1.1 and analyze the output signals at various stages of instrumentation.

Although the HRM-2511E sensor fits on almost any of the five finger tips, we have found
that the sensor performance is better if used on the middle or index finger. The flexible elastic
Silicone rubber case helps to attach the sensor to the finger. The following picture shows a
correct way of placing the HRM-2511E sensor on the index finger. The IR LED illuminates
the finger from the top.

Placing HRM-2511E on the index finger


24

Testing the Easy Pulse (Version 1.1) sensor board


The HRM-2511E sensor is plugged into the Easy Pulse board socket J2, and a jumper is
placed between second (VCC) and third (Enable) pins of J1 to turn on the IR LED. A +5V
power supply is applied between the VCC and Gnd pins of the Easy Pulse board. Initially, the
potentiometers P1 and P2 are set to the midpoint. The sensor is plugged into the index finger.
Although the J1 header pins provides final PPG output signal, it is possible to analyze the
signal at various intermediate stages through test pads TP1 and TP2. TP1 connects to the
VSENSOR signal pin in the circuit diagram described in Part 1, whereas TP2 connects to the
output from the Stage I amplifier (see Part 1). Connect an oscilloscope channels to TP1, TP2,
AO (4th pin of J1), and DO (5th pin of J1) to observe the PPG waveforms at various stages.
The following pictures show measured PPG waveforms at these test points using Digilents
Analog Discovery tool.

Raw PPG signal at TP1 coming from the photodetector output (VSENSOR). Signal consists
of a large DC component and a small amplitude of the pulsatile component

25

PPG signal at TP2 coming from Stage I output. The amplified signal swings about the
reference voltage (Vref = 2.0V)

Final PPG output at AO pin. If the output at AO pin is found too small or saturated, adjust
the gain with potentiometer P1.
26

Digital pulse train synchronous to heart beats are observed at DO pin. The pulse width can
be varied through potentiometer P2. Its good to set the potentiometer P2 to half-way
(VR=2.5V) initially.
Summary
Easy Pulse sensor is designed for hobby and educational purposes to illustrate the principle of
photoplethysmography. The new version of Easy Pulse (Version 1.1) sensor uses a
transmission type sensor (HRM-2511E) that fits on finger tip and provides more stable PPG
readings. The Easy Pulse V1.1 sensor provides both analog PPG and digital pulse outputs.
The pulse rate information can be derived from any of the two outputs by measuring the time
period of the signal. We will discuss about this more in upcoming tutorials.
Using Arduino:
The heart rate, also referred to as pulse rate, has been recognized as a vital sign since the
beginning of medicine, and it is directly related to a persons cadiovascular health. Today, we
are going to make a PC-based heart rate monitor system using an Arduino board and Easy
Pulse V1.1 sensor. Easy Pulse is a pulse detecting sensor that uses the principle of
transmission photo-plethysmography (PPG) to sense the pulse signal from a finger tip. The
sensor output is read by the Arduino board, which then transfers the data to the PC through a
27

serial interface. A PC application is developed using Processing programming language to


display the received PPG signal and instantaneous heart rate.

Brief introduction of Easy Pulse V1.1


The Easy Pulse sensor is designed for hobby and educational applications to illustrate the
principle of photoplethysmography (PPG) as a non-invasive optical technique for detecting
cardio-vascular pulse wave from a fingertip. It uses an infrared light source to illuminate the
finger on one side, and a photodetector placed on the other side measures the small variations
in the transmitted light intensity. The variations in the photodetector signal are related to
changes in blood volume inside the tissue. The signal is filtered and amplified to obtain a nice
and clean PPG waveform, which is synchronous with the heart beat. For more details, read
Easy Pulse V1.1.

28

Hardware setup
The hardware setup for this project is very simple. All you need is an Easy Pulse V1.1 sensor,
an Arduino board, a PC, and few wires. The analog PPG output from Easy Pulse board is fed
to an ADC channel of Arduino to convert it into digital counts for further processing. In this
project, I am using a Crowduino board, a clone of Arduino Duemilanove, which is
manufactured by Elecrow.
The Crowduino is 100% compatible with Arduino Duemilanuve and comes with additional
features. The major difference between Crowduino and other arduino compatible boards is
the Crowduino contains a XBee socket. Thus Crowduino not only can adapt all the shields
that are compatible with arduino Uno, but also adapts to the Xbee modules from Digi, and
any module with the same footprint. It is currently on sale for only $18.90.
The following picture shows the connections between the Easy Pulse, Crowduino and Power
supply. The Easy Pulse sensor operates at +5V. The Enable pin (EN) of Easy Pulse is tied to
VCC pin so that the sensor is activated. There is a 2-pin jumper on the Easy Pulse board to do
this. The jumper is placed between VCC and EN pin by default, so you dont need an
external wire to do this. The analog output pin (AO) goes to analog input channel A0 of
Crowduino. A mini USB cable connects the Crowduino board to the PC. The power supply
for Easy Pulse is derived from the Crowduino board.

29

Arduino Sketch
The programming part of Arduino is very simple. The Arduino takes the ADC samples of the
analog PPG signal at 5ms interval and continuously transmits the data to the PC through the
USB-UART interface.
/* AnalogReadSerial Reads an analog input on pin 0, prints the result to the serial monitor
This example code is in the public domain. */
void setup()
{
Serial.begin(115200);
}
void loop()
{
int sensorValue = analogRead(A0);
30

Serial.println(sensorValue);
delay_x(5);
}
void delay_x(uint32_t millis_delay)
{
uint16_t micros_now = (uint16_t)micros();
while (millis_delay > 0)
{
if (((uint16_t)micros() - micros_now) >= 1000)
{
millis_delay--; micros_now += 1000;
}
}
}
PC application
On PC side, we develop an application that reads the incoming ADC samples from the
Arduino, and process them to extract the PPG signal and heart rate. The Processing software
is used to develop this application. The following flow-chart explains the overall logic of
computing the heart rate from the received ADC samples.

31

The PC application first reads 600 consecutive samples sent by Arduino. Since the sampling
rate was 5ms, it takes 3 sec to read the 6000 samples. The DC component (minima of 600
samples) is subtracted out from the samples. Next, the range of the samples is computed. If
the range is less than 50 counts, the received PPG waveform is very weak, and is considered
to be a noise. This could happen when no PPG signal is detected through fingertip (sensor is
faulty or disconnected) or the gain of the amplifier on Easy Pulse board is set very low. The
gain can be increased through potentiometer P1 on the Easy Pulse board.
If the range of ADC samples is greater than 50, it is considered as a valid PPG signal and is
displayed on the PC screen. The samples are scaled to 1-1023 for full swing of display. Next,
a 21-point moving average filter is applied to remove the unnecessary high frequency
32

components (usually noise) in the PPG signal. The resulting samples are plotted against time
to obtain a clean and smooth PPG waveform. Note that we lose 10 samples at the beginning
and 10 samples at the end while applying the moving average
avera filter.
Computing heart rate
The heart beat rate can be computed by knowing the time period of the PPG waveform. For
this, we identify three consecutive peaks in the waveform based on where the slope of the
curve changes from positive to negative, and the
the magnitude of the signal is greater than 80%
of the maxima of all the samples. Since two consecutive samples are 5ms apart, time
difference between any two peaks can be easily computed from their indices (or sequence
numbers). Two heart rates are computed
computed from the three consecutive PPG peaks and their
average value is displayed as an instantaneous heart rate. The identified peaks are also
marked on the display with a cross (X) symbol (see the PPG waveform plotted by the PC
application on the computer screen).
scre

Future work
The current version of the Processing application displays the near-real-time
near
time PPG waveform
and heart rate but does not record anything. There is a lot of room for improvements. Heres a
short list of features that I am seeing for its future
fut
release:

33

1. Logging heart rate measurements and PPG samples along with the time-stamp
information available from the PC
2. Beping sound alarm for heart rates below or above threshold
3. Heart rate trend over time, etc.

34