Spec No: 001-34542
- AN2158
Sunset Owner: M Ganesh Raaja (GRAA)
Replaced by: 001-40404
Sensing - Optical PulsOmeter With PSoC®
Author: Victor Kremin
Associated Project: Yes
Associated Part Family: CY8C24xxx, CY8C27xxx
Software Version: PSoC® Designer™ 5.1 SP1.1
Associated Application Notes: AN2041, AN2042, AN2152
AN2158 describes the Optical PulsOmeter. PulsOmeters can be used in the medical sector during sport tests for pulserate monitoring, or embedded in various sports training equipment. The PulsOmeter can transmit both raw optical pulse
wave signals and measured pulse rate values to the PC, which allows the device to be used for illness diagnostics and
pulse rate logging.
Pulse rate measurement is very important in a mixture of
medical applications, sports training, and to elements of an
active live style. Various techniques that can be used to
measure pulse rate and possible approaches include:
Mechanical methods, which convert the vessel
rippling into electric signals using a strain or pressure
sensor. Piezoelectric sensors are typically used in
these applications, but the sensor position is very
sensitive to the vessel location or vessel
displacement. Conventional tonometers use the air
gland, which is relatively large and not practical for
long-term use.
Pulse rate electrical signal detection methods, which
require placement of two or more electrodes on the
skin for electric impulse reception. Electrodes are held
in place using self-adhesives or flexible straps. To
make pulse rate monitoring more comfortable during
training, the electrodes and a micropower wireless
transmitter are placed on a flexible waistband in many
commercial products. Recent research has reported
contact-less electric heart rate monitoring by
measuring the radiated electromagnetic field with a
supersensitive receiver. This technique is very
expensive today and needs “clear” room for practical
Optical pulse measuring methods, based on human
tissue light absorption level modulation by changing
blood capillary filling via heart activity. This method
yields more than simple pulse rate measurement. The
light modulation curve analysis is an efficient way to
diagnose respiratory system activity and detect
illness. Measuring the difference in light absorption in
infrared and red bands allows determination of blood
oxygen saturation level.
The light absorption modulation method has been used in
the proposed PulsOmeter. The PulsOmeter sensor
consists of the infrared LED and the photodiode. The
sensor can be located different places on the human body:
finger, arm, hand, or ear lobe. In such designs, the light
path is different depending on sensor location. When the
sensor is placed on opposite sides of the finger or ear
lobe, the photodiode receives the through-passing light;
the received signal is large enough and can be easily
amplified and processed. When sensor diodes are located
on the same arm or finger side, the photodiode receives
the diffused signal. The diffused signal is weak and
contains noise introduced by various external light sources
such as sun, bulb and fluorescent lamps. Careful signal
processing should be applied in this case to obtain reliable
PulsOmeter operation. The developed PulsOmeter
supports any of the above described sensor locations
using a combination of hardware and software
signal-processing methods.
The PulsOmeter technical specifications are given in
Table 1.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
Table 1. PulsOmeter Specifications
Item Value
Pulse Measurement Method
Optical, using light absorption modulation via capillary filling pulsations.
Power Supply Voltage
3.3 V
Power Consumption
35 mA
Measured Pulse Range
30 - 300 beats per minute.
Measurement Error
Measurement Time
7-9 pulse intervals or 30/60 s, depending selected method.
Pulse Calculation Methods
Measuring time interval between adjacent beats or calculated number of beats during fixed time
Display Type
Multifunctional graphic LCD, 48x84 pixels resolution.
Service Features
Two pulse calculation methods.
Automatic measurement starting when pulse beat signal detected.
Last measurement data hold.
Minimum and maximum pulse estimation.
Beat signal level in bar-graph representation for finding optimal position for sensor.
Separate LED for displaying beats.
PulsOmeter Block Diagram
Figure 1 depicts the PulsOmeter flowchart. The device
uses the modulation technique in the sensor signal
processing to increase noise resistance. The carrier
generator forms the modulation signal, which drives the
infrared LED. The received light is converted into an
electric signal by a photodiode FED, and amplified and
filtered by a band-pass filter (BPF). The bias generator
removes the low-frequency noise (any constant level or
AC-powered lamp induced) from the photodiode signal. It
also provides stable FED bias voltage, regardless of
external light, together with high input impedance for
modulation frequency photodiode current.
The BPF output signal is rectified by a synchronous
amplitude demodulator. The demodulator reference signal
is set to the modulation signal. The demodulator output is
sampled directly by the integrating ADC. The ADCs with a
sigma-delta modulator have a nice feature of conversion
signals with a frequency much more than a sample
frequency, performing the low-pass filtering in the internal
This feature allows elimination of additional hardware and
connection of the ADC input directly to the rectifier output.
Note that the conversion time is set equal to the carrier
signal period integer number in order to place the ADC’s
gain-frequency characteristic zeros for carrier signal
The processing of the ADC data stream is implemented in
firmware. The low-pass filter (LPF) additionally removes
the noise-on-output signal. To increase the dynamic range
of input signals, the automatic gain control loop is
implemented, which compresses the dynamic range of the
input signal by properly adjusting the BPF gain level
according to the LPF software output value. The high-pass
filter (HPF) removes the DC component in the LPF output
signal and separates the pulse signal. The pulse beats are
detected by a smart peak detector with a threshold level
that is automatically adjusted to increase the noise
resistance. The software calculates the pulse rate in
beats-per-minute, evaluates the minimum/maximum
values during continuous measurement, and provides
various PulsOmeter state information visualization, such
as pulse beat signal level, error conditions, operational
mode, gain level, etc.
For external pulse wave signal processing and debug
purposes, the raw unfiltered ADC data can be sent via a
RS232 port.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
Figure 1. The PulsOmeter Flowchart
Device Schematic
The PulsOmeter schematic is represented in Figure 2. Q1 is the voltage-to-current converter, which forms the DC bias level for
photodiode D1. The bias generator has low impedance for constant current or low frequency signals, and suppresses the noise
signals caused by various external light sources. For the modulation frequency signals, the impedance is determined primarily
by R2. The Q1 base signal is formed by a PSoC® programmable gain amplifier (PGA) module, which amplifies the photodiode
signal. The PGA output voltage is determined by PGA reference, which is connected to AGND in this design. The bias
generator allows reduction of the required photodiode signal gain level, reduction of the LED drive current, and in final,
decreased noise level in the output waveform. Figure 3 shows the characteristics of the bias generator frequency.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
Figure 2. External Hardware Schematic
Figure 3. Bias Generator Characteristics
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
D2 is the modulation infrared LED and D3 is the beat LED
for PulsOmeter work “visualization.” This LED flashes
every time a beat is detected. The PulsOmeter uses a very
low-cost graphic LCD, based on the PCD8544 LCD
controller from Philips.
More details about this LCD are given in AN2152. Note
that the PCD8544 requires the reset signal to be applied
within a predefined interval after power-up. To satisfy this
demand, the LCD reset pin is connected with P1[1], which
is tied low after reset for a duration by PSoC internal
The two buttons are used to control the PulsOmeter:
“Reset” and “Mode.” The user clears the last measured
value and statistical information and reinitializes the
measurement cycle by pressing the “Reset” button.
“Mode” is used for changing the pulse rate calculation
method. The optional RS232 level translator U4 with
auto-shutdown can be used for sensing the raw ADC data
or measured pulse rate values from the external PC.
PSoC Internals
The PSoC internal structure is shown in Figure 4. The bias
generator PGA is placed in ACB00. The amplifier is
connected to the BPF, which is placed in ASC10 and
ASD20. The filter output signal is passed to the
synchronous rectifier, which is built around the switched
capacitor block. The rectifier reference comes from the
BPF comparator bus, this requires using the vertical fitter
topology. The rectifier module additionally amplifies the
BPF output signal for better ADC dynamic range
utilization. The rectifier output is sent via P0[5] to
checkpoint TP1 for test and debug purposes. Note that the
column buffer BUF1 can be disabled to save power in the
product release. In the 3.3 V powered PulsOmeter, the
AGND level is Vdd/2 ± Vdd/2, but the 5 V version can use
other AGND settings. The bias generator output is
connected to the checkpoint TP2 for debug purposes.
The low-drop linear regulator U3 powers the device from a
4-10 V power supply or battery. Some commercial
PulsOmeter applications can use a battery powered
supply. The low-cost, low-noise switching regulated
charge pumps from Texas Instruments, TPS60310, are
ideal for battery voltage conversion via high-efficiently,
ultra-low quiescent current and inductor-less operation.
The PSoC can wake-up via a button-pressing event and
go back to sleep when the sensor does not receive a
signal during a predefined timeout. This yields increasing
usefulness of the PulsOmeter.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
Figure 4. PSoC Internals
The rectifier output is connected to the ADC input. In this
design, the sigma-delta ADC with counter-type filter (or
incremental ADC in the terms of PSoC documentation) is
used. The ADC resolution is set to 13 bits, and the
integration time is adjusted to be an equal number of
modulation signals in the firmware by directly writing to the
ADC PWM16 period and compare registers. As a result,
the effective resolution is 12.25 bits. The modulation
frequency is set to 5 kHz and the fitter over-sample ratio is
100. ADC integration time is 10 mS, or 50 modulation
signal periods, and the ADC sample frequency is very
close to 100 Hz. All switched capacitor modules use the
same column frequency for aliasing problem elimination.
The serial transmitter, placed in DCB12, together with the
baud-rate timer, placed in DBB11, are used for
transmitting debug ADC sample streams or other
information to the PC. They can be omitted in the
production release of the PulsOmeter. The timer, placed in
DBB00, forms the modulation signal. The timer clock
source is VC3. The SPIM User Module, placed in DCB13,
is used for serial communication with the graphic LCD
Note that the project can be ported to the low-cost
CY8C24xxx PSoC device group without any problems.
The serial transmitter and SPIM modules should be
eliminated because debug functionality is not required in
the production release. The LCD interface can easily be
implemented in software because the data rate is so low.
As an alternative, the low-cost graphic LCD with I2C
communication interface, based on Phillips PCF8548 for
example, can be used thanks to the I2C hardware support
in both the CY8C24/27xxx device families.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
The Software
The PulsOmeter software can be separated into two parts:
real-time signal processing and service routines. Signal
processing is run in the foreground. It performs the ADC
data steam low-pass and high-pass filtering, pulse peak
detection, and interval calculation between adjacent
peaks. The pulse rate calculation routines are run in the
background in the main program loop. The incremental
signal-processing routine.
The existing user module library version is implemented in
assembly, including ADC conversion service routines,
which create additional work as modulator control, data
pre-processing, etc. But I do not favor assembly
programming and prefer to use ‘C’ when possible. To call
a ‘C’ function from the ISR, all virtual registers should be
This is because the compiler does not
automatically save these registers, and the #pragma
interrupt_handler generates ISR code that ends with
the RETI instruction instead of RET. ISR code ends with
the RETI instruction because additional assembly code
needs to be executed after the ‘C’ function ends. The
elegant solution is to use software interrupts. When the
ADC data is ready, the ADC conversion ISR triggers the
software interrupt for an unused hardware module (I2C in
this design) and the CPU jumps directly to the ‘C’ code of
the ISR.
Figure 5 illustrates the real-time signal-processing
algorithm. The ADC samples are filtered by a second
order IIR LPF. The filter transfer characteristic is given in
Equation 1, where a =0.25. The filter is implemented as a
cascade connection of two first-order sections. The filter
gain is
a −1 .
H LPF ( z ) =
Equation 1
1 − 2 (1 − a ) z −1 + (1 − a ) z −2
When the LPF value is updated, old ADC data is no longer
required and the interrupts can be re-enabled. The heart
activity causes the received signal amplitude modulation
coefficient to range 0.015÷0.05, depending on the sensor
position and individual human characteristics. This allows
users to use the LPF output for automatic gain control
(AGC) loop operation. When the filter signal is too low, the
AGC increases the BPF gain, and when the input signal is
too high, the AGC decreases the BPF gain to hold the LPF
output signal within the predefined range.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
Figure 5. PulsOmeter Signal Processing Algorithm
Update low-pass
filter value ULpf
ULpf > Umax
Gcur > Gmin
Automatic gain control loop
Enable Interrupts
Decrease PBF gain
ULpf < Umin
Gcur < Gmax
Increase PBF gain
== PointsRange
UHpf > UHpf max
Update UIn peak
UHpf max == UHpf
UHpf max
Points_Counter ++
Heart beats signal range
estimator and threshold
Update high-pass
filter value UHpf
UHpf > UIn peak
UPeak max > 0
Reset UPeak max
Calculate the peak time
UHpf > UPeak max
UPeak max = UHpf
Peak = Cycles_Counter
Peak detection and interval
Cycles_Counter ++
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
The HPF removes the DC component from the LPF
output. The 7-order FIR HPF with differentiator
characteristics is used. The filter transfer characteristic is
given in Equation 2. The filter gain is 60.
H HPF ( z ) =z − 9 z + 45z − 45z + 9 z − z
Equation 2
The HPF separates the moments when blood is put to
vessels by the heart. The peak detector is used to detect
the heartbeat. The detector searches for the maximum
pulse signals when the HPF signal is greater than the
threshold value. Note that the peak detector threshold is
adjusted dynamically according to the pulse signal
amplitude to increase noise resistance. The threshold is
set to half of the maximum pulse amplitude during a
predefined time interval, 1 or 2 s in this design, and is
filtered by a non-linear first order IIR LPF, which is
described in the following equation:
U thi +1
U thi +1 and U thi are the peak detector threshold values for
the current and previous time interval.
is the
maximum ADC value for this interval and U th ,U th , ∆
are predefined constants. As can be seen in Equation 3,
the filter checks the increasing speeds of the minimum,
maximum and threshold values. Note that the experiment
shows that the HPF signal amplitude varies over a range
of 10 to 1, depending on sensor position and individual
physiology. A peak detector with a fixed threshold is not
satisfactory for this application.
Finally, the pulse signal-processing routine calculates the
interval between the neighboring pulses using the sample
clock as a time reference. Figure 6 demonstrates the
algorithm operation using raw ADC data and Matlab
simulation for signal processing.
1 max   Equation 3
max  U thmin , min  U thmax ,U thi + ∆, U thi + U ADC
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
Figure 6. ADC Data Signal Processing in PulsOmeter
(a) is unfiltered ADC data, (b) is the HPF output signal and
detected pulse beats, and (c) is the peak detector
threshold variation.
When the intervals between adjacent pulses are
measured, the pulse rate in the standard form of
beats-per-minute is calculated.
Small sensor displacement can generate false beat
detection due to a very small modulation amplitude
coefficient. Changing sensor position generates a noise
signal with amplitude equal to or greater than a useful
pulse signal. This is especially important when the
PulsOmeter is embedded in the sport trainer, where pulse
is measured in online mode during training. So, the
additional filtering can be applied in the pulse intervals or
amplitude domains to eliminate these false beats.
The proposed PulsOmeter uses two pulse calculation
methods: faster, but less accurate pulse measuring, or a
slower, but more accurate approach.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
The user makes the selection by pressing the “Mode”
button. The fast algorithm determines the pulse rate based
on median filtering of intervals between several adjacent
beats. Figure 7 illustrates the algorithm.
Figure 7. Fast Pulse Estimation Method
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
The routine collects into the internal buffer an odd number
of pulse intervals (5, 7, or 9 for example), runs the median
filter to exclude false pulse beats, and makes the peak
dispersion check. If the median is greater than the
multiplied difference between the adjacent-to-medianvalue pulse intervals, then the measurement is considered
valid and a unit-conversion to beats-per-minute is made,
otherwise an error is returned. The routine checks the
interval between subsequent pulses. If no signal occurs
during the predefined timeout, the internal buffer index is
initialized (to correctly start the next cycle) and an error is
returned. This feature automatically starts a new
measurement cycle when the sensor is properly placed on
the human body. To check timeouts, the sleep timer ISR is
used. The ISR rate is 64 Hz. This routine flashes the
beat’s LED for a short time once a pulse beat is detected.
Note that the fast pulse measuring method can be used to
detect various arrhythmias, making human state
diagnostics by applying a method that analyzes the
short- and long-time pulse fluctuations.
The slow pulse estimation approach, based on counting
the pulse beats within a fixed time interval, 30 or 60 s, is a
well-known “classic” approach. But the measured pulse
intervals are checked to ensure they are close to the
previous measured samples. This eliminates noise from
beats. The routine uses a dedicated state machine, which
fills several samples into an intermediate buffer before
pulse counting begins, checks pulse interval validity, and
counts the beat number within a fixed time interval. A
measured pulse interval is considered valid if it falls in
between the following interval: Tp ∈ [0.75Tm ...1.25Tm ] , where
Tp is the measured pulse interval and Tm is the
median-filtered pulse interval, based on previously
collected values. The state machine bubble diagram is
represented in Figure 8 (a) and the pulse rate calculation
algorithm is given in Figure 8 (b). After reset, the routine
starts filling the initial buffer for the median filter (1,2), goes
to pulse calculation (3,4), displays the calculated pulse
rate, and jumps to reset (5) after cycle completion. If there
is no pulse signal within the predefined timeout, the state
machine goes to the reset state from any present state
Figure 8. Slow Pulse Estimation Method
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
The service routines perform the estimation of minimum
and maximum pulse values during continuous
measurements, user interface functions, and graphic LCD
library support. Users can switch the pulse calculation
mode by pressing the “Mode” button, reset the
Last/Min/Max measured pulse rate value, and start a new
measurement cycle instantly by pressing the “Reset”
button. To get reliable PulsOmeter operation, the sensor
position should be set appropriately, where the pulse light
modulation is enough. To simplify this task, the graphic
LCD displays the special vertical bar-graph and users can
adjust the sensor position to see the maximum bar-graph
size. The bar-graph size is evaluated based on
value, which is periodically updated.
About the Author
Figure 9. Board Photograph
Suggested Improvements
The free LCD space allows users to place additional
information. Users can place an hourglass to display the
remaining time of a pulse measurement cycle. The
AN2152 graphic library supports bitmap operations without
any problems. As an alternative, the second vertical graph
can be added for this purpose.
You can insert a finger between the LED and photodiode
or bend the diodes up and place a hand on it.
Figure 10. LCD Image
Victor Kremin
Associate Professor
Victor earned a radiophysics diploma
in 1996 from Ivan Franko National
Lviv University, a PhD degree in
Computer Aided Design Systems in
2000, and is presently working as
Associate Professor at National
University "Lvivska Polytechnika"
(Lviv, Ukraine). His interests involve
the full cycle of embedded systems
design including various processors,
operating systems and target
applications. You may reach him
anytime at: [email protected]
[email protected]
Examples during pulse measurement and when sensor is
located outside human body.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
Document History
Document Title: Sensing - Optical PulsOmeter With PSoC® - AN2158
Document Number: 001-34542
Orig. of
Description of Change
Recataloged Spec.
Updated document and project to PSoC Designer 5.0. Updated title.
Updated to latest PSoC Designer.
Updated as per new template.
Sunset Review. Updated template.
Obsolete document.
Completing Sunset Review.
Document No. 001-34542 Rev. *D
Sensing - Optical PulsOmeter With PSoC®
Worldwide Sales and Design Support
Cypress maintains a worldwide network of offices, solution centers, manufacturer’s representatives, and distributors. To find
the office closest to you, visit us at Cypress Locations.
PSoC® Solutions
Clocks & Buffers
PSoC 1 | PSoC 3 | PSoC 4 | PSoC 5LP
Lighting & Power Control
Touch Sensing
USB Controllers
Cypress Developer Community
Community | Forums | Blogs | Video | Training
Technical Support
PSoC is a registered trademark and PSoC Creator is a trademark of Cypress Semiconductor Corp. All other trademarks or registered trademarks
referenced herein are the property of their respective owners.
Cypress Semiconductor
198 Champion Court
San Jose, CA 95134-1709
: 408-943-2600
: 408-943-4730
© Cypress Semiconductor Corporation, 2007-2015. The information contained herein is subject to change without notice. Cypress Semiconductor
Corporation assumes no responsibility for the use of any circuitry other than circuitry embodied in a Cypress product. Nor does it convey or imply any
license under patent or other rights. Cypress products are not warranted nor intended to be used for medical, life support, life saving, critical control or
safety applications, unless pursuant to an express written agreement with Cypress. Furthermore, Cypress does not authorize its products for use as
critical components in life-support systems where a malfunction or failure may reasonably be expected to result in significant injury to the user. The
inclusion of Cypress products in life-support systems application implies that the manufacturer assumes all risk of such use and in doing so indemnifies
Cypress against all charges.
This Source Code (software and/or firmware) is owned by Cypress Semiconductor Corporation (Cypress) and is protected by and subject to worldwide
patent protection (United States and foreign), United States copyright laws and international treaty provisions. Cypress hereby grants to licensee a
personal, non-exclusive, non-transferable license to copy, use, modify, create derivative works of, and compile the Cypress Source Code and derivative
works for the sole purpose of creating custom software and or firmware in support of licensee product to be used only in conjunction with a Cypress
integrated circuit as specified in the applicable agreement. Any reproduction, modification, translation, compilation, or representation of this Source
Code except as specified above is prohibited without the express written permission of Cypress.
right to make changes without further notice to the materials described herein. Cypress does not assume any liability arising out of the application or
use of any product or circuit described herein. Cypress does not authorize its products for use as critical components in life-support systems where a
malfunction or failure may reasonably be expected to result in significant injury to the user. The inclusion of Cypress’ product in a life-support systems
application implies that the manufacturer assumes all risk of such use and in doing so indemnifies Cypress against all charges.
Use may be limited by and subject to the applicable Cypress software license agreement.
Document No. 001-34542 Rev. *D