a wireless biosignal measurement system using …...2 ii. background a. zynq system-on-chip the...

10
1 AbstractThis work presents the design and implementation of a wireless biosignal measurement system that includes a Zynq SoC and uses the Bluetooth Low Energy (BLE) technology. The architecture proposed explores the hardware/software co-design capabilities of the Zynq, which integrates an ARM processor and FPGA fabric in the same chip, and the low-power wireless solution that BLE can provide to portable devices. A prototype was built in which the heart rate and body temperature are monitored using an ECG module and a steel-head thermistor, respectively. Part of the algorithm that outputs the heart rate from the ECG signal runs on an IP core in the Zynq's FPGA fabric, which was synthesized from C code. A mobile app was also developed to serve as the user interface and display the measurements in real-time. The prototype was implemented with success. The use of the IP core accelerated the run-time of the ECG signal processing, which demonstrates the potential of using dedicated hardware solutions in the Zynq to improve the performance of embedded systems. Index Termsbiosignals, Bluetooth Low Energy, ECG, RTOS, SoC FPGA, Zynq I. INTRODUCTION Physiological parameters are important indicators of a person’s health. Medical practitioners have long been using electronic devices to aid them in medical diagnosis, by monitoring the patients’ biosignals and other body data. Currently, factors like the global population ageing, prevalence of chronic diseases and the resulting increase in healthcare needs are making remote patient monitoring a necessity to bring quality medical care to everyone. Because of this, there is a growing demand for portable and reliable medical devices for home use. Low power consumption is an important design consideration for portable and wearable devices. It has been concluded that computations implemented in dedicated hardware typically consume less power than equivalent software running on an embedded processor [1]. Field Programmable Gate Arrays (FPGAs) provide a reconfigurable hardware platform that can be used to create efficient hardware solutions, and have been used in complex medical devices for some years now [2]. For smaller portable devices, low-power FPGA architectures [3] are an interesting option to be explored. There is now a new kind of System-on-Chip (SoC), commonly referred to as SoC FPGA, that brings together a hard processor and FPGA fabric in the same package, connected by high-speed interfaces. The hardware/software co-design capabilities of SoC FPGAs are immense and are currently being applied in various industries, the medical being one of them [4]. The Zynq-7000 All-Programmable SoC [5], introduced by Xilinx in 2011, is one such device that integrates an ARM processor and FPGA fabric. The partitioning of signal processing between hardware and software in these devices can accelerate the execution time of algorithms and potentially consume less power. It can be particularly advantageous if used in applications that require the processing of multiple streams of biosignals that can be done in parallel. In addition, development tools that synthesize RTL descriptions from high level programming languages such as C are evolving to generate more efficient hardware solutions. Generally, the radio communication is what consumes most of the power in small wireless devices [6]. Taking this into consideration, new low-power wireless technologies have emerged in recent years [7], aimed at this kind of sensing devices. Bluetooth Low Energy (BLE) was introduced in 2010 as a non-proprietary standard for Wireless Personal Area Network applications. It is a variation of the Bluetooth technology aimed at applications that require low-power consumption and in which a low data rate connection suffices. It is now integrated in the majority of smartphones and tablets in the market, unlike other low-power standards [7]. The main objective of this work is to develop a prototype for a wireless biosignal measurement system that explores the use of the Zynq SoC and uses the BLE technology for wireless data transfer. A general architecture for a system that meets these requirements is proposed, with the aim of using the reconfigurable hardware of the Zynq to improve the performance of real-time biosignal processing and use BLE in an efficient way. The prototype developed demonstrates the concept with ECG signal processing and a temperature sensor, and uses a personal device connected by BLE to display heart rate and temperature measurements in real-time. A Wireless Biosignal Measurement System using the Zynq SoC and Bluetooth Low Energy Ricardo Joaquinito Instituto Superior Técnico Lisbon, Portugal [email protected]

Upload: others

Post on 04-Jul-2020

2 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

1

Abstract— This work presents the design and implementation

of a wireless biosignal measurement system that includes a Zynq

SoC and uses the Bluetooth Low Energy (BLE) technology. The

architecture proposed explores the hardware/software

co-design capabilities of the Zynq, which integrates an ARM

processor and FPGA fabric in the same chip, and the low-power

wireless solution that BLE can provide to portable devices. A

prototype was built in which the heart rate and body temperature

are monitored using an ECG module and a steel-head thermistor,

respectively. Part of the algorithm that outputs the heart rate from

the ECG signal runs on an IP core in the Zynq's FPGA fabric,

which was synthesized from C code. A mobile app was also

developed to serve as the user interface and display the

measurements in real-time. The prototype was implemented with

success. The use of the IP core accelerated the run-time of the ECG

signal processing, which demonstrates the potential of using

dedicated hardware solutions in the Zynq to improve the

performance of embedded systems.

Index Terms—biosignals, Bluetooth Low Energy, ECG, RTOS,

SoC FPGA, Zynq

I. INTRODUCTION

Physiological parameters are important indicators of a

person’s health. Medical practitioners have long been using

electronic devices to aid them in medical diagnosis, by

monitoring the patients’ biosignals and other body data.

Currently, factors like the global population ageing, prevalence

of chronic diseases and the resulting increase in healthcare

needs are making remote patient monitoring a necessity to bring

quality medical care to everyone. Because of this, there is a

growing demand for portable and reliable medical devices for

home use.

Low power consumption is an important design

consideration for portable and wearable devices. It has been

concluded that computations implemented in dedicated

hardware typically consume less power than equivalent

software running on an embedded processor [1]. Field

Programmable Gate Arrays (FPGAs) provide a reconfigurable

hardware platform that can be used to create efficient hardware

solutions, and have been used in complex medical devices for

some years now [2]. For smaller portable devices, low-power

FPGA architectures [3] are an interesting option to be explored.

There is now a new kind of System-on-Chip (SoC),

commonly referred to as SoC FPGA, that brings together a hard

processor and FPGA fabric in the same package, connected by

high-speed interfaces. The hardware/software co-design

capabilities of SoC FPGAs are immense and are currently being

applied in various industries, the medical being one of them [4].

The Zynq-7000 All-Programmable SoC [5], introduced by

Xilinx in 2011, is one such device that integrates an ARM

processor and FPGA fabric.

The partitioning of signal processing between hardware and

software in these devices can accelerate the execution time of

algorithms and potentially consume less power. It can be

particularly advantageous if used in applications that require the

processing of multiple streams of biosignals that can be done in

parallel. In addition, development tools that synthesize RTL

descriptions from high level programming languages such as C

are evolving to generate more efficient hardware solutions.

Generally, the radio communication is what consumes most

of the power in small wireless devices [6]. Taking this into

consideration, new low-power wireless technologies have

emerged in recent years [7], aimed at this kind of sensing

devices. Bluetooth Low Energy (BLE) was introduced in 2010

as a non-proprietary standard for Wireless Personal Area

Network applications. It is a variation of the Bluetooth

technology aimed at applications that require low-power

consumption and in which a low data rate connection suffices.

It is now integrated in the majority of smartphones and tablets

in the market, unlike other low-power standards [7].

The main objective of this work is to develop a prototype for

a wireless biosignal measurement system that explores the use

of the Zynq SoC and uses the BLE technology for wireless data

transfer. A general architecture for a system that meets these

requirements is proposed, with the aim of using the

reconfigurable hardware of the Zynq to improve the

performance of real-time biosignal processing and use BLE in

an efficient way. The prototype developed demonstrates the

concept with ECG signal processing and a temperature sensor,

and uses a personal device connected by BLE to display heart

rate and temperature measurements in real-time.

A Wireless Biosignal Measurement System

using the Zynq SoC and Bluetooth Low Energy

Ricardo Joaquinito

Instituto Superior Técnico

Lisbon, Portugal

[email protected]

Page 2: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

2

II. BACKGROUND

A. Zynq System-on-Chip

The Zynq-7000 All Programmable SoC [5] or simply Zynq,

is a SoC, released by Xilinx in 2011, that integrates a dual-core

ARM Cortex-A9 processor and FPGA fabric. It is a platform

for hardware/software co-designing of embedded systems that

allows the partitioning of system functions between the

software running on the processor and custom hardware on the

FPGA's reconfigurable logic.

The general architecture of a Zynq device comprises two

parts: the Processing System (PS) and the Programmable Logic

(PL). Simply put, the PS refers to the processor and software

development and the PL refers to the FPGA fabric and hardware

development. The two parts can be interfaced with each other

and with peripherals. AXI standard connections are used to link

the PS and the PL. Interfacing options between the PS and

external devices include GPIO, UART, SPI and various other

protocols. The XADC block, included in the PL, can be used to

convert analog input signals to digital format.

Zynq projects are developed entirely on Xilinx's Vivado

Design Suite [8]. It includes the Vivado Integrated

Development Environment (IDE) and the Software

Development Kit (SDK), which handle the hardware and the

software design respectively, and also the Vivado High Level

Synthesis (HLS). The HLS is able to generate hardware

descriptions of functions implemented in C, C++ or SystemC

programming language, which can be exported as Intellectual

Property (IP) cores and implemented on the Zynq’s hardware

system.

Compared to an FPGA-processor combination (with the two

components in physically separate components), the Zynq is

considered a better solution for several reasons: being a single

device, it has the potential of reducing the bill of materials cost,

accelerate development time, reduce the physical size of the

system and reduce the power consumption [4].

B. Bluetooth Low Energy

Bluetooth Low Energy (BLE), also known as Bluetooth

Smart or Bluetooth 4.0, is the third and most recent Bluetooth

protocol standard, introduced in the Bluetooth Core

Specification v4.0 [9] in June 2010. It was created with the

intent of establishing low-data rate connections between close

mobile devices in a power-efficient way.

The BLE radio operates in the unlicensed 2.4 GHz Industrial,

Scientific and Medical (ISM) band, at frequencies

2400-2483.5 MHz, and uses 40 physical channels with a

bandwidth of 2 MHz each. Data packets have a maximum size

of 47 bytes and advertising packets are not bigger than 37 bytes.

BLE is suitable for Wireless Personal Area Networks. It is

claimed that a BLE device can be configured to reliably

transmit data 30 meters away in line-of-sight [10], but the

typical operating range is closer to 10 meters [7]. The

theoretical upper limit for the data throughput that BLE can

provide is 1 Mb/s.

In a connection between two Bluetooth devices, they can

have either of two roles: central or peripheral. The central

device is usually a PC, tablet or smartphone, and is responsible

for scanning for other Bluetooth devices that are available for

connection, initiate the connection and manage it. The

peripheral device is the one that is initially advertising itself to

any scanning devices, accepts incoming connection requests

and sends data to the central device. A central device may

connect to any number of peripheral device. Usually, a

peripheral device is connected to only one central device, but

connections with more than one central at once are also possible

[10].

To develop BLE applications, it is necessary to understand

how to use the Generic Access Profile (GAP) and the Generic

Attribute Profile (GATT) from BLE’s protocol stack [10]. The

GAP is BLE’s topmost control layer: it is used to define the

device’s role in the connection, the operational modes and

procedures, security aspects and additional data formats. The

GATT deals with the actual data transfer procedures and

formats: it establishes a strict hierarchy to organize the

attributes in a reusable and practical manner. The data sent in a

BLE connection is encapsulated in services, which can have

zero or more characteristics, which in turn can have zero or

more descriptors. Several standard GATT services exist and can

be consulted in [11].

A comprehensive survey on low-power wireless

technologies, which compares BLE to the other available

technologies, can be found in [7]. A major advantage of using

BLE is the fact that most smartphones, tablets and PCs in the

market now support this technology, unlike the other open-

standard or proprietary technologies.

C. Related Work

The use of Zynq devices to implement processing systems

that involve biosignals has been documented on several

academic papers. Some of the work features wireless

connectivity [12][13][14] and hardware acceleration using the

Zynq's PL resources [13][15][16].

A mobile biosignal measurement system for rehabilitation

purposes is presented in [12], with a Zynq SoC (on a ZYBO

board) and Bluetooth connections. The authors claim that the

system is capable of measuring ECG, EMG and EEG signals

through multiple channels, but the main scope is to measure the

arm's EMG signals and optimize the signal condition and data

compression. The Zynq device (Z-7010) is the core of a central

module, with the sensors working on peripherals that send raw

and preprocessed data to the central module using Bluetooth.

However, the paper does not present the prototype

implementation nor any results.

An ECG security identification system has been

implemented on a Zynq [16], where the computationally

intensive blocks of the biometric identification system are

accelerated by hardware on the PL, and the remaining non-

complex tasks are implemented on software. The algorithm

used was implemented in C and synthesized to hardware using

the Vivado HLS.

A fall detection system using a Zynq and Bluetooth

communication is proposed in [13]. Although it just uses

accelerometers for sensing, it is stated that its characteristics

offer the possibility to also acquire physiological data. An IP

core generated on the Vivado HLS was used to accelerate the

processing. The power estimation of the Zynq hardware

implementation was 29% inferior compared to an

implementation with a Microblaze processor on a Virtex-5

FPGA.1

Page 3: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

3

A multiprocessor architecture for cardiac monitoring is

proposed in [14], using three CPU cores in a Zynq device. The

Pan-Tompkins algorithm is used for heart beat detection. The

authors describe the hardware and software architecture but do

not present any results.

Other interesting works that use a Zynq include a chest-worn

multi-sensor device with Bluetooth and Wi-Fi [17], and the

hardware optimization of non-invasive fetal ECG estimation

[15].

To the best of the author's knowledge, there is no documented

project that uses both a Zynq device and Bluetooth Low Energy

technology. Nevertheless, some interesting examples illustrate

the use of BLE in biosignal-measuring wearable device

prototypes: a single-lead ECG armband with BLE connectivity

and a mobile app that presents the signal and the heart rate in

real-time [18]; and a wearable device that measures the galvanic

skin response and EMG and alerts a car driver of his fatigue

through a smartwatch app [19].

BLE has become a mainstream technology with a growing

adoption on wearable devices in the market. Many fitness

bands, for example, now use BLE communication. In the

medical device market, wearable ECG monitoring devices with

BLE connectivity have been announced: the HealthPatch MD

[20], for example, is expected to be available in the near future.

III. PROPOSED SYSTEM

The general architecture proposed for this biosignal

measurement system is presented in Fig. 1. This system allows

to:

Connect multiple analog and digital sensors to the

Zynq.

Accelerate the real-time processing of biosignals such

as ECG, EMG or EEG, using IP cores implemented in

the FPGA fabric.

Send only relevant short data via BLE, keeping the

power consumption of the wireless module low.

Use a personal electronic device (PC, smartphone or

tablet) for the user interface.

The system is composed of 2 devices: the SenZyB and a

personal electronic device. The SenZyB (standing for Sensor-

Zynq-Bluetooth) is an embedded system composed of the Zynq

SoC, the sensors and the BLE module.

The Zynq supports sensors with a digital interface or an

analog output. Digital sensors can use a low-level serial

communication protocol to communicate with the PS, such as

SPI, and can be routed directly to the PS or through the PL. For

a sensor with an analog output, the Zynq's XADC block must

be used to convert the analog signal to a digital format. This

block contains two ADCs with a 12-bit resolution, a full scale

input of 1 V and a sampling rate of up to 1 MSPS. When used

in unipolar mode, it can measure external voltages between 0

and 1 V. It can access up to 17 external analog input channels.

All the input channels of the XADC are differential, meaning

that they require a pair of input signals.

The SenZyB is conceived as an embedded system with a

processor that must interact periodically with various peripheral

components, on the PL and outside the Zynq, and has to

perform real-time processing of biosignals. Given these

requirements, and since the user interface of the system is not

on the SenZyB, the choice of OS for the Zynq's PS is a Real-

Time Operating System (RTOS).

The Vivado SDK has the option to generate a Board Support

Package that includes the FreeRTOS [21], a popular lightweight

and open-source RTOS for microprocessors. It is a good

solution for this system as it provides a good degree of

determinism, modularity, maintainability and extensibility,

without being heavy on the memory resources (the core of the

FreeRTOS kernel is made up of only 3 C files, and its kernel

image size is between 4 and 9 KB [4]).

IP cores can be used to accelerate biosignal processing

algorithms. The system in Fig. 1 shows the concept of

implementing multiple IP cores in the Zynq’s PL that are used

in conjunction with the processor to execute certain routines.

Routines that deal with large amounts of data and have

processing steps that can be done in parallel are good candidates

for hardware implementation. This design option can result in

shorter algorithm run-time and less power consumption.

The BLE module must contain the radio transceiver and

implement the controller and host blocks of the BLE protocol

stack. It is common to use a small SoC that includes a low-

power microprocessor to also run the BLE application and so

implement the full protocol stack, a solution that is more

beneficial in terms of cost and power consumption [10].

As for the personal device, it can be a smartphone, a tablet or

a PC that has BLE compatibility ("Bluetooth Smart Ready").

The device has an application with a graphical user interface

(GUI) that displays the parameters that the SenZyB measures

in real-time. It is also used to start and terminate the BLE

connection.

The SenZyB and the personal device form a simple piconet

in which the user's personal device is the central device and the

SenZyB is the peripheral device. The piconet can potentially be

extended to include more SenZyB devices if the GUI

application on the personal device allows it.

Figure 1. General architecture of the SenZyB system.

Page 4: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

4

The GAP mode of the BLE module in the SenZyB must be

configured to be "General Discoverable". This makes the

device advertise for as long as it is powered and not connected.

When scanning, the GAP discover procedure set by the central

device must be the "General Discovery", which is the only

applicable procedure to the "General Discoverable" peripheral.

As for the GATT services to be used, it depends on the

parameters that are measured by the system.

IV. PROTOTYPE

A. Overview

The architecture of the prototype developed to demonstrate

the SenZyB concept is shown in Fig. 2. From a user perspective,

the main objective of this system is to measure the body

temperature and heart rate of the person and display those

measurements in real-time. The personal electronic device that

receives the measurements is a smartphone, which has a mobile

app that is used to control the BLE connection and display the

referred physiological parameters.

The body temperature is sensed using a steel-head Negative

Temperature Coefficient (NTC) thermistor. It requires an active

conditioning circuit so that the temperature changes are directly

reflected as voltage changes. In this system, it consists of a

simple voltage divider.

The heart rate is measured from the ECG signal of the person,

which is captured by electrodes placed on the person's skin. A

single lead is used. The system includes an IP core designated

Heart Rate Calculator, with the purpose of having the QRS

detection algorithm accelerated.

The BLE board includes a SoC with a less powerful

microprocessor and the radio frequency transceiver, with the

BLE protocol stack fully implemented. It is connected to the

Zynq with the UART interface. When a string with new heart

rate and temperature values is received by the BLE SoC, it will

update the measurement values on the appropriate BLE services

used in the connection.

The mobile app must run on a smartphone that has BLE

compatibility. It allows the user to scan and connect to the BLE

module of this SenZyB prototype. Once connected, the values

of the heart rate and body temperature are sent to the

smartphone and updated on the screen once per second.

B. Development boards and sensors

The development boards and sensors used in this prototype

were the following:

ZYBO [22]: A low-cost Zynq Development Board that

includes a Z-7010 device. In this device, the ARM

Cortex-A9 processor has a maximum clock frequency

of 650 MHz. The board includes 6 Pmod connectors,

each featuring 12 females GPIO female connectors

that can be used for the system’s external I/O.

BLE Nano [23]: A very small-scale BLE development

board featuring the Nordic nRF51822 SoC [24].

BITalino ECG module [25]: A module from the

BITalino hardware platform used for ECG signal

acquisition. It uses 2 or 3 electrodes to capture a single

ECG lead and includes the analog front-end circuit

required for the signal pre-processing. The input range

is -1.5 to 1.5 mV, and the output range is 0 to 3.3 V.

IM120628010: A non-expensive steel-head thermistor

with a 30 cm cable. Its nominal resistance at 25ºC is

10 kΩ.

C. Zynq system

The hardware system in the Zynq has 3 main blocks: the PS,

the XADC and the Heart Rate Calculator core. A single core of

the ARM Cortex-A9 is used in the PS, with the FreeRTOS

running as the OS. The XADC uses two differential input

channels that sample exterior voltages, belonging to the

thermistor circuit and the ECG module output. The connections

between the PS and the other blocks on the PL are done using

AXI interfaces.

In order to make a fair evaluation of the effect of the Heart

Rate Calculator core on the software application's run-time, the

PS and PL are set to same clock frequency.

D. BLE connection

The BLE connection uses two standard GATT services: the

Heart Rate Service and the Health Thermometer Service. It

makes sense to use these two services since they are explicitly

intended for health and fitness applications and are appropriate

for the physiological parameters that this device measures. The

heart rate value, given in beats per minute (bpm), is sent in the

Heart Rate Measurement characteristic of the Heart Rate

Service. The temperature measurement, in Celsius (ºC), is sent

in the Temperature Measurement characteristic of the Health

Thermometer Service.

Figure 2. Architecture of the prototype system.

Page 5: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

5

V. ECG SIGNAL PROCESSING

The ECG signal is a quasi-periodic repetition of the P wave,

the QRS complex and the T wave, as shown in Fig. 3. A raw

ECG signal is very short in amplitude (typically very few

millivolts) and carries undesired noise from more than one

source. Four types of noise are generally associated with the

ECG: baseline wander (frequency typically below 1 Hz),

power-line interference (50 or 60 Hz frequency), EMG artifacts

and electrode motion artifacts.

Due to its characteristic shape, the QRS complex serves as

the basis for the automated determination of the heart rate,

which is usually measured using the intervals between the R

peaks. The correct real-time detection of the QRS complexes is,

therefore, of great importance to get heart rate measurements.

To accomplish this, several QRS detection software algorithms

have been proposed and studied in the past decades [26].

The QRS detection algorithm used in this prototype system

is a relatively simple derivative-based algorithm that loosely

takes some elements of the Pan-Tompkins method [27]. The

flowchart on Fig. 4 illustrates all the processing stages, from

signal acquisition to the heart rate output, and where they are

performed in the system. There are 3 distinct parts: (i) the

preprocessing stage, performed on the BITalino ECG module,

(ii) the first processing stage, performed by the Zynq's PS, and

(iii) the second processing stage, performed on the Heart Rate

Calculator core.

Firstly, the ECG signal goes through the pre-processing stage

while still an analog electrical signal, where it is amplified and

filtered. The BITalino ECG module contains the analog front-

end circuit that takes care of these processing steps. It performs

signal amplification with a gain G = 1100 and band-pass

filtering on the band 0.5-40 Hz. This filter eliminates the

baseline wander and power-line interference.

The first processing stage on the Zynq follows the pre-

processing stage. The next step is the signal conversion to

digital format. The continuous analog signal is sampled at a

sampling rate fs by the ADC of the XADC block, turning into a

discrete signal. In accordance with the sampling theorem, given

the upper cutoff frequency of 40 Hz on the pre-processing stage,

the minimum value that fs can have is 80 Hz.

From here on, the goal is to detect the QRS complexes of the

ECG signal. The method used for the QRS detection uses the

derivative of the signal and compares it to a threshold value to

determine when the QRS complexes happen. By differentiating

the ECG signal, we get a representation of the amplitude

changes with respect to time. In this system, the numerical

differentiation technique given by

𝑦[𝑛] = 𝑥[𝑛] − 𝑥[𝑛 − 1] (1)

is used to get the derivative of the ECG signal. After, each new

point is squared:

𝑧[𝑛] = 𝑦[𝑛]2 (2)

This turns all the data points positive and greatly emphasizes

the peak values of the derivative.

The operations described on the first processing stage are

performed for each individual sample, every time a new sample

is acquired (with the exception of the very first sample, for

which the differentiation cannot be performed). The derivative

data is stored in a buffer array that can store 6 seconds of data.

The data on this array is used on the second processing stage.

The remaining steps, which make the second processing

stage, are performed just once per second, which is a reasonable

period to update the heart rate value that the user will see on the

mobile app. This part of the processing works on the entire Figure 3. Typical Waveform of the ECG signal.

Figure 4. ECG processing steps on the prototype system.

Page 6: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

6

derivative array to define a threshold value, to which each

element will be compared to determine if there was a QRS

complex at that moment.

The threshold value is given by

𝑡ℎ𝑟𝑒 =∑ 𝑧[𝑛]𝑁

𝑛=0

𝑁× 𝐹 (3)

where N is the size of the array and F is a factor that sets how

high the threshold will sit compared to the average of the

derivative signal. The value of F is set empirically.

All the elements of the array, from the earliest to the latest,

are compared to the threshold. A QRS complex is detected

whenever an element of the array has a value higher than the

threshold. When this happens, the position of that element is

stored and the algorithm will ignore the next 300 ms worth of

data from the derivative signal. This is done because during the

QRS complex there is a very high probability that there will be

more derivative points above the threshold. The T wave may

also trigger values above the threshold. This method avoids

detecting false positives, ensuring that for each heartbeat there

is only one time stamp stored.

Considering p[k] the sequence of array indexes where a QRS

complex was detected and NP the size of that sequence, then the

average interval between the QRS complex is given by

𝑡𝑎𝑣𝑔 =∑ (𝑝[𝑘]−𝑝[𝑘−1])

𝑁𝑃𝑘=1

𝑁𝑃−1×

6000

𝑁 [ms] 4)

It is defined that NP ≤ 5, so the maximum number of intervals

that are averaged is 4. Finally, this value is converted to beats

per minute (bpm), producing the heart rate measurement:

𝐻𝑅 =60000

𝑡𝑎𝑣𝑔 [bpm] 5)

VI. IMPLEMENTATION

A. Hardware

The external components were connected to the ZYBO

through the Pmod connectors. For each of the sensors, a discrete

component circuit must assure that the signal that enters the

Zynq is within the range 0-1 V, which is the full scale input of

the Zynq's XADC. The differential inputs of the thermistor

circuit are the pins JA1 and JA7. For the ECG module, it is the

pins JA2 and JA8. For the BLE Nano, only one connection is

made to pin JE2, that will act a one-way UART connection

(data flows from the Zynq to the BLE Nano).

The block diagram of the hardware system developed for the

Zynq is presented in Fig. 5. This design was created on the IP

Integrator tool of the Vivado IDE.

The PS is configured to have a clock frequency of 100 MHz,

the same as the PL. The UART0 interface is activated, with a

baud rate of 115200. Its Tx port is connected to the output port

uart_out, which connects to the pin where the the BLE Nano is

connected.

The XADC block has two pair of inputs, which are the

differential inputs coming from the sensors. The input ports

vauxp7_in and vauxn7_in are connected to pins JA2 and JA8

(ECG). Ports vauxp14_in and vauxn14_in are connected to pins

JA1 and JA7 (temperature). The block is configured to operate

in continuous sampling mode and have an AXI4-Lite interface

with the PS.

The Heart Rate Calculator core was created on the Vivado

HLS design tool. It uses an AXI4-Stream interface for the input

of the buffer array, supported by a DMA block that provides

high-speed data movement from the system memory. The

output, which will send an integer representing the heart rate,

uses the simpler AXI4-Lite interface. The threshold factor F,

from equation (4), is set to F=8 in this implementation.

B. Software

The software application running on the PS was developed

in C, on the Vivado SDK. The application has 2 RTOS tasks:

the ECGRead task and the ProcessAndSend task (Fig. 6).

The purpose of the ECGRead task is to acquire the ECG

samples from the XADC at a constant frequency and execute

the first stage of the ECG signal processing. The priority level

of this task is set to 2, the highest of the two tasks, to assure that

it is called, without failure, with precise intervals. The cycle

period is set to 10 ms, making the sampling rate of the ECG

signal 100 Hz.

Figure 5. Block design of the Zynq hardware system.

Page 7: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

7

The ProcessAndSend task is called once every second. It

starts by completing the ECG processing necessary to calculate

the heart rate by interacting with the Heart Rate Calculator core.

After getting a new heart rate value, it accesses the value from

the temperature sensor channel of the XADC and translates it

to Celsius using a lookup table. Finally, it sends a string

message through the UART interface containing the newest

heart rate and temperature measurements.

As for the software running on the nRF51 SoC of the BLE

Nano, it was developed in C++ on the ARM mbed development

platform [28]. It is an event-based application that uses the

BLE_API to configure the GAP options and GATT services.

Among others things, it defines the name of the device as

“ZYBO-BLE”, the advertising interval as 1 second, the use of

the Heart Rate Service and the Health Thermometer Service and

how to extract the new values from the UART messages and

have them transmitted wirelessly.

C. Mobile app

The mobile app that displays the measurements was

developed for the Android OS on the Android Studio IDE [29].

The app contains a simple user interface and can perform the

following tasks: activate the Bluetooth on the smartphone, scan

for peripheral devices, connect to the prototype SenZyB, show

the heart rate and body temperature measurements, and

terminate the connection. Fig. 7 shows how the user interface

looks like when the app is connected to the SenZyB device.

VII. TESTS AND RESULTS

A. Temperature Measurements

The temperature measurements of the prototype were

compared to the measurements from a commercial digital

thermometer, the "Thermoval kids flex" [30]. Ten

measurements were performed on a 24-year old male in normal

health condition. The sensors were placed on the armpit, and

the measurements were taken after resting in contact with the

skin for 2 minutes.

The best estimate and uncertainty obtained for the Thermoval

thermometer was 36.43 ± 0.17 ºC. For the prototype, it was

36.40 ± 0.24 ºC. The close results show that this SenZyB

prototype is appropriate for measuring the body temperature,

for its accuracy and precision are identical to the commercial

thermometer.

B. ECG signal and QRS detection

The ECG signal tests were performed with the 3 electrode

configuration, with the lead positioned on the lower chest area.

Fig. 8 shows a 6-second segment of the ECG signal captured by

the system and the resulting derivative signal. On the lower

graph, the threshold for QRS detection that is applied to this

segment is also shown. The blue circles on the derivative signal

mark the points where the algorithm detects a QRS complex.

The heart rate calculated by the system for this time frame was

74 bpm.

To test the quality of the QRS detection algorithm, the

parameters used are the sensitivity

𝑆𝑒 =𝑇𝑃

𝑇𝑃+𝐹𝑁 (6)

and the positive predictability

+𝑃 =𝑇𝑃

𝑇𝑃+𝐹𝑃 (7)

where TP denotes the number of true positive detections, FN

the number of false negatives, and FP the number of false

positives. These parameters were measured for the ECG

captured from 3 individuals, who had their signal recorded from

the lower chest area for 5 minutes, while seated. The sensitivity

was 100% for all the recordings, and the lowest positive

predictability obtained was 99.5%. The lack of false negatives

confirms the quality of the QRS detection. The presence of false

positives is attributed to muscle activity noise caused by abrupt

movements.

C. Zynq system resources and performance

The amount of resources of the Zynq's PL used with for the

hardware system are shown in Table 1. In total, 10.75% of the

total resources of the PL are used.

Figure 6. Tasks of the PS application.

Figure 7. User interface of the Android app developed.

Page 8: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

8

TABLE I. POST-IMPLEMENTATION RESOURCE UTILIZATION IN

THE FPGA FABRIC.

Resource Available Available Utilization (%)

LUT 17600 2752 16.63

LUT RAM 6000 178 2.97

FF 35200 3408 9.68

Block RAM 60 2 3.33

DSP 80 6 7.50

IO 100 5 5.00

BUFG 32 1 3.12

The run-time of the two RTOS tasks that run on the Zynq's

PS were measured with a time-tracking function in two

scenarios: (i) a software-only implementation of the ECG

processing, without using the Heart Rate Calculator; (ii) the

solution used in the prototype, with the ECG processing

partitioned between software and hardware, using the Heart

Rate Calculator. Fig. 9 shows the maximum run-time observed

for each of the RTOS tasks.

The ECGRead task has the same maximum run-time of

213 µs on the two scenarios, since the code is the same on both

and the hardware core is only used on the other task. The

difference is clearly seen on the MeasureAndSend task, where

the run-time of 209 µs of the software-only implementation has

been shortened to 142 µs with the use of the Heart Rate

Calculator core. This is a reduction of approximately 35% of

run-time compared with the software-only implementation.

This result is an evidence of the acceleration capabilities of

custom hardware implemented in the Zynq's PL when used to

assist the software application in some of its processing steps.

D. Wireless signal

Regarding the BLE wireless connection, the operating range

and signal strength of the BLE Nano module were tested. A

Sony Xperia V smartphone was used as the central device.

Connections were successfully established with the BLE Nano

up to an approximate distance of 10 m inside the floor of a

building (not in line-of-sight) and up to 20 m on an open space

(in line-of-sight).

The strength of the signal received on the same smartphone

was also tested on the open space, in line-of-sight. An app was

used to measure the Received Signal Strength Indication (RSSI)

of the advertising packages transmitted by the BLE Nano. The

transfer power of the nRF51's radio was set to 0 dBm. Figure

10 shows the RSSI measured up to a distance of 10 m.

Although these results don't add much to the analysis of the

wireless range, they can potentially be used for an estimation of

the distance between the SenZyB and the smartphone, up to a

distance of 2 m. After 2 m, the RSSI is not good for distance

estimation.

Figure 8. ECG and derivate signal obtained by the prototype.

Figure 9. Comparison of the tasks' run-time with and without the Heart

Rate Calculator core.

Page 9: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

9

VIII. CONCLUSION

The objectives defined for this work have been achieved. An

architecture for a wireless biosignal measurement system that

includes the Zynq SoC and BLE has been proposed, and a

prototype to prove the concept was successfully implemented.

The prototype was built with a set of development boards,

sensors and discrete components. The parameters chosen to be

monitored were the body temperature and the heart rate. The

heart rate is calculated from ECG signal. The user is able to see

real-time measurements of his body temperature and heart rate

on a mobile app that connects with the prototype device via

BLE.

The capabilities of the Zynq were explored by using custom

hardware, controlled by the software application on the Zynq's

processor, to accelerate the ECG processing. With the Heart

Rate Calculator core, an IP core synthesized from C code by the

Vivado HLS tool, running at the same clock frequency as the

processor, there was a 35% reduction of the run-time compared

to the same implementation running on the processor. This

result is an evidence of one of interesting aspects of using the

Zynq: the use of custom hardware along with the processor to

improve the system performance.

Regarding the BLE connection, even though a connection

was successfully established between the devices at a 20 m

distance, this system is more appropriate for a room

environment, with the sensing device and the personal device

not far apart. In order to effectively have a low power

consumption from the radio, the data transmitted should be

restricted to short amounts with a considerable interval between

transmissions. The heart rate and body temperature data are

short and do not need a very high update frequency, so they are

appropriate to be transmitted via BLE.

Further tests could be done to this system regarding the

power consumption of the Zynq system and the BLE module,

since this is a key motivation for the use of hardware/software

partitioning and the BLE technology. It would be interesting to

analyze the effect of the IP core on this matter and find the best

BLE settings that keep the power consumption minimal.

ACKNOWLEDGMENTS

The author would like to thank Prof. Helena Sarmento for her

supervision of this work and Hugo Plácido da Silva, who kindly

provided a BITalino board for the prototype.

REFERENCES

[1] P. Garcia et al., “An Overview of Reconfigurable Hardware in

Embedded Systems”, EURASIP Journal on Embedded Systems, vol. 2006, no. 56320, pp. 1-19, Sep. 2006.

[2] M. Santirini, “Xilinx Speeds Costumer Medical Innovations to Market”,

in XCell Journal, no. 93, pp. 9-13, 2015. [3] M. Savant, “Enhancing Personal Health Monitoring Systems With

FPGA Technology”, 2012 [Online]. Available:

http://www.medicaldesignbriefs.com/component/content/article/mdb/features/13318 [Accessed: Oct. 2016].

[4] L. H. Crockett et al., The Zynq Book: Embedded Processing with the

ARM-Cortex A9 on the Xilinx Zynq-7000 All Programmable SoC, 1st edition, Strathclyde Academic Media, 2014.

[5] Zynq-7000 All Programmable SoC – Technical Reference Manual,

v1.10, Xilinx Inc., 2015 [Online]. Available:

http://www.xilinx.com/support/documentation/user_guides/ug585-Zynq-

7000-TRM.pdf [Accessed: Oct. 2016].

[6] S. Mukhopadhyay, “Wearable Sensors for Human Activity Monitoring: A Review”, IEEE Sensors Journal, vol. 15, no. 3, pp. 1321-1330, March

2015.

[7] M. Ghamari et al., “A Survey on Wireless Body Area Networks for eHealthcare Systems in Residential Environments”, Sensors, vol. 16,

no. 6, 831, Jun. 2016.

[8] Xilinx Inc., “Vivado Design Tools” webpage [Online]. Available: https://www.xilinx.com/products/design-tools/vivado.html [Accessed:

Oct. 2016].

[9] Specification of the Bluetooth System – Covered Core Package version: 4.0, Bluetooth SIG, 2010.

[10] K. Townsend et al., Getting Started with Bluetooth Low Energy,

1st edition, O’Reilly Media, 2014. [11] Bluetooth SIG, “Adopted Bluetooth Profiles, Services, Protocols and

Transports” [Online]. Available:

https://www.bluetooth.com/specifications/adopted-specifications [Accessed: Oct. 2016]

[12] N. Sárkáni, A. Tihanyi, and P. Szolgay, “The design of a mobile multi-

channel bio-signal measuring system for rehabilitation purposes”, in Cellular Nanoscale Networks and their Applications (CNNA), 2014 14th

International Workshop on, 2014, pp. 1-2.

[13] H. Rabah, A. Amira, and A. Ahmad, “Design and implementation of a fall detection system using compressive sensing and shimmer

technology”, in 2012 24th International Conference on Microelectronics

(ICM), 2012, pp. 1-4. [14] R. George and M. E. Jose, “A Multiprocessor System on Chip for Real

Time Cardiac Monitoring”, International Journal on Engineering

Research and Technology, vol. 5, no. 1, pp. 653-656, Jan. 2016 [15] S. Wang and J. Sanlie, “Floating point hardware and software realization

for adaptive FIR fetal ECG estimation”, in IEEE International

Conference on Electro/Information Technology, 2014, pp. 294-297. [16] X. Zhai, A. Amira, and F. Bensaali, “ECG Security Identification

System on the Zynq SoC Platform”, in Computer and Information

Technology; Ubiquitous Compting and Communications; Dependable, Autonomic and Secure Computing; Pervasive Intelligence and

Computing (CIT/IUCC/DASC/PICOM), 2015 IEEE International Conference on, 2015, pp. 1164-1169.

[17] Y. Li et al., “A low power, parallel wearable multi-sensor system for

human activity evaluation”, in Biomedical Engineering Conference (NEBEC), 2015 41st Annual Northeast, 2015, pp. 1-2.

[18] V. P. Rachim and W. Y. Chung, “Wearable Noncontact Armband for

Mobile ECG Monitoring System”, IEEE Transactions on Biomedical Circuits and Systems, vol. PP, no. 99, pp. 1-7, 2016.

[19] L. Boon-Leng, L. Dae-Seok, and L. Boon-Giin, “Mobile-based

wearable-type of driver fatigue detection by GSR and EMG”, in TENCON 2015 – 2015 IEEE Region 10 Conference, 2015, pp. 1-4.

[20] N. Selvaraj, “Long-term Remote Monitoring of Vital Signs using a

Wireless Patch Sensor”, in 2014 Health Innovation and Point-of-Care Technologies Conference, 2014, pp. 83-86.

Figure 10. RSSI of advertising packets from the BLE Nano module.

Page 10: A Wireless Biosignal Measurement System using …...2 II. BACKGROUND A. Zynq System-on-Chip The Zynq-7000 All Programmable SoC [5] or simply Zynq, is a SoC, released by Xilinx in 2011,

10

[21] FreeRTOS webpage [Online]. Available: http://www.freertos.org/

[Accessed: Oct. 2016]. [22] ZYBO Reference Manual, rev. B, Digilent Inc., 2014 [Online].

Available: http://www.xilinx.com/support/documentation/university/XU

P%20Boards/XUPZYBO/documentation/ZYBO_RM_B_V6.pdf [Accessed: Oct. 2016].

[23] Red Bear Lab, “BLE Nano and MK20 USB Board” [Online]. Available:

http://redbearlab.com/blenano/ [Accessed: Oct. 2016]. [24] Nordic Semiconductor, “nRF51822” [Online]. Available:

https://www.nordicsemi.com/eng/Products/Bluetooth-low-

energy/nRF51822 [Accessed: Oct. 2016]. [25] H. Silva et al., “BITalino: A Novel Hardware Framework for

Physiological Computing”, in Physiological Computing Systems

(PhyCS), 2014 International Conference on, 2014, pp. 246-253.

[26] B.U. Kohler, C. Hennig, and R.Orglmeister, “The principles of software

QRS detection”, IEEE Engineering in Medicine and Biology Magazine, vol. 21, no. 1, pp. 42-57, Feb. 2002.

[27] J. Pan and W. J. Tompkins, “A Real Time QRS Detection Algorithm”,

IEEE Transactions on Biomedical Engineering, vol. BME-32, no. 3, pp. 230-236, Mar. 1985.

[28] ARM mbed OS developer site [Online]. Available:

https://developer.mbed.org/ [Accessed: Oct. 2016]. [29] Android Studio website [Online]. Available:

https://developer.android.com/studio/index.html [Accessed: Oct. 2016]

[30] Thermoval rapid/kids/kids flex manual, HARTMANN [Online]. Available: http://www.thermoval.info/media/Others_ES_PT_GR_GB_

AE.pdf [Accessed: Oct. 2016].