Lab 2

EE 309 Signals and Systems Lab
Fall 2017
Lab 2: Heart Rate Monitor – Periodic Signals
Learning Objectives:

Perform an analysis of a real-world periodic signal – Your heart rate.

Interface the heart-rate monitor to a USB based Oscilloscope (Digilent Analog Discovery).

Compute the period, energy per period, and average power in the signal.
Lab Overview:
Periodic signals are abundant in nature. A particularly interesting periodic signal is your heart beat. In this
lab we will be interfacing a simple heart-rate monitor to a data acquisition system (Digilent Analog Discovery
USB based Oscilloscope) in order to observe our heart beat signal. We will then interface the data acquisition
system to MATLAB in order to compute our heart rate and average power in the signal.
Grading:
Problem (value)
Points Awarded
Task 1 (10 points)
0
Task 2 (10 points)
0
Task 3 (10 points)
0
Question 1 (10 points)
0
Question 2 (10 points)
0
Task 4 (30 points)
0
Task 5 (20 points)
0
Total (100 points)
0.00
Enter points per problem,
then, select the number in
Total and hit F9 to update
YOUR NAME(S)
Lab 02
Page 1 of 6
EE 309 Signals and Systems Lab
Fall 2017
Experiments
EXPERIMENT 1.
MEASURING THE HEART RATE SIGNAL
We will be using the Digilent Analog Discovery and associated Waveforms software to interface with a
heart rate sensor.
Step 1.a: Connect the Analog Discovery (AD) to the heart rate monitor and view the waveform

Plug the Analog Discovery (AD) into a free USB port and wait
for the drivers to load.

PURPLE wire = Signal
RED wire
= +3V to +5V
BLACK wire = GND
Noting the pinout of the heart rate sensor connect it to the
Analog Discovery Oscilloscope channel #1 (see Appendix A: ).
1. Ground the scope Channel 1 negative and HR signal
ground (by connecting both to the black AD ground).
2. Connect the HR signal to scope Channel 1 positive.
3. Connect the HR +5V to AD V+ (5 V out).
Oscilloscope

Start the Digilent -> WaveForms software (
) and click
on the “Scope” icon in order to start the oscilloscope.

Using the Velcro strap wrap the pulse sensor around your
finger tip as shown in Figure 1.

Turn on the Analog Discovery +5V power supply (Voltage icon).

“Run” the oscilloscope to see the signal and adjust the Time base, voltage range, and voltage offset
in order to see 2 to 3 periods of the waveform.
Figure 1 How to attach the heart rate sensor to your finger.
YOUR NAME(S)
Lab 02
Page 2 of 6
EE 309 Signals and Systems Lab
Task 1.
Fall 2017
Capture a screenshot of your heart rate waveform and use Paint to add your name to the
screenshot (insert into Figure 2). Replace the image below.
Figure 2 Heart rate waveform via Analog Discovery Waveforms software.
Task 2.
By visually inspecting the plot in Figure 2 (your heartrate plot not the original) determine the
fundamental period and frequency of the waveform and thus estimate your heartrate.
YOUR NAME(S)
Period:
______________ (seconds)
Frequency:
______________ (Hz)
Heart Rate:
______________ (beats per min (bpm))
Lab 02
Page 3 of 6
EE 309 Signals and Systems Lab
EXPERIMENT 2.
Fall 2017
COMPUTING THE AVERAGE POWER IN THE WAVEFORM
We will now interface the Analog Discovery to MATLAB in order to numerically compute the average power
of the signal.
Task 3.
Use the provided MATLAB starting script in order to interface the Analog Discovery to MATLAB.
Modify the script to use YOUR NAME in the title (NOT my name). This script collects 10 seconds of data
and saves the results into a file entitled “Lab02_data.mat.” Extract a suitable interval of this data
corresponding to 2 to 3 periods of the waveform and past into Figure 3 (The plot MUST have your name
in the title).
HINT: What is the continuous time equation for energy/power?
Can you “discretize” these eqns?
Figure 3 Heart rate waveform via MATLAB interface to the Analog Discovery.
Question 1. Referring to the waveform data determine the energy in a single period:
Energy per period = ??? (Joules)
Question 2. Referring to the waveform data determine the average power of the waveform.
Average Power = ??? (Watts)
Include carefully commented MATLAB code in the Appendix B to explain how you calculated responses to the
above questions
YOUR NAME(S)
Lab 02
Page 4 of 6
EE 309 Signals and Systems Lab
EXPERIMENT 3.
Fall 2017
HEART RATE MONITOR
Update the MATLAB script to automatically compute your heartrate in beats per minute. Use the MATLAB
“text” command to annotate your plot by adding the text (replace the “???” with a number):
“YOUR HEART RATE IS ??? Beats per min”
Task 4.
Place a copy of the resulting plot with automated heart rate monitoring into Figure 4.
Task 5.
Insert your updated MATLAB script (carefully commented) into Appendix C.
Be sure to capture at least 5 cycles!!
Figure 4 Automated heart rate monitoring.
Question 3. How did you automate the process of determining the duration of a single period (explain and
be sure to document your MATLAB code)?
YOUR NAME(S)
Lab 02
Page 5 of 6
EE 309 Signals and Systems Lab
Fall 2017
Appendices
APPENDIX A: USING THE ANALOG DISCOVERY OSCILLOSCOPE
Figure 5 Input / Output connections for the Analog Discovery.
APPENDIX B: MATLAB CODE FOR EXPERIMENT 2
APPENDIX C: MATLAB CODE FOR EXPERIMENT 3
YOUR NAME(S)
Lab 02
Page 6 of 6