You are on page 1of 9

3

MICROCONTROLLERS IN
MEDICAL INSTRUMENTATION
Amit J. Nimunkar

This chapter describes the implementation of microcontrollers in medical


instrumentation. Microcontrollers are ubiquitous in medical devices for
patient monitoring, diagnostics, therapeutics, imaging, and wearable
devices. They are intended not only to save lives but also to provide better
quality of life. Microcontrollers have transformed the way in which we
receive health care. Medical devices such as electrocardiograph monitors,
pulse oximeter, and such, which were typically found in the hospitals and
clinics, are found in ambulatory devices, combat, and space stations. Devices
such as blood glucose monitors and inhalers are portable and found at home
and elderly care centers and they transmit data wirelessly. These transmitted
data can be further stored in remote storage or Cloud and analyzed using
machine learning algorithms for diagnostic results. From an engineering per-
spective, the medical device needs to: be fast, consume low power, be port-
able, be fast design-to-market, and pass the necessary regulatory standards.
Microcontrollers play an important role in addressing some of these
constraints.

3.1 BASICS OF MICROCONTROLLER

The microcontroller unit (MCU) could be considered as a computer on a


chip, which is designed for a specific application and generally involves some
human interaction or control. Figure 3.1 shows it consists of a central

Medical Instrumentation: Application and Design, Fifth Edition.


Edited by John G. Webster and Amit J. Nimunkar.
© 2020 John Wiley & Sons, Inc. Published 2020 by John Wiley & Sons, Inc.
Companion website: www.wiley.com/go/Webster/Medical instrumentation5e

153
154 3 MICROCONTROLLERS IN MEDICAL INSTRUMENTATION

Reset,
interrupt(s)
Power Vcc
CPU regulation GND

Internal data and address bus


Memory
Flash
SRAM GPIO

EEPROM

Clock/
Crystal ADC
timing

Timers/ DAC
counters

Figure 3.1 General block diagram of a microcontroller.

processing unit (CPU), memory, and peripherals. It performs a task by


executing command instructions, fetching and storing information from
memory storage, and controlling peripherals. The peripherals can include
general-purpose input/output (GPIO), timers, counters, analog-to-digital
conversion, digital-to-analog conversion, serial ports, and other such sys-
tems. Thus, it distinguishes itself from a microprocessor and it is also referred
to as a “system on a chip (SoC)” (Predko, 1998). We discuss some of these
components in the following section with an example of a simple embedded
system.

3.2 EMBEDDED MEDICAL SYSTEM

As described in Chapter 1 (Figure 1.1), a generalized instrumentation system


consists of a sensor to convert energy or information to an electric form. This
electric signal is further preprocessed by analog circuitry with appropriate
3.2 EMBEDDED MEDICAL SYSTEM 155

Cloud
computing

Wireless
Signal communication/
Amplification
system
conversion Internet
Physiological
parameters

Power Embedded
management system

Signal
Amplification Interfaces/
system conversion
display

Figure 3.2 General block diagram for embedded medical system. (Adapted
from Texas Instruments, HealthTech Applications Guide, HealthTech
Overview, 2013. Courtesy of Texas Instruments Incorporated.)

gain and filtering. Along with removing noise and amplifying the signal of
interest, the analog circuitry should offer long-term stability with regards
to offset drift and gain, over time, and temperature. Figure 3.2 shows forms
of embedded systems for data acquisition, processing, storage, display, trans-
mission, data analytics, and feedback.
The data acquisition and feedback are facilitated using an analog-to-digital
converter (ADC) and a digital-to-analog converter (DAC), respectively.
These converters should provide high precision and accuracy, wide dynamic
range, and appropriate resolution for the measurement under consideration.
The embedded system is the most important feature of the medical device
and could be considered as the brain of the device. It should not only provide
functions including data acquisition, mathematical calculations, signal proces-
sing, data storage, communication, and display, but it should also provide accu-
rate, reliable, responsive, and safe operation of the device. The embedded
system should incorporate multiple error detection, peripheral fault detection,
interrupts to handle faults, and critical operations (Predko, 1998). This allows
156 3 MICROCONTROLLERS IN MEDICAL INSTRUMENTATION

the medical device to operate in a highly deterministic fashion. Internet-based


medical devices, also referred to as Internet of Things (IoT) medical devices
use the Internet as a means for communication and allow data analytics and
machine learning using various cloud computing platforms available in the
market. Finally, the power management system should provide low-noise,
low-ripple power rails to the entire system for effective operation of the med-
ical device.

3.3 ECG-BASED EMBEDDED MEDICAL SYSTEM EXAMPLE

This section provides a simple example of a microcontroller-based electro-


cardiogram (ECG) instrumentation system. This example in no way consti-
tutes a real medical device, however, it helps to explain some of the concepts
related to embedded medical systems shown in Figure 3.2.
Figure 3.3 shows the block diagram of the microcontroller-based single
lead ECG device with electrode sensors connected to the left arm (LA), right
arm (RA), and right leg (RL) of a subject. This configuration of sensors
allows ECG lead I signal to be collected. As explained in Section 6.2, the
three leads of ECG signals in the frontal plane can be expressed in the form
of an Einthoven’s triangle, where lead I—LA to RA; lead II—left leg (LL) to
RA; lead III—LL to LA. If we acquire two of the three ECG leads, the
remaining lead ECG signals can be computed mathematically by the
microcontroller.

ECG
Microcontroller amplifier
circuit
Tx
Rx

SPI

SPI
Rx
Tx

Wireless Power
Storage Display
communication management

Figure 3.3 Block diagram of microcontroller-based ECG device to


acquire, store, and transmit a single-lead ECG signal.
3.3 ECG-BASED EMBEDDED MEDICAL SYSTEM EXAMPLE 157

EXAMPLE 3.1 If lead I and lead II ECG signals are obtained using appro-
priate electrode connections as described above, show how lead III can be
calculated mathematically in the microcontroller. Similarly, show how the
augmented leads (aVR, aVL, and aVF) can be calculated mathematically.

ANSWER The Einthoven’s triangle relation for the three ECG leads is
expressed as:

I − II + III = 0, thus lead III = II − I.


Similarly,
aVR = −(I + II)/2
aVL = (2I − II)/2
aVF = −(I − 2II)/2
(Refer to Section 6.2)

The power management unit should satisfy the power requirements for
different components. The ECG amplifier circuit performs the necessary
amplification and filtering. Since the ECG signal contains both positive
and negative going waveforms, the circuit provides a level-shift of appropri-
ate dc offset such that the ECG signal is within the voltage range of the
microcontroller (0 to 5 V, 0 to 3.3 V, and such). The microcontroller allows
for display of useful parameters such as the heart rate or the signal itself
depending on the resolution of the display. Wireless communication in
the form of Bluetooth, Wi-Fi, ZigBee, and others facilitates transmission
of the ECG signal or relevant parameters to external terminal or handheld
devices such as cellphones or tablets. The information could also be locally
stored using a secure digital (SD) card for further processing.
We will use this simplified example to build a functioning single lead
ECG system and discuss some of the relevant components of an embedded
medical system.

EXAMPLE 3.2 In Figure 3.3, calculate appropriate gain for the ECG ampli-
fier circuit in order to amplify the ECG signal before feeding to the
microcontroller.

ANSWER The gain for the ECG amplifier circuit depends on the voltage
range for the ECG signal, which is 0.5 to 4 mV (Table 1.1) and the voltage
range for the microcontroller (0 to 5 V, 0 to 3.3 V, and such). Thus, if the
voltage range for the microcontroller is 0 to 5 V, the gain = 5 V/4 mV =
1025 for the above range of ECG signal.
158 3 MICROCONTROLLERS IN MEDICAL INSTRUMENTATION

Table 1.1 shows the ECG signal is in the voltage range of 0.5 to 4 mV and
frequency range of 0.01 to 250 Hz. Thus, the signal needs to be amplified
appropriately and filtered to minimize unwanted interference and maximize
the signal of interest. Section 6.3 provides more information about the details
to be taken into consideration in the design and application of commercial
ECG systems. Nevertheless, Figure 3.4 provides a simplified design example
of the analog circuitry for ECG amplification and filtering consisting of
instrumentation amplifier, active bandpass filter, level-shifter, microcontrol-
ler, and power supply unit.
For this particular example, we will use the mbed Nucleo F303K8 micro-
controller board (STM32 Nucleo-32 Board User Manual, 2016). However,
the example could be implemented by replacing it by a microcontroller
development board such as Arduino Mega ADK (2018), Tiva C Series
TM4C123G LaunchPad (2013), or other such quick prototyping microcon-
troller development board.

POWER SUPPLY UNIT


The instrumentation system is powered via USB cable through the mbed
Nucleo F303K8 microcontroller board. The +3.3 V (pin 17) on the mbed
board is used as power supply output for positive rails of the analog circuitry.
The current is limited by the maximum current capability of the regulator on
the Nucleo board (500 mA max) (STM32 Nucleo-32 Board User Manual,
2016). It also powers the DC–DC converter TC962 (TC962 High Current
Charge Pump DC-to-DC Converter, 2012). The DC–DC converter circuit
provides the −3.3 V to power the negative rails for the analog circuitry. Other
DC–DC converters such as LTC1046 from Linear Technology could be used
for this application. The ferrite bead provides high-frequency interference
isolation between the analog and digital power (Eco and Limjoco, 2015).
The +3.3 V digital power from the Nucleo board is used to power the SD
card and could be used to power the display, while the +5 V digital power
is used to power the Bluetooth.

AMPLIFICATION AND FILTERING


An instrumentation amplifier pre-amplifies the ECG signal. Manufacturers
such as Linear Technology, Texas Instruments, Analog Devices, and Maxim
Integrated Products, among others, provide a variety of instrumentation
amplifiers with features such as high input impedance, high precision, low
drift, and high common-mode rejection ratio (CMRR).
Zener cathode VDD +V
C+ Cosc
C1 +

Vcc_USB
10μ GND FREQ×2
C– TC962 VOUT –V
C2
+
10μ L1
–3.3 V (DC–DC convertor) D1/TX VIN
D0/RX GND
RST RST
Rvar 1n GND 5V

GND_D

GND_A
NUCLEOF303K8
C4 R8 R7 D2 A7
500 D3 A6
U1 D4 A5
20k 10k
1.2Meg D5 A4 R9
Rg Rg
+V

D6 A3 Output
+V

R4 D7 A2 1k 1μ
Electrode_1 In– V+
D8 A1 C9
+V

+V

C3 R3 + U4
+ U3
R6 – D9 A0 GND_D
Electrode_2 In+ Out –
+ – TL072 D10 REF L2
47μ 68k + – TL072 20k R5 D11 3.3V
Right_Leg V– Ref
–V

D12 D13
–V

10k
+3.3_D

+3.3_A
LT1920
–V

Instrumentation amplifier Bandpass filter, additional gain Level shifter Microcontroller +V

Figure 3.4 A simplified example for Universal Serial Bus (USB) powered single-lead ECG
circuit consisting of instrumentation amplifier, bandpass filter, level shifter, and microcontroller.
The DC–DC converter provides −3.3 V for the amplifiers.
160 3 MICROCONTROLLERS IN MEDICAL INSTRUMENTATION

EXAMPLE 3.3 For the ECG circuit design shown in Figure 3.4, calculate
the overall gain and frequency response.

ANSWER For the ECG circuit design shown in Figure 3.4, Linear Technol-
ogy instrumentation amplifier LT1920 is implemented in the current design.
The gain (GIA) equation for LT1920 is (LT1920 Datasheet, 2019)

GIA = 49 4 kΩ Rvar + 1 (3.1)

The Rvar could be implemented as a potentiometer to control the gain of the


overall system. For Rvar = 500, the gain GIA ≈ 100.
The instrumentation amplifier is followed by a second-order active
bandpass filter similar to that explained in Section 1.20. The gain for this
inverting amplifier stage is given as GIN = −(1.2 × 106)/(68 × 103) ≈ −17.6.
The cutoff frequency for the low-pass filter is given as

f L = 1 2π × 1 2 × 106 × 1 × 10 − 9 = 133 Hz

The cutoff frequency for the high-pass filter is given as


f H = 1 2π × 68 × 103 × 47 × 10 − 6 = 0 05 Hz

Thus, for this stage the gain (GIN) is 17.6 and pass band from 0.05 to 133
Hz. Carter and Mancini (2017) provide an overview for higher order filters
for better frequency response.
Finally, the level shifter is implemented as a differential amplifier
(Section 1.14) to provide a dc offset of 1.65 V for the microcontroller. The
gain for this stage is given as

GLS = V + − V BPF × 10 kΩ 20 kΩ

where V+ = 3.3 V and VBPF is output from the bandpass filter stage. Thus,

GLS = 3 3 − V BPF × 0 5 = 1 65 − V BPF × 0 5

This stage provides an offset voltage of 1.65 V and gain of 0.5.


Thus, the total gain (GTot) for the system is

GTot = GIA × GIN × GLS (3.2)


GTot = 100 × 17 6 × 0 5 = 878 = 59 dB

This preprocessed ECG signal is then fed into the microcontroller for
further processing. This could involve additional gain, digital filtering, signal
3.4 SELECTION OF A MICROCONTROLLER 161

analysis, storage, transmission, and display using a microcontroller. We dis-


cuss this in Section 3.4.

3.4 SELECTION OF A MICROCONTROLLER

As mentioned earlier, modern medical instrumentation has some form of


microcontroller implementation for signal acquisition and further proces-
sing, which includes amplification, filtering, analysis, storage, transmission,
and display. A number of parameters are considered in the selection of a
microcontroller during the design phase (Predko, 1998; Solomon et al.,
2000; Barrett and Pack, 2006). Some of these are explained using the
ECG circuit described in Section 3.3.

MICROCONTROLLER AND FAMILIES


Microcontroller manufacturers include: Analog Devices, Atmel, Dallas
Semiconductor, Freescale Semiconductor, Hitachi Semiconductor, Intel,
Microchip, National Semiconductor, Renesas, STMicro, Texas Instruments,
and Zilog.
The manufacturers provide thousands of microcontrollers in the market,
so that there is a family of microcontrollers around a fixed core with certain
size of data bus (8-bit, 16-bit, 32-bit, 64-bit, and such). Family members are
marketed with different combinations of peripherals, memory, and such
(Wilmshurst, 2010). For example, SAMD, SAML, and SAMC are family
members of 32-bit microcontrollers with ARM Cortex® M0+ as the core.
They differ in features such as memory, peripherals, ADC sampling speed,
power consumption, and others.
The one we use in our design example (Figure 3.4) is the
STM32F303K8T6 microcontroller which has ARM®32-bit Cortex®-M4
CPU with floating point unit, it is from the STM32™ 32-bit MCU family.

OPEN DEVELOPMENT ENVIRONMENT


During the early concept evaluation phase of an embedded system, when the
goal is to test the project idea, it will be useful to build a rapid prototype in
order to save on time and costs. This could be done using open development
environment (ODE) evaluation boards consisting of the microcontroller
with other peripheral devices connected using expansion boards available
in the market. Generally, the hardware specification for such ODE boards
is freely available. And in most cases the software libraries that follow the

You might also like