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.
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.
Because of these reasons through AzureSphere's technology we will create a real-time heart rate, EKG monitoring system and a dashboard deployment, that will be out of the box secure, from the MCU, to the OS, to the cloud. Healthcare data is our most valuable one, and it is evident that this kind of security must become the norm in every device.
Second ProblemThis brings us to the second problem that is quite basic, most EKG machines whether they are Holter's or Rest EKGs use gel-based electrodes. These are completely unusable in an athletic environment i.e. Athletes trying to measure themselves during activity. For these reasons we will try while developing the IoT device, to develop at the same time Dry electrodes.
Connection DiagramThis is the connection diagram of the system:
Circuit:
In order to do the first setup of our device, I recommend that you follow the official Microchip guide since it is a very simple process to perform in the case of AWS.
You will need the following file to correctly configure AWS. https://www.microchip.com/design-centers/internet-of-things/iot-dev-kits/iot-provision-tool
Microchip guide:
In this case you should see the data from the board arriving at AWS IoT as follows 1 every second:
For this I am obtaining the data from the EKG, I write down the number that appears as a topic and this number will serve us later to view the data on our website.
NOTE: By making a copy / paste in a notepad you can see the entire topic, AWS for aesthetics cuts it when you view it.
In order to program the microcontroller correctly, we have to know that the microcontroller is:
https://www.microchip.com/wwwproducts/en/ATmega4808
In order to correctly obtain an EKG reading and send it to AWS without losing data, we must take into consideration certain things:
1. The minimum sampling rate according to the AHA for an EKG is 150Hz [1].
- To solve this we made the sampling rate 150 Hz by programming an interrupt by Timer, making the microcontroller do this task 150 times per second.
// Interrupt Routine
ISR(TCA0_OVF_vect) {
free_running();
TCA0.SINGLE.INTFLAGS = TCA_SINGLE_OVF_bm;
}
...
// Enable Interrupt
// application_init(void) inside here
TCA0_init();
sei(); // Enable global interrupts by setting global interrupt enable bit in SREG
...
// Setup timer Interrupt function
void TCA0_init(void) {
/* enable overflow interrupt */
TCA0.SINGLE.INTCTRL = TCA_SINGLE_OVF_bm;
/* set Normal mode */
TCA0.SINGLE.CTRLB = TCA_SINGLE_WGMODE_NORMAL_gc;
/* disable event counting */
TCA0.SINGLE.EVCTRL &= ~(TCA_SINGLE_CNTEI_bm);
/* set the period */
TCA0.SINGLE.PER = PERIOD_EXAMPLE_VALUE;
TCA0.SINGLE.CTRLA = TCA_SINGLE_CLKSEL_DIV1024_gc /* set clock source (sys_clk/1024) */
| TCA_SINGLE_ENABLE_bm; /* start timer */
}
2. The microcontroller will send approximately one data every second.
- This was done by altering the speed with which the routine is performed in the main code.
#define MAIN_DATATASK_INTERVAL 1000L
EKG data collection cannot be stopped while data is being sent to the cloud.
The ADC was made to work with free_running to avoid read interruptions when sending data to the cloud.
// ADC Freeruning read function
void free_running()
{
while (1)
{
if (ADC0_IsConversionDone())
{
if (adc_counter < sizeof array / sizeof array[0])
{
array[adc_counter] = ADC0.RES; adc_counter++;
}
break;
}
}
}
...
// Start ADC in Free runing Mode
// application_init(void) inside here
ADC0.CTRLA |= 1 << ADC_FREERUN_bp;
ADC0_StartConversion(ADC_CHANNEL);
For more details you can find the code in the following folder: https://github.com/altaga/EHM-Electrocardiography-Holter-Monitor/blob/main/MPLAB%20Project/AVRIoT.X/mcc_generated_files/application_manager.c
In turn, on the side of the device we put an NFC stamp to access the platform quickly from the smartphone.
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.
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
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 EKG signal that while not perfect, we can fix with a little processing on the web page.
WebPage SetupTo correctly configure the web page, create a file called aws-configuration.js in the following path Webapp \ src \ pages \ ecg and enter the AWSIoT credentials and the Cognito Identity Pool.
var awsConfiguration = {
poolId: "us-east-1:xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx", // 'YourCognitoIdentityPoolId'
host:"xxxxxxxxxxxxxxxxxx.iot.us-east-1.amazonaws.com", // 'YourAwsIoTEndpoint', e.g. 'prefix.iot.us-east-1.amazonaws.com'
region: "us-east-1" // 'YourAwsRegion', e.g. 'us-east-1'
};
module.exports = awsConfiguration;
The web page was made using the ReactJS framework.
For the functionality of the website, two AWS SDKs for Javascript were used.
- For the access control of the web page to consume the AWSIoT resources https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/CognitoIdentity.html
- To be able to read the AWS IoT topic https://docs.aws.amazon.com/AWSJavaScriptSDK/latest/AWS/Iot.html
For the analysis of the EKG, a Lambda function was used with which we access via API and has been configured as a function with the [Heartpy] library (https://pypi.org/project/heartpy/).
For the style and frontend of the platform, the packages were used:
- ReactStrap: https://reactstrap.github.io/
- ChartJS: https://www.chartjs.org/
And for the platform deployment, a Github and AWS Amplify repository was used as a source.
The displayed web page has 2 important paths.
- The Index, which is the presentation letter of our application
- The EKG monitor, however this has something important. Depending on the sensor we want to visualize, we will have to specify it on the path according to the number we have received in AWS IoT.
The website has some special functions:
Real-time signal filtering
- Unfiltered signal:
- Filtered Signal:
The "Analyze EKG" function sends the unfiltered data received on the web page and sends it to our Lambda function to be analyzed by the HeartPy library and returns valuable data for physicians.
The SavePDF function saves the data on screen for record.
Platform Video:
Final ProductHolter Monitor Device with Case:
EKG lead wires and device:
EKG lead wires with Shirt:
Platform:
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.
ReferencesLinks:
Comments