Post on 17-Feb-2022
transcript
Pulse Sensor
Individual Progress Report
TA: Kevin Chen
ECE 445
March 31, 2015
Name: Ying Wang
NETID: ywang360
I. Overview
1. Objective
This project intends to realize a device that can read the human pulse rate from a fingertip. The
pulse rate in the unit of beats per minute (BPM) and a calculated Target Heart Rate will be
displayed by a 16 by 2 LCD display. According to the National Institute of Health, the average
resting heart rate for children 10 years and older, and adults (including seniors) is 60 - 100 beats
per minute. Well-trained athletes is 40 - 60 beats per minute. A real-time plot of pulse signal versus
time will be displayed on a laptop screen.
2. Modules and Module Input/Output Requirements
There are four modules in this design: Power Module, Sensor Module, Microcontroller, and
Display Module. Figure I-1 shows a block diagram of their relations.
Figure I-1 Modules and module relation
2-1. Power Module
The required power supply for this device is DC 5V. In order to obtain a constant and stable
5V output, a regulator circuit is designed. The regulator circuit will take an input voltage of 9V
battery and output a constant 5V voltage. For details and simulation results please see the module
design part below.
2-2. Sensor Module
The sensor is in direct contact with a human finger (input). It first contains a sensor that can
sense the blood circulation and convert it to electrical signals. This will be followed by a circuit
for amplification and noise reduction. The output of the sensor in this design will be a real-time
analog voltage signal that swings within a reasonable range between 0 V and Vcc = 5 V. The Sensor
Module will be placed on a PCB board for the final device.
2-3. Microcontroller
The Microcontroller (will be Arduino Uno in this design) takes the output of the Sensor Module.
The output of Sensor Module will first subject to A/D conversion. Through Microcontroller
programming, the digital signal is processed, the pulse rate (BPM) should be calculated then sent
to the output ports of the Microcontroller and a calculated result of Target Heart Rate in beats per
minute will also be sent to the output port of the microcontroller. The output signal needs to be
compatible with the input requirement of a 16 by 2 LCD display unit. The Microcontroller also
needs to handle the communication with a PC via a serial port in order to send the real-time pulse
signal to PC for display. A free software called Processing1 can be used to handle the display for
data coming from a serial port.
2.4 Display Module
Display Module takes the output of Microcontroller. It will contains two components. The first
is an on-board display unit which shows the Pulse Rate and Target Heart Rate. The second is a
window opened on a PC screen that can do real-time display of pulse signal transported from the
serial port. This is also to confirm the device has received reasonable signal.
II. Module Design
1. Power Module
The regulator circuit will take an input voltage of 9V battery and output a constant 5V voltage.
Schematics: using a zener diode D1, resistor R1 and transistor Q1 to form a voltage regulator, R2
is the load resistor.
1 https://processing.org/reference/libraries/serial/serialEvent_.html
D1
Zener Voltage = 5.6
Qbreakn
Q1
R1
100
5.606V
9.000V 4.909V
0
V19Vdc
V2
FREQ = 100VAMPL = 0.2VOFF = 0
AC =
0V
0V
R2
10
V2
V1
V3
VV
Figure II-0 voltage regulator circuit (5V)
Simulation Result: Q1 is using 2N3055 mode, other parameters are shown in the figure above.
The vibration of the input voltage is modeled by a sine signal.
The green line is the total input voltage and the red is the output voltage of the regulator, which
is fixed at ~ 4.9 V.
Tolerance Analysis:
We can calculate the output voltage to be:
V3 = ((V1-0.6)/R1 + 5/ZZT)*(beta + 1)/(1/R2 + (beta+1)/R1 + (beta+1)/ZZT), where ZZT = 11
ohm from the Zener model and beta = 130.
The load resistance is estimated to be 10 ohm, leading to a current of 0.5 A. Assuming V3 = 5 ±
0.4 V, this lead to R1 should be larger than ~80 ohm.
The minimum current passing R1 should be 0.5 mA/(beta+1) + Is = 0.0048 A. This lead to the
maximum R1 allowed to be about 700 ohm.
2. Sensor Module
The sensor I will use to convert blood pulse into electrical signal is a pair of infrared (IR) emitter
and detector. The emitter and detector will be put side by side facing upwards. When a fingertip is
place on top of both, IR light will be reflected by the finger and the blood circulation inside the
finger can cause a periodic change of IR intensity reflected, therefore, a period current response in
the detector. The response is rather weak and could be noisy. Shown below by Figure II-1 is the
original design from makezine.com2. This design has some problems and cannot satisfy the
requirement stated above. I will do two modifications.
Figure II-1 Original sensor module design
2-1. Load Resistors of Emitter and Detector
The first modification is rather trivial. I need to adjust the value of load resistors (shown in
Figure II-2) for the emitter and detector to ensure they work fine and more importantly to make
sure a reasonable DC component of the detector output (not too close to ground and not too close
to Vcc). The recommended forward voltage of the emitter from the datasheet is 1.2 V with a forward
current of 20 mA. This leads to a load resistance
R1 = (5 V – 1.2 V) / 20 mA = 190 Ω
This happens to be not very different from 220 Ω in the original design so I will just keep R1 =
220 Ω.
2 Makezine.com/projects/ir-pulse-sensor
Figure II-2 Sensor composed by an IR emitter and detector.
In order to get a reasonable R2, I use a voltmeter (from the toolbox) to measure Vo in Figure
II-2. It was found that when I use R2 = 8.2 kΩ, Vo has a reasonable range between ~2 V to ~3 V
when a finger is placed on the sensor.
2-2. Re-design the circuit after detector
The circuit in Figure II-1 will not work properly mainly because of two reasons. 1. The first
OPAMP, in my opinion, is for noise reduction. But a quick analysis of its transfer function reveals
that it is band reject filter that reject the frequency from ~1.6 Hz to ~194 Hz. This doesn’t make
sense to me because there are still useful signal above 1.6 Hz(for example, pulse above 96). 2. The
second OPAMP is to amplify the signal however, it can be calculated that the gain at f = 1 Hz is
about 100, which is possibly too large that could result in cut-off (clipping) of the real signal. This
is indeed observed as will be shown in the Test and Verification Section.
Before design my own circuit, I first look at the real-time output Vo of the detector (with a
fingertip on the sensor), which will serve as the input of the following circuit. Figure II-3 shows
the Vo versus time recorded by Arduino Uno and displayed on my laptop by Processing. Although
the signal shown here is pretty clean, sometimes noisy signal was seen. Details of how the test was
done will be provided in the Test and Verification Section. Basically, by using Arduino and
Processing, the laptop can be used as an oscilloscope. As we can see the output voltage has a DC
level of ~ 2 V a peak-to-peak voltage is ~ 0.13 V. This tells me that I need to design the amplifier
gain to be ~10 to 20. A gain of 100 is definitely too high!
Figure II-3 Pulse signal measured from the output Vo of the detector with a finger on. No load was
added to Vo.
Directly after the IR detector output, I plan to first add a low-pass filter to filter out the high-
frequency noise. I choose to use the Sallen-Key structure3.
Figure II-4 Butterworth low-pass filter using Sallen-Key architecture
Figure II-4 shows a low-pass filter using Sallen-Key architecture. The output resistance of the
IR detector is just R2 = 8.2 kΩ. It is decided for now that any signal with f > ~20 Hz should be
suppressed. Guided by the design rule in the footnote document, we assume R4 = R, R2+R3 =
mR, C1 = C, and C2 = nC. The cut-off frequency fc = 1/(2πRC(mn)0.5) and for Butterworth filter
Q = (mn)0.5/(m+1) = 0.707. So in order to meet fc = 20 Hz, the following design can be
calculated:
n m C1 C2 R3 R4
3.3 0.229 0.2 uF 0.66 uF 11.4 kΩ 50 kΩ
3 http://www.ti.com/lit/an/sloa049b/sloa049b.pdf
U1
OPAMP
+
-
OUT
C2
C1
R3 R4R2
8.2k
V10.13Vac
2Vdc
output to amplif ier
Open Circtui output of IR detector
Load of IR
detector
The next stage will be an amplifier that has a gain of ~ 10 at f = 1 Hz. In addition, the DC
component should not be amplified, only the AC component needs to be. So the amplifier needs
to have a high-pass feature which is reject the very low frequency signal. It is decided here the
low-frequency roll-off frequency to be 0.1 Hz. The circuit can be realized as in Figure II-5.
Figure II-5 amplifier circuit with a high-pass design to only amplify AC component
The transfer function of Figure II-5 is
𝐻 = 𝑅7 + 𝑅6
𝑅7
𝑠 𝑅5 𝐶3
1 + 𝑠 𝑅5 𝐶3
To realize a gain of 10, R6 can be 9 kΩ and R7 can be 1 kΩ. The low-frequency roll-off fc =
1/(2πR5C3) = 0.1 Hz. So it can be designed that R5 = 160 kΩ and C3 = 100 uF.
The total Sensor Module design should connect Figure II-3, II-4 and II-5 together.
2-3. Re-design the circuit after filter
After further testing of the pulse sensor circuit, I find that the current gain 10 is too big. So I
modified the gain to 4 and redesigned the amplifier part of the circuit as following:
C3
R5 R6
R7
U2
OPAMP
+
-
OUT go to Arduino A0
output of f ilter
C3
R51
R6
R71
U2
OPAMP
+
-
OUT go to Arduino A0
output of f ilter
5V
R52 R53
R72
C3 = 100 uF, R51=160 kΩ, R52 = R53 = 9 kΩ, R6 = 9 kΩ, R71=1.8 kΩ, R72=1 kΩ, now the
gain is (R6+R71+R72)/(R71+R72) = 11.8/2.8 = 4.2
The testing result could be seen in the following testing part.
3. Microcontroller Module
I am going to use Arduino Uno in this design. The Microcontroller takes the output of the Sensor
Module, which is periodic analog voltage signal.
3-1. Arduino Uno Inputs and Outputs
The inputs and outputs of an Arduino Uno is shown below as Figure II-6.
Figure II-6 Input and Output ports of Arduino Uno
Arduino Uno has 6 analog inputs A0 to A5 (inputs between 0 V - 5 V), the analog signal is
sampled and digitalized and then output to the serial port on the top right of Figure II-6. The
digitalization has 1024 levels thus one sample is a number between 0 and 1023. Each output data
consists of 5 characters in total: a 4-digit decimal number, represented by four characters, and a
new line character. Each character uses 10 bits, 8 of which are for the actual character and the
other 2 are for other use. The bit rate of the serial port is 9600 Hz by default. The sampling rate
therefore can be calculated by 9600/5/10 = 192 samples/sec.
As have been mentioned before the serial port can be read by a PC using Processing. Processing
can also draw a dynamically updated graph each time a sample arrives.
About the output for the 7-segment displays, three displays will be used because a pulse rate
could not exceed 999 BPM. I am planning to use the 12 of the 14 digital I/O ports, denoted here
as O0, O1, … , O11 to output the binary coded decimal (BCD) signal. O0, O1, O2 and O3 will be
used for the lowest decimal digit. O4, O5, O6, O7 for the second decimal digital. O8, O9, O10,
and O11 for the third.
The inputs and output connections have also been shown in Figure II-6.
3-2. Obtaining Pulse Rate by Programming
Here is the basic algorithm I am going to use to get the pulse rate (BPM). Imaging a pulse
signal that looks like what is show in Figure II-3,
First, the digital signal might be subject to an averaging to make it very smooth
Second, I am planning to record all the local maxima including their time stamps T[i] and
values V[i] with certain time interval, say, 2 seconds. See Figure II-7 below for the flow chart.
Figure II-7 Flow chart for recording all local maxima with a time interval of 2 seconds.
Next, we can scan V[i] and discard those maxima that are apparently smaller than others. Only
keep the V[i] that are the largest and within certain variation range. Then the pulse rate can be
calculated by the two arrays T[i], i = 1 to m:
BPM = 60 ∑ (𝑇[𝑖] − 𝑇[𝑖 − 1])/(𝑚 − 1)𝑚𝑖=1
Finally, the BPM number, which should be a 3-digit integer here, needs to have each of the three
digits into a BCD number and then output to O0 to O11, which can be read by Display Module.
This is rather simple and can be illustrated by Figure II-8 below. After this the program should go
to calculate the averaged pulse rate of the next 2 seconds.
Figure II-8 convert BPM to output that can be read by Display module
Target Heart Rate Range Calculation Formula: (220-age)*50%-------(220-age)*80%. This
formula is concluded from the data information on American Heart Association website :
http://www.heart.org/HEARTORG/GettingHealthy/PhysicalActivity/FitnessBasics/Target-Heart-
Rates_UCM_434341_Article.jsp
4. Display Module
For the display module I will use a 16 by 2 LCD display (LCM 1602 16-by-2) for displaying
the pulse rate and Target Heart Rate.
III. Test and Verification
1. Test/verification plan
Requirement Verification Points
Power Supply
Output a stable 5V(+/-0.4V)
voltage to the rest of circuit
and within +/-0.2A of needed
current
Put a voltmeter across the
output of regulator circuit, the
voltage should be within
5V+-0.4V. The components
of the circuit should all work
properly without any short or
overload.
15
Pulse Sensor
The pulse sensor should
output an accurate periodic
analog signal to
microcontroller. The periodic
The output of the pulse sensor
circuit could be verified by
using a free software called
“Processing” It could sketch
the output of the pulse sensor
40
wave should correspond to
the pulse of the testing people
within 5 beats per minute.
circuit synchronously to a PC
screen. Then we can count
the pulse per minute based on
the waveform and compare it
with the result of iPhone App
“Heart Rate”
Microcontroller
The Microcontroller takes the
output of the Sensor Module
and calculate the beats per
minute and output to the
display module. The beats per
minute should be accurate
within 5 beats/min
The calculated beats per
minute (binary value) can be
displayed by processing then
we can compare the output of
the microcontroller with the
waveform generated by pulse
module.
20
Display Module
Takes the output of the
microcontroller and convert it
to seven segment display
To be compared with the
binary value number
displayed by “processing”
25
2. Schedule
March 1st week Test the Sensor Module output, modify circuit design if necessary.
Should be a periodic signal that swings within a reasonable range.
This can be verified by using Arduino and Processing to do real-
time monitoring.
March 2nd week Simulate Power supply module, Microcontroller programming and
test the LED display. Both can be verified by the real-time signal
recorded by Arduino and Processing. March 3rd week
March 4th week Finalize circuit design and start to design PCB board
April 1st week Prepare for mock Demo, finalize PCB board
April 2nd week Test PCB board
April 3rd week Demonstration
April 4th week Write final report
3. Initial Test Results
3-1. Test setup using Arduino and Processing.
Figure III-1 Circuit test setup, using Arduino and Processing as an Oscilloscope.
Figure III-1 shows the test setup used for the Sensor Module. How to connect Arduino has been
explained previously. The code for creating such dynamic figure using Processing can be found
on the Arduino website4. Basically, whenever the serial port receives a number, the code will
update the figure with a new date point.
The voltage output of the IR detector has been shown by Figure II-3. Here I show in Figure III-
2 the results of Sensor Module output using the original and problematic design.
Figure III-2 Output of the original design
4 http://arduino.cc/en/tutorial/Graph
As can be seen here, the signal is very noisy. In addition, when compare Figure III-2 to Figure
II-3, we can see the output of the original design is significantly distorted, which I believe is due
to that the gain is too high. The new design has been described in the text above.
4. Further Testing Results
After modifying the pulse sensor circuit and change the gain to 5, I did the testing and the
result is as following:
The above figure is clean but some peaks got clipped off because the gain is still a little bit too high.
So I modified the circuit again so the gain is reduced to 4. I did the testing again as following:
The above figure is showing the pulse rate with a light press of finger on the IR emitter and detector.
The following figure is showing the pulse rate with a harder press of finger on the IR emitter and
detector. As could be seen from the two figures, the IR emitter and detector are sensitive to the
pressure of the finger, the harder press of the finger gives a better and cleaner waveform.
IV. Cost Analysis
Labor
Name Hourly Rate Total hours invested Total = Hourly Rate x
2.5 x Total Hours
Invested
Ying Wang $27.50 600 $41250
Parts List
Part name Numbers Total cost ($)
IR emitter 1 2
IR detector 1 2
Arduino Uno 1 30.00
OPAMP LM324 1 2
LCM 1602 16-by-2 1 Free
5.6 V Zener diode 1 0.10
2N3005 NPN transistor 1 0.84
9V battery 1 1.37
9V battery clip 1 0.22
25 pin solder tail strip socket 2 10.64
Resistors, Capacitors and
LEDs
Free
Total 49.17
Total cost: $41298
V. Safety
The safety of this pulse sensor is one of the most important aspect when designing this device.
This pulse sensor will be powered by 9V battery so it is safe for people to use. The IR emitter
and detector may contain Arsenide which could be hazardous if broken. They are safe under
normal conditions. Children should not use this device without an adult’s guidance. It is also
important to note that there are many factors that could affect people’s pulse, like emotions,
temperature, body position, body size and medication use. This device is not a substitute for
professional diagnostics. If your pulse is very high or if you have frequent episodes of
unexplained fast heart rates, especially if they cause you to feel weak or dizzy or faint, tell your
doctor, who can decide if it’s an emergency.
VI. Ethics
This pulse sensor is designed to improve the quality of people’s life. The pulse rate is an
important indicator of people’s health condition. So measuring the pulse rate accurately and
anytime they want at home or outside satisfies people’s needs and benefit them in many ways.
VII Work to be done
So far I have performed the pulse sensor module testing, power module simulation and prepared
the PCB board. Further work need to be done on power module testing, Arduino programming
and display in the next few weeks.