Silicon ChipHeart Rate Sensor Module - June 2024 SILICON CHIP
  1. Contents
  2. Subscriptions
  3. Back Issues
  4. Publisher's Letter: Test your speakers!
  5. Feature: Techno Talk - Program that! by Max the Magnificent
  6. Feature: Net Work by Alan Winstanley
  7. Project: Wi-Fi Time Source for GPS Clocks by Tim Blythman
  8. Feature: Heart Rate Sensor Module by Jim Rowe
  9. Project: Loudspeaker Test Jig by Phil Prosser
  10. Feature: Setting up and using Room EQ Wizard by Phil Prosser
  11. Feature: Teach-In 2024 – Learn electronics with the ESP32 by Mike Tooley
  12. Feature: Max’s Cool Beans by Max the Magnificent
  13. Feature: Audio Out by Jake Rothman
  14. Feature: Circuit Surgery by Ian Bell
  15. PartShop
  16. Market Centre
  17. Contents
  18. Back Issues: Peak Test Instruments

This is only a preview of the June 2024 issue of Practical Electronics.

You can view 0 of the 72 pages in the full issue.

Articles in this series:
  • (November 2020)
  • Techno Talk (December 2020)
  • Techno Talk (January 2021)
  • Techno Talk (February 2021)
  • Techno Talk (March 2021)
  • Techno Talk (April 2021)
  • Techno Talk (May 2021)
  • Techno Talk (June 2021)
  • Techno Talk (July 2021)
  • Techno Talk (August 2021)
  • Techno Talk (September 2021)
  • Techno Talk (October 2021)
  • Techno Talk (November 2021)
  • Techno Talk (December 2021)
  • Communing with nature (January 2022)
  • Should we be worried? (February 2022)
  • How resilient is your lifeline? (March 2022)
  • Go eco, get ethical! (April 2022)
  • From nano to bio (May 2022)
  • Positivity follows the gloom (June 2022)
  • Mixed menu (July 2022)
  • Time for a total rethink? (August 2022)
  • What’s in a name? (September 2022)
  • Forget leaves on the line! (October 2022)
  • Giant Boost for Batteries (December 2022)
  • Raudive Voices Revisited (January 2023)
  • A thousand words (February 2023)
  • It’s handover time (March 2023)
  • AI, Robots, Horticulture and Agriculture (April 2023)
  • Prophecy can be perplexing (May 2023)
  • Technology comes in different shapes and sizes (June 2023)
  • AI and robots – what could possibly go wrong? (July 2023)
  • How long until we’re all out of work? (August 2023)
  • We both have truths, are mine the same as yours? (September 2023)
  • Holy Spheres, Batman! (October 2023)
  • Where’s my pneumatic car? (November 2023)
  • Good grief! (December 2023)
  • Cheeky chiplets (January 2024)
  • Cheeky chiplets (February 2024)
  • The Wibbly-Wobbly World of Quantum (March 2024)
  • Techno Talk - Wait! What? Really? (April 2024)
  • Techno Talk - One step closer to a dystopian abyss? (May 2024)
  • Techno Talk - Program that! (June 2024)
  • Techno Talk (July 2024)
  • Techno Talk - That makes so much sense! (August 2024)
  • Techno Talk - I don’t want to be a Norbert... (September 2024)
  • Techno Talk - Sticking the landing (October 2024)
  • Techno Talk (November 2024)
  • Techno Talk (December 2024)
  • Techno Talk (January 2025)
  • Techno Talk (February 2025)
  • Techno Talk (March 2025)
  • Techno Talk (April 2025)
  • Techno Talk (May 2025)
  • Techno Talk (June 2025)
Articles in this series:
  • Win a Microchip Explorer 8 Development Kit (April 2024)
  • Net Work (May 2024)
  • Net Work (June 2024)
  • Net Work (July 2024)
  • Net Work (August 2024)
  • Net Work (September 2024)
  • Net Work (October 2024)
  • Net Work (November 2024)
  • Net Work (December 2024)
  • Net Work (January 2025)
  • Net Work (February 2025)
  • Net Work (March 2025)
  • Net Work (April 2025)
Articles in this series:
  • Teach-In 2024 (April 2024)
  • Teach-In 2024 (May 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (June 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (July 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (August 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (September 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (October 2024)
  • Teach-In 2024 – Learn electronics with the ESP32 (November 2024)
Articles in this series:
  • Max’s Cool Beans (April 2024)
  • Max’s Cool Beans (May 2024)
  • Max’s Cool Beans (June 2024)
  • Max’s Cool Beans (July 2024)
  • Max’s Cool Beans (August 2024)
  • Max’s Cool Beans (September 2024)
  • Max’s Cool Beans (October 2024)
  • Max’s Cool Beans (November 2024)
  • Max’s Cool Beans (December 2024)
Articles in this series:
  • Audio Out (January 2024)
  • Audio Out (February 2024)
  • AUDIO OUT (April 2024)
  • Audio Out (May 2024)
  • Audio Out (June 2024)
  • Audio Out (July 2024)
  • Audio Out (August 2024)
  • Audio Out (September 2024)
  • Audio Out (October 2024)
  • Audio Out (March 2025)
  • Audio Out (April 2025)
  • Audio Out (May 2025)
  • Audio Out (June 2025)
Articles in this series:
  • Circuit Surgery (April 2024)
  • STEWART OF READING (April 2024)
  • Circuit Surgery (May 2024)
  • Circuit Surgery (June 2024)
  • Circuit Surgery (July 2024)
  • Circuit Surgery (August 2024)
  • Circuit Surgery (September 2024)
  • Circuit Surgery (October 2024)
  • Circuit Surgery (November 2024)
  • Circuit Surgery (December 2024)
  • Circuit Surgery (January 2025)
  • Circuit Surgery (February 2025)
  • Circuit Surgery (March 2025)
  • Circuit Surgery (April 2025)
  • Circuit Surgery (May 2025)
  • Circuit Surgery (June 2025)
Using Electronic Modules with Jim Rowe Heart Rate Sensor Module This 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 several thousand pounds can record ECG waveforms to allow a GP or cardiac specialist to check your heart’s health. In the October 2016 issue of Practical Electronics, we described an Arduino-based USB Electrocardiogram project which allowed you to do all of this using a Windows-based laptop PC. 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 2016, 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 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. The AD8232 comes on a module from multiple online sources, which combines the AD8232-based module The Heart Rate Monitor ‘kit’ comes with everything shown. While it’s called a kit, the module is already assembled. 24 with a colour-coded three-electrode cable and a set of matching adhesive sensor electrode pads. Search for ‘AD8232 Heart Monitor’ – amazon. co.uk currently has this for under £10. Additional adhesive electrode pads are sold separately. 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 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 analogue ECG output signal. Practical Electronics | June | 2024 Reproduced by arrangement with SILICON CHIP magazine 2024. www.siliconchip.com.au Fig.1: a simplified block diagram of the AD8232 IC. It’s described as a single-lead ECG front-end and implements various low- and high-pass filters using internal op amps. 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: CON2 is the 3.5mm input jack and CON1 is 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 Fig.3: the typical electrode placements on the human body. Note the orientation of the person is such that their face is looking out of the page. 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 the module 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 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. 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 and CON2) for the electrodes. Practical Electronics | June | 2024 25 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. 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. 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 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). Fig.6: a heart rate plot taken using the sample software and the Arduino IDE’s built-in Serial Plotter. 26 Firmware and software I couldn’t find sketches or PC software on my vendor’s (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 the Uno. The adapted sketch is called AD8232_heart_monitor_basic.ino and is available for download from the June 2024 page of the PE website: https://bit.ly/pe-downloads 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. Next, 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. Practical Electronics | June | 2024 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. 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. 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 or two of the packs of extra electrode pads, since the pads are only suitable for a single use. Your best bet since Your heart and 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 (SA) node. Each pumping cycle is initiated by a nerve impulse that starts at the SA node and spreads down 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. MAPLIN Chock-a-Block with Stock Visit: www.cricklewoodelectronics.com Or phone our friendly knowledgeable staff on 020 8452 0161 Components • Audio • Video • Connectors • Cables Arduino • Test Equipment etc, etc JTAG Connector Plugs Directly into PCB!! No Header! No Brainer! Our patented range of Plug-of-Nails™ spring-pin cables plug directly into a tiny footprint of pads and locating holes in your PCB, eliminating the need for a mating header. Save Cost & Space on Every PCB!! Visit our Shop, Call or Buy online at: www.cricklewoodelectronics.com 020 8452 0161 Visit our shop at: 40-42 Cricklewood Broadway London NW2 3ET Practical Electronics | June | 2024 Solutions for: PIC . dsPIC . ARM . MSP430 . Atmel . Generic JTAG . Altera Xilinx . BDM . C2000 . SPY-BI-WIRE . SPI / IIC . Altium Mini-HDMI . & More www.PlugOfNails.com Tag-Connector footprints as small as 0.02 sq. inch (0.13 sq cm) 27