Twitter icon
Facebook icon
LinkedIn icon
Google icon
Reddit icon
StumbleUpon icon
Del.icio.us icon

EHM: Electrocardiography Holter Monitor

Added to IoTplaybook or last updated on: 08/30/2021
EHM: Electrocardiography Holter Monitor

Story

DISCLAIMER: This application is used for demonstrative and illustrative purposes only and does not constitute an offering that has gone through regulatory review. It is not intended to serve as a medical application. There is no representation as to the accuracy of the output of this application and it is presented without warranty.

Our Trailer:

Things used in this project

Hardware components

nRF5340 Development Kit
Nordic Semiconductor nRF5340 Development Kit
 
× 1

Avnet

ATmega328PB microcontroller
Microchip Technology ATmega328PB microcontroller
 
× 1

Newark

SparkFun Single Lead Heart Rate Monitor - AD8232
SparkFun Single Lead Heart Rate Monitor - AD8232
 
× 1

SparkFun

 
MLX90614
 
× 1

Amazon

MAX30102 High-Sensitivity Pulse Oximeter and Heart-Rate Sensor for Wearable Health
Maxim Integrated MAX30102 High-Sensitivity Pulse Oximeter and Heart-Rate Sensor for Wearable Health
 
× 1

Maxim

Integrated

Power Profiler Kit
Nordic Semiconductor Power Profiler Kit
 
× 1

Avnet

Raspberry Pi Zero Wireless
Raspberry Pi Zero Wireless
 
× 1

Adafruit

 
Smartphone
 
× 1  
Hook Up Wire Kit, 22 AWG
Hook Up Wire Kit, 22 AWG
 
× 1

Newark

Software apps and online services

nRF Connect SDK
Nordic Semiconductor nRF Connect SDK
 
  Nordic
 
Python
 
  Python
 
Segger Embedded Studio
 
  Segger
 
Nordic Semiconductor nRF Cloud
 
  Nordic

Hand tools and fabrication machines

3D Printer (generic)
3D Printer (generic)
 

Introduction:

Our heart beats 115200 times a day, it is such a fine machine that does not stop during our lives. However, not many people have the advantage to have this machine in good conditions. Many factors of daily life can permanently affect cardiac function.

Factors such as:

  • Sedentarism.
  • Diet full of Salt, saturated fats and refined sugar.
  • Alcoholic intake.
  • Smoking
  • High blood pressure
  • Obesity
  • Family history of heart disease
  • History of a previous heart attack
  • Sge over 45 for men, or over 55 for women
  • Male gender (there's a direct correlation for cardiovascular disease)
  • Substance abuse
  • Low potassium or magnesium

This brings us to our pain point:

Quite a lot of people have to undergo cardiac tests frequently in expensive hospitals with gigantic measuring devices. We are in a time where open health is stronger than ever and it is time to make the patient the point of care.

The market for electrocardiography is quite enormous, as it has become the standard for patients with heart risks.

What we can see in this graphic is that most of the electrocardiographs are those big machines (as a Biomedical Engineer I can attest that most, are quite old). In addition to this most in the "holter" category are not really wearables but smaller ones that can be carried despite that a wearable one that can be used at home could provide invaluable information about the patient's heart.

One thing that we have to notice first. The first of wearables has already come out in the market and the results are not that great. The main issue that Doctors put forth is that it is too much information, think of the internet before data aggregators, it has no value if it cannot be interpreted correctly and that is something that has to be taken into consideration. A solution should aggregate all that data and provide carers with useful information.

Connection Diagram

This is the connection diagram of the system:

Basically, through the nRF gateway and cloud we get the signals from our microcontroller, we clean it a bit and then send it to our Node-RED dashboard.

ECG system connections:

Notice the use of the Raspbery Pi Zero W and the AD8232 Sensor.

Connections for the nRF5340:

 

To easily send sensor data to the nRF5340, an Atmega328P was used. Also shown are the temperature sensor and a MAX30102 sensor.

Building Process:

The project is divided into two main branches, the use of the nRF5340 as a vital signs monitor and the PPKII as an ECG, I will explain both in detail, starting with the nRF5340.

nRF5340 Setup:

The complete project will be in the folder "nRF Project": https://github.com/altaga/EHM--Advanced-Wearables/tree/master/nRF%20Project

As the official documentation indicated, the hci_rpmsg project was used for the device's Network layer from Segger Embedded Studio v1.5.1.

The application for the CORE layer is in the nRF Project folder.

Read Sensor Data:

To read the sensors, an Atmega328P was used as a driver to read the sensors easily and send the information to the nRF5340 as shown by the schematic. A proprietary transmission protocol was used, inspired by the communication of LCD Displays.

The data sent from the microcontroller to the board is at 16 bits, the first 8 bits being the data to send and the other 8 the sensor number.

static unsigned int temp = 0;
temp = readTriWire();
if (temp >> 8 != 0)
{
    if (temp >> 8 == 1)
    {
        memory = temp & 0x00FF;
    }
    else if (temp >> 8 == 2)
    {
        memory = memory<<8;
        memory = memory + (temp & 0x00FF);
    }
    else if (temp >> 8 == 3)
    {
        memory = memory<<8;
        memory = memory + (temp & 0x00FF);
    }
    else if (temp >> 8 == 4)
    {
        memory = memory<<8;
        memory = memory + (temp & 0x00FF);
        spo_val = memory;
        bt_gatt_notify(NULL, &stsensor_svc->attrs[2], &spo_val, sizeof(spo_val));
    }
    printk("%d \n",(temp & 0x00FF));
}

Each data received is inserted into a 32-bit memory variable, once we receive the 4 values, we send them to the BLE notify.

BLE:

For the BLE notification, a 32-bit variable is being sent, with a data encoded every 8 bits.

Here is an example of how the information gets to nRF connect.

To see the transmission more clearly, record a video of how the data arrives in real time to the cloud and to the platform that you carry out in Node-RED (more details at the Node-RED section).

Here is a video of all this working!:

Power Consumption:

As we can see, our device has a consumption of 50mAh.

 

This is the setup that was measured

This is the setup that was measured

EKG Device:

AD8232 :

The main idea of the project was originally to take EKG measurements through the power profiler kit ii. The circuit used to measure the ECG is an AD8232 module, however it outputs a voltage, not a current.

So for us to be able to turn this circuit into a current measurement circuit, we must include a resistor and put the PPKII in series with the resistor to close the circuit.

With this circuit we will now be able to measure the current that will pass through the resistance, which corresponds to the ECG wave. Here is a video example of an ECG capture with the PPKII.

RPI:

However, having it connected to a PC to make measurements seemed absurd to us, so to use the PPKII we used a Raspberry Pi Zero.

Library used: https://github.com/IRNAS/ppk2-api-python

In the end the circuit used to make the EKG measurements with the raspberry is this one:

MQTT RPI Server:

All the code implemented to perform the measurements and send them to Node-RED is in the RPI Software folder at our Github that you can find below.

However, it must be mentioned that all the data that reaches Node-RED is sent through MQTT, this MQTT server is installed on the Raspberry through Mosquitto.

https://mosquitto.org/

We recommend using an MQTT installed directly from a service provider such as AWS for added security.

Setup nRF MQTT:

Fortunately for us, nRF Cloud has its own mqtt service, as the official documentation says.

https://nrfcloud.com/#/docs/guides/mqtt

Following that guide I was able to configure the credentials of the MQTT server, the service is mounted on AWS, therefore we require the following to be able to successfully make the connection.

  • Endpoint.
  • Gateway Topic.
  • ClientID
  • caCert
  • clientCert
  • privateKey

To configure this data in Node-RED we must enter the MQTT node.

By clicking on the pencil symbol we can configure all the MQTT service.

Once everything is configured, we can receive all the data sent by the nRF5340 to nRF Cloud, here is an example of how we are receiving the 4 values in the Node-RED platform.

To filter each value to its corresponding graph, the following functions were used.

let p=JSON.parse(msg.payload);
p = p["message"]["event"]["characteristic"]
p = { payload: p["value"][0]}; 
return p;

Thus we will obtain graphs with the values of each sensor.

In the video already shown above we will see the graphs receiving the data in real time.

The Final Product:

Vital Signs Station:

 

ECG Station:

 

 

You can find our 3D printed case designs below!

Dry Electrodes

This is perhaps the greatest development done in the project!

Due to the fact that this is a device that we are going to be using for long periods of time and it is also a device that must be used every day, we soon understood that the use of disposable electrodes is not feasible. So that's why we decided to make our own dry electrodes.

Materials:

  • Copper Plate.
  • Silver Conductive Ink.
  • Electrode External Snap.

Electrode arrangement

In order to read the EKG and also make the device as comfortable as possible, we take into consideration the arrangement of Electrodes of the AppleWatch

CR Apple Computers

First we place two electrodes on the right hand and one on the left hand as follows.

Right:

Left:

Ground:

With this arrangement of electrodes we can obtain an ECG signal that while not perfect, we can fix with a little processing on the Node-RED.

Final DEMO:

Closing

We think we have achieved a great medical device prototype with this project. It does everything an IoT-capable device should do and probably we have solved some of the problems in relation with gel-based electrodes. And that is perhaps the main innovation with this device. It has huge market potential mainly with sports science applications. For our next steps in relation with this project we will focus on testing it in both sports and clinical applications and also on the market of sport-related or exercise related classes and services, which also show great potential.

References:

(1) https://www.ahajournals.org/doi/pdf/10.1161/hc5001.101063#:~:text=The%20American%20Heart%20Association%20(AHA,the%20limitations%20of%20previous%20studies.

(2)https://medicalfuturist.com/ten-ways-technology-changing-healthcare/?utm_source=The%20Medical%20Futurist%20Newsletter&utm_campaign=ee5854702c-EMAIL_CAMPAIGN_2019_10_29_diabetes_companies_COPY_&utm_medium=email&utm_term=0_efd6a3cd08-ee5854702c-420575081

Custom parts and enclosures

nrf case bottom

ECG case bottom

ECG case top

nrf case top

Schematics

System Architecture - The full idea of the system

 

ECG - ECG schematics

 

nRF - nRF schematics

 

Code

Power profiler RasPI code - Python

Node red Flow - JavaScript

Repository with all the code commented and more

altaga / EHM--Advanced-Wearables

Credits

EdOliver

EdOliver

Engineer, Scientist, Maker. Entrepreneur and Futurist.

Alejandro Sanchez

Alejandro Sanchez

I am a biomedical engineer working at Boston Scientific as a service engineer

 

 

 

 

 

Hackster.io

This content is provided by our content partner Hackster.io, an Avnet developer community for learning, programming, and building hardware. Visit them online for more great content like this.

This article was originally published at Hackster.io. It was added to IoTplaybook or last modified on 08/30/2021.
Verticals: