This is only a preview of the February 2023 issue of Silicon Chip. You can view 36 of the 112 pages in the full issue, including the advertisments. For full access, purchase the issue for $10.00 or subscribe for access to the latest issues. Articles in this series:
Articles in this series:
Items relevant to "Active Mains Soft Starter, Part 1":
Items relevant to "Advanced Test Tweezers, Part 1":
Items relevant to "Active Subwoofer, Part 2":
Items relevant to "Heart Rate Sensor Module":
Articles in this series:
Items relevant to "Noughts & Crosses, Part 2":
Purchase a printed copy of this issue for $11.50. |
Using Electronic Modules with Jim Rowe
Heart Rate
Sensor Module
This Jaycar XC3784 kit features an Analog Devices AD8232 heart rate
monitor front-end IC which forms the ‘heart’ of this module. It provides a
low-cost way to monitor the operation of the heart via an Arduino MCU or
similar. It comes complete with a matching three-electrode lead; a pack
of additional electrode pads is also available.
E
lectrocardiograms (ECG)
are medical tools for measuring
and recording the tiny voltages produced on the skin due to heart muscle activity. By attaching two, three or
more electrodes or ‘leads’ to the skin
of your wrists, ankle or chest, a professional ECG costing upwards of $5000
can record ECG waveforms to allow a
GP or cardiac specialist to check your
heart’s health.
In the October 2015 issue of Silicon
Chip, we described an Arduino-based
project which allowed you to do all
of this using a Windows-based laptop
PC (siliconchip.au/Article/9135). The
project was not intended for use in
medical diagnosis, but simply for use
in exploring the way your body works.
It can be fun, as well as educational.
You can monitor changes to your
heart under various conditions, as it
is affected by many things, including
emotions, mental and physical activity
– even breathing. All of these things
can have a demonstrable effect on the
heart’s ECG waveform. Being able to
show this easily, safely and at a low
cost is a bonus.
To adapt an Arduino Uno module
for sampling the low-level signals
picked up by ECG electrodes, in 2015,
I designed a small ‘front-end shield’
that plugged into the Arduino. It provided a high-gain (1000/2000 times)
differential amplifier plus a three-pole
low pass filter to reduce the sampler’s
susceptibility to 50Hz hum.
The Duinotech XC3784 kit comes with
everything shown. While it’s called a kit,
the module is already assembled.
72
Silicon Chip
Australia's electronics magazine
The heart rate sensor module we’re
discussing in this article is basically a
much-improved version of the frontend shield in our project, compressed
into a single 4mm-square 20-lead SMD
chip: the Analog Devices AD8232.
This is a very impressive device, as
you’ll soon see.
This comes on the Duinotech module from Jaycar (Cat XC3784), which
combines the AD8232-based module
with a colour-coded three-electrode
cable and a set of matching adhesive
sensor electrode pads. Jaycar currently
has this kit for $27.95, with 12 additional electrode pads (Cat XC3785)
sold separately for $8.95.
Inside the AD8232
Analog Devices describe the AD8232
as a “Heart Rate Monitor Front End”,
or an “integrated signal conditioning
block for ECG and other biopotential
measurement applications”.
A simplified version of the circuitry
inside the AD8232 is shown in Fig.1.
As you can see, it includes an instrumentation amplifier (InstA) to process the incoming low-level ECG signals plus three further op amps: A1,
A2 and A3.
A1 provides low-pass and high-pass
filtering plus additional gain. A3 is
used to buffer the half-supply reference voltage, ensuring that the main
amplifier InstA can handle the full
signal swing.
A2 is used to drive the right-leg
electrode lead (RLD) with an inverted
siliconchip.com.au
Fig.1: a simplified
block diagram of
the AD8232 IC. It’s
described as a singlelead ECG front-end
and implements
various low- and
high-pass filters using
internal op amps.
version of any common-mode signal
present in the inputs to the instrumentation amplifier, InstA. This improves
the common-mode rejection of the
system, giving a significantly cleaner
reproduction of the ECG signal.
There are also two comparators, C1
and C2, used to provide ‘lead-off’ signals if either of the main electrodes is
not in good contact with the skin of
the wrists or arms.
The result of this complexity inside
the AD8232 chip is that when its
inputs are connected to electrodes
attached to the skin of a human body,
and it’s provided with suitable support
circuitry, it gives a clean analog ECG
output signal.
The module circuit
Fig.2 shows the full circuit of the
AD8232-based module. There’s very
little in it apart from the AD8232 chip
and a handful of passive components.
It all fits on a small PCB measuring 30
× 35mm, including the mini 3.5mm
TRS jack socket used to connect the
three-electrode lead.
Connectors CON1 and CON2 provide alternative connections for the
input electrodes, with CON2 being
the 3.5mm input jack and CON1 being
just a set of three holes in the PCB to
receive a 3-pin SIL header. CON3 is a
6-pin SIL header that provides all the
power and output connections.
As the labels suggest, pins 1 and 2 of
CON3 are used for ground and +3.3V
power, respectively; pin 3 is the ECG
signal output, while pins 4 and 5 provide the ‘lead-off’ error signals.
Pin 6 of CON3 is a logic input that
allows the AD8232 to be placed in shutdown (standby) mode to save power
when ECG readings are not needed.
It is normally pulled high by a 10kΩ
resistor, so all that is required to place
it in standby mode is to pull it low.
The rated current drain of the
AD8232 chip is less than 250μA in
operating mode, dropping to less than
500nA (0.5μA) in shutdown/standby
mode. So it is suitable for battery-
powered portable use.
As well as being taken to pin 3 of
CON3, the ECG output from pin 10 of
IC1 also connects to LED1 via a 1kΩ
series resistor. This allows the LED to
be used to monitor the heartbeat visually. But if this is not required, the
LED can be disabled simply by cutting the PCB track between the two
pads of LK1.
LED1 is on the module PCB at upper
left, in the centre of the printed ‘heart’
symbol. LK1 is visible just to the left of
Fig.2: the full circuit of the heart rate monitor module. Apart from IC1 and LED1 the circuit consists of a small number of
passive components. The module also features alternative input connectors (CON1 & CON2) for the electrodes.
siliconchip.com.au
Australia's electronics magazine
February 2023 73
the ‘heart’, above the connections for
CON3. The latter is fitted underneath
the PCB, ready to connect to a breadboard or another PCB.
Electrode placement
Fig.3 shows two of the suggested
placements of the three electrodes
with this kind of ECG sensor.
On the left, the RA (right arm) electrode is positioned near the right wrist,
the LA (left arm) electrode near the
left wrist and the RL (right leg) driving electrode is above the right knee.
However, another suitable position is
just above the right ankle.
On the right is another way of
achieving much the same result. Here
the RA and LA electrodes are placed
just above the armpit on each side,
while the RL electrode is placed on
the abdomen just below the rib cage.
Although it’s shown to the right, it
can be placed in the centre, just above
the navel.
Connecting it to an Arduino
Fig.3: the typical electrode placements on the human body. Note the
orientation of the person is such that their face is facing upward.
It’s pretty easy to connect the
AD8232 Heart Monitor module to an
Arduino like the standard Uno or one
of the many compatibles, as shown
in Fig.4. The GND and +3.3V pins
on CON3 connect to the corresponding pins on the Uno, as shown by the
grey and red wires, while the OUTPUT
pin connects to the A0 pin of the Uno
(blue wire).
If you want to try using the LO- and
LO+ pins, these can be connected to
the Uno’s IO11 and IO10 pins (green
and purple wires). And if you envisage wanting to make use of the SDN
pin (pin 6) to save power, this can be
connected to the Uno’s D8 pin (not
shown in Fig.4).
It’s also relatively easy to connect
the module to an Arduino Nano, as
shown in Fig.5. Note that the connections shown in both Fig.4 and Fig.5 are
those expected by the sketches I found
to put the module to use. Other configurations are possible as long as the
software is adapted to match.
Firmware and software
Fig.4 (above): the connection diagram for the heart rate
monitor module to an Arduino Uno or similar.
Fig.5: the connection diagram to an Arduino Nano.
74
Silicon Chip
Australia's electronics magazine
I couldn’t find sketches or PC software on the Jaycar website for use with
this module, but after searching the
internet, I found references on Sparkfun’s website to a simple sketch called
“Heart_Rate_Display.ino”, available to
download from:
https://github.com/sparkfun/
AD8232_Heart_Rate_Monitor
This sketch was written by Casey
Kuhns at SparkFun Electronics and
seems to have been written originally
for the Mini Arduino Pro. It simply
sends numeric samples of the ECG
signal back to the PC, where they can
be displayed as a listing in the Arduino IDE’s Serial Monitor.
If you have a recent IDE version
(v1.6.6 or later), you can display them
as a waveform using the Serial Plotter
tool instead.
To try out the module and kit with
an Arduino Uno, I adapted the Kuhns/
SparkFun sketch to make it work with
siliconchip.com.au
the Uno. The adapted sketch is called
“AD8232_heart_monitor_basic.ino”
and is available for download from
the Silicon Chip website.
Trying it out
I connected the Jaycar XC3784 module up to an Arduino Uno, as shown
in Fig.4, then connected the Uno to a
PC via a USB cable. After that, I started
the Arduino IDE (v1.8.19), opened the
“AD8232_heart_monitor_basic.ino”
sketch, verified and compiled it.
After that, I connected the plug on
the end of the electrode cable into the
3.5mm jack on the module and fitted
the red electrode to my right wrist, the
green electrode to my left wrist, and
the yellow electrode to my right leg
just behind the knee.
The next step was to upload the
compiled sketch to the Arduino, after
which it began running, with the little
‘heartbeat’ LED on the module blinking away cheerfully. When I opened
the IDE’s Serial Monitor tool, I was
greeted by a scrolling list of numeric
samples of my ECG waveform.
Of course, it is not easy to deduce
much from a scrolling list of numbers,
so I closed the Serial Monitor tool
and opened up the Serial Plotter tool
instead. This gave a waveform that
was a lot easier to interpret, although
there was a fair bit of noise present.
So I tried moving the electrode positions a few times and kept checking
the result.
The plot shown in Fig.6 is about the
best I could get, and as you can see,
there’s still a fair bit of noise between
the main QRS spikes, almost obscuring the smaller P and T bumps.
Your heart & its electrical activity
Most people know that your heart is basically a pump that pushes your blood
around your body via its blood vessel ‘plumbing’ – the arteries and veins.
The typical human adult heart is about the size of a clenched fist and weighs
about 300g. It’s located near the centre of your chest and pumps about once
per second.
The pumping action is triggered mainly by a nerve centre inside the heart,
called the sino-atrial or SA node. Each pumping cycle is initiated by a nerve
impulse that starts at the SA node and spreads downwards through the heart
via preset pathways.
The heart comprises millions of bundles of microscopic muscle cells, which
contract when triggered. The muscle cells are electrically polarised, like tiny
electrolytic capacitors (positive outside, negative inside). As the trigger pulse
from the SA node passes through them, they depolarise briefly and contract.
So with each beat of the heart, a ‘wave’ of depolarisation sweeps from the
top of the heart to the bottom. Weak voltages produced by this wave appear
on the outside surface of your skin, and can be picked up using electrodes
strapped to your wrists, ankles and the front of your chest. It’s these voltages
(about 1mV peak-to-peak) that are captured and recorded as an electrocardiogram or ‘ECG’.
The actual shape and amplitude of the ECG waveform depend upon the individual being examined and the positioning of the electrodes, but the general
shape is shown in the adjacent graph.
The initial ‘P’ wave is due to the heart’s atria (upper input chambers) depolarising, while the relatively larger and narrower ‘QRS complex’ section is
due to the much stronger ventricles
(lower output chambers) depolarising. Finally, the ‘T’ wave is due to the
repolarisation of the ventricles, ready
for another cycle.
Doctors can evaluate several heart
problems by measuring the timing of
these wave components and their relative heights. They can also diagnose
problems by seeing how wave components change with the various standard electrode and lead connections.
Conclusion
Although I think some of this noise
could be removed by further experimenting with electrode placement,
I also gained the impression that
some of it was being picked up by the
AD8232 module itself and the wiring
between it and the Arduino.
I suspect that, for the best results,
it would be a good idea to place the
module and the Arduino inside an
Earthed metal box.
So the AD8232 module and accompanying electrode kit provide an easy
way to check your heart rate. If you get
one, I suggest you also get one of the
packs of extra electrode pads (Jaycar
Cat XC3785), since the pads are only
suitable for a single use.
SC
siliconchip.com.au
Fig.6: a heart rate plot taken using the sample software and the Arduino IDE’s
built-in Serial Plotter.
Australia's electronics magazine
February 2023 75
|