Project in progress

e-Care Heart © GPL3+

E-health Prototype System for Cardiac Telemonitoring "Caring your heart anywhere"

  • 3,712 views
  • 1 comment
  • 23 respects

Components and supplies

Apps and online services

About this project

This project is the development of an e-health system for cardiac telemonitoring, using as monitoring system the development board LinkIt ONE, this one can be adapted to measure variables such as cardiac pulse, analyze it and through programmation determine if a person is having a heart attack, this information will activate an alarm that report to a person about the patient’s condition and its location, using the GPRS and GPS modules of the development board respectively. The LinkIt ONE can connect with the virtual platform UBIDOTS, to see the variable measured, the patient’s location and the alarms; keeping informed in all times to the person who cares the patient.  

As is shown in the first figure, an Arduino uno is using to obtain the data of Beats per Minute (bpm), using a pulse-oximeter that is connect to the e-health sensor platform to coupling the pulse-oximeter to the Arduino and obtain the Data. The LinkIt One is used as a monitoring system and also to post the data to UBIDOTS, here the data is visualized in a map to the GPS position and a numeric indicator to the beats per minute, also the events to alert about a person is having a cardiac attack, are created in UBIDOTS.

All the develop of this project is show in this document.

I. PROBLEM TO SOLVE

Actually there are some devices that help people with increased risk of cardiac infarct or who had prior cardiac events, such as the pacemaker, this one detects when the heart rate decreases at a too low rate, sending to the heart a stimulation signal according to a programmed frequency, until the heart beat again at a normal rate [1]; Devices like this are needed in critical cases, in which symptoms of bradycardia are detected, that is when the heart takes on a slower rhythm of heartbeats [2], this technology helps to prevent potentially fatal events, but the patient involved is who should call to the health center or any person who could help him, considering that for the patient may not always is easy make this things, this work proposes to develop an e-health prototype system for cardiac telemonitoring, that will be portable, economical and reliable.

This project is focus on diagnosing if a person is having a cardiac infarct and if so, notify immediately to anyone who has a close relationship with the person; to develop this system, the LinkIt ONE board of MediaTek company and the e-health sensor platform for Arduino UNO were used.

Some important features of the LinkIt ONE development board are that is programmed in the same way than an Arduino, also has modules of Global Position System (GPS) and WiFi communication[3], which will allows get the current location of the person at the time to have some form of cardiac arrhythmia and communicate this information through the network; as the development card enables communication with web tools, can be stored in the cloud the patient information, monitored variables, such as cardiac pulse; and generate alarms; the virtual platform that can handle this information is UBIDOTS, which is a company that provides cloud services for storing and making a basic analysis of information of variables measured in real time.

II. METHODOLOGY

a. WiFi COMMUNICATION

This is the first step to develop the project; for this section, the materials needed are a LinkIt ONE and the WiFi Antenna, as is shown in the next figure.

The code used to make the communication is in the attachments section. The result that indicate a correct wifi communication is shown in the next figure.

The second "OK" next to the "Connecting to site..." indicates that we have a wifi communication.

b. OBTAIN THE GPS INFORMATION

The second step was obtain the GPS latitude and longitude coordinates, to this section, I use as a guide the code in the UBIDOTS tutorials to post GPS information (http://ubidots.com/docs/devices/linkitone.html), the modificate code is in the section of attachments of this article, called "GPS AND PULSEOXIMETER".

The first part of the code "GPS AND PULSEOXIMETER" is to obtain the lecture of the pulse-oximeter sensor, this sensor provide the beats per minute (bpm), that will post in UBIDOTS.

The second part of the code is to obtain the latitude and longitude of GPS. The code has a detailed explanation.

c. POSTING DATA TO UBIDOTS

The code to post data to UBIDOTS is shown in the next figure.

Is important to notice that this is the code to post GPS data, and it has two variables to post (latitude and longitude), to send this data to UBIDOTS, is necessary use the "context" as is shown in the figure; in case that the data be just one value, it is send with the first part of the "String data" as is shown in the next figure.

This is the code to post the pulse-oximeter data, you can notice that the "String data" just have the part of value to post the data.

The results of data posted in UBIDOTS are show in the next figures.

d. CREATE AN EVENT IN UBIDOTS

To create an event in the UBIDOTS platform, is necessary following the steps as is shown in the next sequence.


First: You have to choose a Data Source, in this case I called "Monitoreo"

Second: Select the variable that will determinate when the execute the event

Third: Give the condition to the event, in this case the event is executing when the "PULSO_CARDIACO" is greater than 170 bpm, this condition means that a person is having a cardiac attack.

Fourth: Choose the way to communicate that an event is been executing, in this case I send a SMS to a cell-phone to communicate that the person is having a cardiac attack and I send the link when the person could see the GPS position of the patient in the map, as is show in the figure of the section "Posting data to UBIDOTS"

e. RESULTS

Actually the results obtained are that I can post the GPS and Cardiac Pulse data in UBIDOTS and it can be visualized as is show in the next figure.

With the data in UBIDOTS, were created two important events, the first is when the cardiac pulse is less than 30 bpm and the second is when the cardiac pulse is greater than 170 bpm; in both cases it indicates that the person who will have the dispositive for cardiac telemonitoring is having a cardiac attack and need help, so UBIDOTS generate an alarm message that is send by sms to a cell-phone.

f. CONCLUSIONS AND FUTURE WORK

Actually the prototype is no portable and is limited by the wifi signal, if a person is out of wifi coverage, the dispositive will not send new data.

In this moment the data has a delay of 5 seconds to update the data. Also the GPS position is limited, if the weather is cloudy, the GPS position is imprecise.

As future work:

  • The code to use GPRS communication will be implemented, this way the person will not limited to the wifi signal, and the GPRS signal has more coverture and this provide more confidence to use the dispositive.
  • This project must be approved by a specialist, to guarantee that the dispositive can be used by civil population with cardiacs problems.

REFERENCES

[1] Gutiérrez F. Efrén, “Evolución de los Marcapasos y de la Estimulación Eléctrica del Corazón”, Archivos de cardiología de México, México, vol. 75, n.3, 2005, Disponible en: < http://www.scielo.org.mx/scielo.php?script=sci_arttext&pid=S1405-99402005000300001&lng=es&nrm=iso>. ISSN 1405-9940.>

[2] Emerito M. Roncali. “Cuando el Corazón se Enferma”, Colección Instituto de la Salud. 1998. Disponible en: < https://goo.gl/MKjuQV >. ISBN: 978-0-939193-41-7.

[3] Media Tek Labs. “MediaTek LinkIt ONE Developer’s Guide”, version 1.3, 2015, Disponible en: <http://labs.mediatek.com/fileMedia/download/5fed7907-b2ba-4000-bcb2-016a332a49fd>.

Code

GPS_AND_PULSEOXIMETER.inoC/C++
This is the code to obtain de GPS coordinates and to communicate the
Link It ONE to the e-health card for Arduino UNO to obtain the cardiac pulse signal.
This data is send and posted in UBIDOTS
/*This is the code to obtain de GPS coordinates and to communicate the
Link It ONE to the e-health card for Arduino UNO to obtain the cardiac pulse signal.
This data is send and posted in UBIDOTS*/

//Libraries
#include <LGPS.h>
#include <LTask.h>
#include <LWiFi.h>
#include <LWiFiClient.h>

//WiFi Configuration
#define WIFI_AP "bisemic"//put your network name
#define WIFI_PASSWORD "bisemick305"//put your network password
#define WIFI_AUTH LWIFI_WPA  //network configuration->LWIFI_OPEN, LWIFI_WPA, or LWIFI_WEP.

//Variables
#define SITE_URL "things.ubidots.com"
#define TOKEN "XIBVJIamJMfxVEcJTUiXUFihiqOBoP"//This token is generate on your ubidots profile
#define IDGPS "5644e9d57625425c3e6219e3"//variable id->it is generate at the ubidots's dashboard
#define IDPULSO "5659dc1c7625423b5e627699"//variable id->it is generate at the ubidots's dashboard

LWiFiClient c;
gpsSentenceInfoStruct info;
String Location = "";          // Will build the Location string here. this is for the GPS information

//configuration to read the pulse-oximeter data
#include<HardwareSerial.h>
#include<UARTClass.h>
int dato=0;

void setup() {
  Serial1.begin(9600);//this serial is the serial port to communicate the Link It ONE with the Arduino UNO and transmit the data
  Serial.begin(9600);
  LGPS.powerOn();
  Serial.println("LGPS Power on, and waiting ..."); 

//***************WiFi Conection****************//////
  LWiFi.begin();
  LTask.begin();
  Serial.println();
  Serial.println("Connecting to AP...");
//This secction is to conect to the network
  if(LWiFi.connectWPA(WIFI_AP,WIFI_PASSWORD)<0)
    {
      Serial.println("FAIL!");
      return;
    }
    Serial.println("OK");
//This secction is to conect to the site
    Serial.print("Connecting to site...");
    if(!c.connect(SITE_URL, 80))
      {
        Serial.println("FAIL!");
        return;
      }
      Serial.println("OK");
  // send HTTP request, ends with 2 CR/LF
  Serial.println("send HTTP GET request");
  c.println("GET / HTTP/1.1");
  c.println("Host: " SITE_URL);
  c.println("Connection: close");
  c.println();
//*****************END OF WIFI CONECTION***********//
}

void loop() {
  Serial.println("LGPS loop"); 
  LGPS.getData(&info);
  //*******ParseLocation is the function to obtain the GPS coordinates**********//
   ParseLocation((const char*)info.GPGGA);

   
//**************pulse-oximeter lecture********************//
  dato=Serial1.read();
    Serial.println("EMG:");
    Serial.println(Serial1.read());
 //*******"datos_bpm" is the function to post the pulse-oximeter data in UBIDOTS
  datos_bpm(String(dato));
      delay(1000);
}

//////////************************FUNCTION PARSELOCATION****************///////
void ParseLocation(const char* GPGGAstr)
// Refer to http://www.gpsinformation.org/dale/nmea.htm#GGA
// Sample data: $GPGGA,123519,4807.038,N,01131.000,E,1,08,0.9,545.4,M,46.9,M,,*47
{
  char latarray[6];
  char longarray[6];
  int index = 0;
  Serial.println(GPGGAstr);
  Serial.print("Fix Quality: ");
  Serial.println(GPGGAstr[43]);
  if (GPGGAstr[43]=='0') {        //  This is the place in the sentence that shows Fix Quality 0 means no fix
    Serial.println("No GPS Fix");
    Location = "";           // No fix then no Location string
  }
  String GPSstring = String(GPGGAstr);
  for (int i=20; i<=26; i++) {         // We have to jump through some hoops here
    latarray[index] = GPGGAstr[i];     // we need to pick out the minutes from the char array
    index++;
  }
  float latdms = atof(latarray);        // and convert them to a float
  float lattitude = latdms/60;          // and convert that to decimal degrees
  String lattstring = String(lattitude,8);// Then put back into a string with 8 decimal position
  Location = "{\"lat\":";
  if(GPGGAstr[28] == 'S')Location = Location + "-";      
 Location=Location+ GPSstring.substring(19,20) + "." + lattstring.substring(2,10);
String  lat=GPSstring.substring(19,20) + "." + lattstring.substring(2,10);
  index = 0;
  for (int i=33; i<=38; i++) {         // And do the same thing for longitude
    longarray[index] = GPGGAstr[i];     // the good news is that the GPS data is fixed column
    index++;
  }
  float longdms = atof(longarray);        // and convert them to a float
  float longitude = longdms/60;          // and convert that to decimal degrees
  String longstring = String(longitude,8);// Then put back into a string with 8 decimal position
  Location=Location+"\"lng\":";
  if(GPGGAstr[41] == 'W') Location = Location + "-";
  if(GPGGAstr[30] == '0') {
    Location = Location+ GPSstring.substring(31,33) + "." + longstring.substring(2,10);
    String lng=GPSstring.substring(31,33) + "." + longstring.substring(2,10);
  //*******"dato_gps" is the function to post the GPS data
    dato_gps(lat,"-"+lng);
  }
  else {
    Location = Location+ GPSstring.substring(30,33) + "." + longstring.substring(2,10);
    String lng=GPSstring.substring(30,33) + "." + longstring.substring(2,10);
  //*******"dato_gps" is the function to post the GPS data
    dato_gps(lat,"-"+lng);
  }
Location=Location+"}";
     
}
/////////*************END OF PARSELOCATION FUNCTION**************////////////////////

//************GPS FUNCTION to post data*************
void dato_gps(String lat,String lng){
    Serial.println("Sending value to Ubidots...");
    LWiFiClient c;
  while (!c.connect(SITE_URL, 80))
  {    Serial.println("Retrying to connect...");
      delay(100);  }
//*****************Posting GPS data*******************//
double a=265;
  String valor=String(a);
  String data = "{\"value\":"+valor+",\"context\":{\"lat\":"+lat+",\"lng\":"+lng+"}}";
  String thisLength = String(data.length());
    // Build HTTP POST request
  c.print("POST /api/v1.6/variables/");
  c.print(IDGPS);
  c.print("/values?token=");
  c.print(TOKEN);
  c.println(" HTTP/1.1");
  c.println("Content-Type: application/json");
  c.println("Content-Length: " + thisLength);
  c.print("Host: ");
  c.println(SITE_URL);
  c.print("\n" + data);
  c.print(char(27));
  Serial.println(data);
 // read server response
  while (c){    Serial.print((char)c.read());  }
  c.stop(); 
}

//******************FUNCTION TO TRANSMIT THE PULXIOXIMETER DATA**************//
  void datos_bpm(String value){
   Serial.println("Sending value to Ubidots...");
   Serial.println(value);
  LWiFiClient c;
  while (!c.connect(SITE_URL, 80))
  {
    Serial.println("Retrying to connect...");
    delay(100);
  }
  String data = "{\"value\":"+ value + "}";
  String thisLength = String(data.length());
  // Build HTTP POST request
  c.print("POST /api/v1.6/variables/");
  c.print(IDPULSO);
  c.print("/values?token=");
  c.print(TOKEN);
  c.println(" HTTP/1.1");
  c.println("Content-Type: application/json");
  c.println("Content-Length: " + thisLength);
  c.print("Host: ");
  c.println(SITE_URL);
  c.print("\n" + data);
  c.print(char(26)); 
  // read server response
  while (c){
    Serial.print((char)c.read());
  }
  c.stop();
}
WIFI_communication.inoC/C++
This is the code to connect by wifi to a network
/*
This is the code to connect to wifi 
 */
//Libaries
#include <LTask.h>
#include <LWiFi.h>
#include <LWiFiClient.h>

//Wifi Configuration
#define WIFI_AP "bisemic"//network name
#define WIFI_PASSWORD "bisemick305"//network password
#define WIFI_AUTH LWIFI_WPA  // network configuration-> LWIFI_OPEN, LWIFI_WPA, or LWIFI_WEP.

//web site to connect
#define SITE_URL "things.ubidots.com"
LWiFiClient c;

void setup()
{
  Serial.begin(9600);
  LWiFi.begin();  
  LTask.begin();
  
  Serial.println();
  Serial.println("Connecting to AP...");
  //Connecting to network
  if(LWiFi.connectWPA(WIFI_AP,WIFI_PASSWORD)<0)
    {
      Serial.println("FAIL!");
      return;
    }
    Serial.println("OK");
   //connecting to web site
    Serial.print("Connecting to site...");
    if(!c.connect(SITE_URL, 80))
      {
        Serial.println("FAIL!");
        return;
      }
      Serial.println("OK");
         
  // send HTTP request, ends with 2 CR/LF
  Serial.println("send HTTP GET request");
  c.println("GET / HTTP/1.1");
  c.println("Host: " SITE_URL);
  c.println("Connection: close");
  c.println();
}

void loop()
{

}
PULSE-OXIMETER_LECTURE.inoC/C++
This code is to obtain the pulse-oximeter data and send
it to a serial port created, called "Serial1" to the LinkIt ONE
/*This code is to obtain the pulse-oximeter data and send
it to a serial port created, called "Serial1" to the LinkIt ONE
This code was developed by: Nelson F. Monroy R. from Bucaramanga-Colombia 
NOTE: The libraries were modificated to this purpose*/
#include <SoftwareSerial.h>
#include <eHealth.h>
#include <PinChangeInt.h>

SoftwareSerial serial1(4,5);//Pin 4 to RX, and pin 5 to TX
int cont=0, SPO2,BPM, dato;

void setup() {
serial1.begin(9600);
eHealth.initPulsioximeter();
PCintPort::attachInterrupt(6,readPulsioximeter,RISING);  
}

void loop() {
    BPM= eHealth.getBPM();//The BPM data is the data of cardiac pulse
    serial1.write(BPM);
    delay(5000);
}
void readPulsioximeter()
{
  cont ++;
  if (cont==20)
  {
  eHealth.readPulsioximeter();
  cont=0;
  }
}

Schematics

Required Devices
This image shows all the devices used and how they should be connected, the board circuit is only a CMOS connected as buffer to make that the maximum output voltage of the Arduino is not greater than 3.3v.
Resultado%20final

Comments

Author

Foto c v
Laura Juliana Vargas Escobar
  • 1 project
  • 11 followers

Additional contributors

  • Guided me in the development of the project by Mgs. Sergio Alexander Salinas
  • Developed the code for pulse-oximeter communication by Ing. Nelson Fernando Monroy Rios

Published on

December 10, 2015

Members who respect this project

11866301 916219668444234 3650420540137885512 nDefaultDefaultRabbitImg 20151114 16291610906343 10152744779397239 7675779777721189621 nDefaultDefault

and 15 others

See similar projects
you might like

Similar projects you might like

WIZnet S2E Deadbolts

Project tutorial by S2E Lock

  • 398 views
  • 2 comments
  • 2 respects

Super-Go: An Industrial IoT bot

Project tutorial by KS

  • 61 views
  • 2 comments
  • 0 respects

High Precision Scale with Arduino

Project showcase by mPelectronic

  • 522 views
  • 3 comments
  • 11 respects

GPS Tracking System for Vehicles

Project showcase by Sustainable Living Lab

  • 1,632 views
  • 0 comments
  • 5 respects

DIY Photogrammetry Turntable

Project showcase by alfiosky4

  • 3,372 views
  • 5 comments
  • 10 respects

Automatic Watering System

Project tutorial by Manson Hau

  • 4,981 views
  • 11 comments
  • 27 respects
Add projectSign up / Login