Wearable wristband for the monitoring of elderly healthcare

Healthcare for elder people is an important concern. We want to create a wristband to monitor from distance the health conditions of elders.

IntermediateFull instructions provided1,418
Wearable wristband for the monitoring of elderly healthcare

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Raspberry Pi 3 Model B
Raspberry Pi 3 Model B
×1
6 DOF Sensor - MPU6050
DFRobot 6 DOF Sensor - MPU6050
×1
Replacement watch strap
×1
Battery, 3.7 V
Battery, 3.7 V
×1

Software apps and online services

Arduino IDE
Arduino IDE
Raspbian
Raspberry Pi Raspbian
Visual Studio 2015
Microsoft Visual Studio 2015
oneM2M

Hand tools and fabrication machines

Soldering iron (generic)
Soldering iron (generic)

Story

Read more

Code

ESP32 Arduino program - WiFi connection and acquisition of acceleration/temperature

Arduino
This program enables the WiFi connection of the MCU ESP32 and sends the values of the acceleration and temperature through the HTTP IP protocol to the gateway (raspberry Pi). More specifically, we use the HTTP POST request to the data container available on the oneM2M mn-cse resource.
/*  

This program enables the WiFi connection of the MCU ESP32 and sends the values of the acceleration and temperature, through the HTTP IP protocol. 

*/
#include <Wire.h>
#include <Adafruit_MPU6050.h>
#include <Adafruit_Sensor.h>
Adafruit_MPU6050 mpu;

#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
#include <string>
#include <stdio.h>
#include<stdlib.h>
using namespace std;

#define SERVER_IP "172.20.10.4:8282" // MN-CSE (RASPBERRY) IP Adress

#ifndef STASSID
#define STASSID "iPhone de Chadi" // ID of the Local WiFi network 
#define STAPSK  "ChadiA98" // Password for the connection to Local WiFi network
#endif

void setup() {
  Wire.begin();
  Serial.begin(115200); // Baudrate
  
  while(!Serial);
  delay(100);

  Serial.println("Adafruit MPU6050 test!"); // The temperature, the acceleration and the rotation sensors are part of an Arduino integrated circuit called the MPU6050 which is connected to the MCU ESP32 pins. 
 
    // Try to initialize the integrated sensors (accelerometer, gyroscope and temperature) through I2C communication. 
  if (!mpu.begin()) {
    Serial.println("Failed to find MPU6050 chip");
    while (1) {
      delay(10);
    }
  }

  Serial.println();
  Serial.println();
  Serial.println();

  WiFi.begin(STASSID, STAPSK); // WiFi protocol - the programm will not start until the WiFi connection has been set. 

  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected! IP address: ");
  Serial.println(WiFi.localIP());


Serial.println("MPU6050 Found!");
  mpu.setAccelerometerRange(MPU6050_RANGE_8_G); // Calibration of the integrated sensors for acceleration
  Serial.print("Accelerometer range set to: ");
  switch (mpu.getAccelerometerRange()) {
  case MPU6050_RANGE_2_G:
    Serial.println("+-2G");
    break;
  case MPU6050_RANGE_4_G:
    Serial.println("+-4G");
    break;
  case MPU6050_RANGE_8_G:
    Serial.println("+-8G");
    break;
  case MPU6050_RANGE_16_G:
    Serial.println("+-16G");
    break;
  }
  mpu.setGyroRange(MPU6050_RANGE_500_DEG); // Calibration of the integrated sensors for gyroscope. 
  Serial.print("Gyro range set to: ");
  switch (mpu.getGyroRange()) {
  case MPU6050_RANGE_250_DEG:
    Serial.println("+- 250 deg/s");
    break;
  case MPU6050_RANGE_500_DEG:
    Serial.println("+- 500 deg/s");
    break;
  case MPU6050_RANGE_1000_DEG:
    Serial.println("+- 1000 deg/s");
    break;
  case MPU6050_RANGE_2000_DEG:
    Serial.println("+- 2000 deg/s");
    break;
  }

  mpu.setFilterBandwidth(MPU6050_BAND_21_HZ); // Select the filter bandwidth for the signals
  Serial.print("Filter bandwidth set to: ");
  switch (mpu.getFilterBandwidth()) {
  case MPU6050_BAND_260_HZ:
    Serial.println("260 Hz");
    break;
  case MPU6050_BAND_184_HZ:
    Serial.println("184 Hz");
    break;
  case MPU6050_BAND_94_HZ:
    Serial.println("94 Hz");
    break;
  case MPU6050_BAND_44_HZ:
    Serial.println("44 Hz");
    break;
  case MPU6050_BAND_21_HZ:
    Serial.println("21 Hz");
    break;
  case MPU6050_BAND_10_HZ:
    Serial.println("10 Hz");
    break;
  case MPU6050_BAND_5_HZ:
    Serial.println("5 Hz");
    break;
  }
  Serial.println("");
  delay(5000); // valeur initiale a 100ms mais je veux voir l'affichage du setup donc 5000ms
}


void loop() {

/* Get new sensor events with the readings */
  sensors_event_t a, g, temp; // the variable "a" will contain the acceleration, "g" the rotation, "temp" the temperature
  mpu.getEvent(&a, &g, &temp); // The MPU6050 reads the analog values and stores them into a, g and temp. 


String acceleration_x = String (a.acceleration.x,1); // Convert from integer to string
String acceleration_y = String (a.acceleration.y,1);
String acceleration_z = String (a.acceleration.z,1);

String temperature = String (temp.temperature,2);

  Serial.println("");
  delay(500);


  if ((WiFi.status() == WL_CONNECTED)) {

    WiFiClient client;  // wait for WiFi connection


   // HTTP REQUEST TO POST THE TEMPERATURE
    HTTPClient http;
    Serial.print("[HTTP] begin...\n");
    http.begin(client, "http://" SERVER_IP "/~/mn-cse/cnt-623708435"); // configure the HTTP request with the url of the Data Container on the mn-cse
    http.addHeader("X-M2M-Origin","admin:admin");
    http.addHeader("Content-Type", "application/xml;ty=4"); 
    Serial.print("[HTTP] POST...\n");
    // start connection and send HTTP header and body
    int httpCode = http.POST(String("<m2m:cin xmlns:m2m=\"http://www.onem2m.org/xml/protocols\"> <cnf>message</cnf> <con> &lt;obj&gt; &lt;int name=&quot;data&quot; val=&quot;") + temperature + String("&quot;/&gt; &lt;/obj&gt;  </con> </m2m:cin>"));
    // httpCode will be negative on error
    if (httpCode > 0) {
      // HTTP header has been send and Server response header has been handled
      Serial.printf("[HTTP] POST... code: %d\n", httpCode);
      Serial.println(temperature);
      // file found at server
      if (httpCode == HTTP_CODE_OK) {
        const String& payload = http.getString();
        Serial.println("received payload:\n<<");
        Serial.println(payload);
        Serial.println(">>");
      }
    } else {
      Serial.printf("[HTTP] POST... failed, error: %s\n", http.errorToString(httpCode).c_str());
    }

    http.end();
      delay (100) ;
      

 // HTTP REQUEST TO POST THE ACCELERATION
    HTTPClient http_acceleration;
    Serial.print("[HTTP] begin...\n");
    // configure traged server and url
    http_acceleration.begin(client, "http://" SERVER_IP "/~/mn-cse/cnt-800110039"); //HTTP
    http_acceleration.addHeader("X-M2M-Origin","admin:admin");
    http_acceleration.addHeader("Content-Type", "application/xml;ty=4");
    Serial.print("[HTTP] POST...\n");
    // start connection and send HTTP header and body
    int httpCode_acceleration = http_acceleration.POST(String("<m2m:cin xmlns:m2m=\"http://www.onem2m.org/xml/protocols\"> <cnf>message</cnf> <con> &lt;obj&gt; &lt;int name=&quot;data&quot; val=&quot;") + acceleration_z + String("&quot;/&gt; &lt;/obj&gt;  </con> </m2m:cin>"));
    // httpCode will be negative on error
    if (httpCode_acceleration > 0) {
      // HTTP header has been send and Server response header has been handled
      Serial.printf("[HTTP] POST... code: %d\n", httpCode);
      Serial.println("chute" + acceleration_z);
      // file found at server
      if (httpCode_acceleration == HTTP_CODE_OK) {
        const String& payload = http_acceleration.getString();
        Serial.println("received payload:\n<<");
        Serial.println(payload);
        Serial.println(">>");
      }
    } 
   else {
      Serial.printf("[HTTP] POST... failed, error: %s\n", http_acceleration.errorToString(httpCode).c_str());
   }

    http_acceleration.end();
    delay(100);
 
Serial.println(" ") ;
Serial.println(" ");
delay(100);
}
}

IN-CSE OM2M platform

It is the subpart of the Infrastructure Node that will be running, along with the backend Node JS server, on the Infrastructure Node host. This IN-CSE platform has to be runned before all others programs

Back-End : Node JS Server (a sub part of the IN-CSE node)

It is a server program that acts like an interface between the Middle Node and the Web User application. This Node JS server needs to be runned on the same machine than the IN-CSE platform. This Node JS server aims at sending notifications to the web user application whenever a new data for a specific patient has been collected on the Middle Node. This server susbribes to the Middle Node by requesting the OneM2M Infrastructure Node platform. In terms of architecture, this server program runs on the Infrastructure Node host

The Middle Node of the OM2M platform

This Middle Node is the gateway that stores the data collected by the sensors. Right after storing the data, this gateway sends the data to the Infrastructure Node. We already set up the AE, CTs and ACPIs required for the project

Front-end : User Web Application

A Web Monitoring application that displays in real time the data (temperature and acceleration) of the different patients. Depending on our login and password, we can have access to different patients' data

Credits

Benjamin Cadot

Benjamin Cadot

1 project • 0 followers
François SAILLARD

François SAILLARD

1 project • 0 followers
Redouane Amour

Redouane Amour

1 project • 0 followers
Chadi Amour

Chadi Amour

1 project • 0 followers
Paul Faure

Paul Faure

1 project • 0 followers
Andreas Kraft

Andreas Kraft

34 projects • 12 followers
IoT & connected home architect and developer. Ask me about oneM2M.
SeungMyeong Jeong

SeungMyeong Jeong

34 projects • 12 followers
Bob Flynn

Bob Flynn

32 projects • 13 followers
Miguel Angel Reina Ortega

Miguel Angel Reina Ortega

35 projects • 7 followers
Laurent Velez

Laurent Velez

18 projects • 6 followers
Samir Medjiah

Samir Medjiah

21 projects • 14 followers
Xavier Piednoir

Xavier Piednoir

26 projects • 6 followers
Wonbae Son

Wonbae Son

32 projects • 5 followers
안일엽

안일엽

17 projects • 1 follower
monteil

monteil

4 projects • 1 follower

Comments