Project tutorial
BIO-Smart Wear

BIO-Smart Wear © MIT

My application is based on the use of this kind of devices to connect our body to the cloud.

  • 5,231 views
  • 1 comment
  • 9 respects

Components and supplies

Necessary tools and machines

Sport T shirt
09507 01
Soldering iron (generic)
ECG Electrode

Apps and online services

About this project

Recently, design of wearable devices has increased due to the technological revolution of the internet of things (IoT). One of the requirements of IoT that the devices should be small and low-power. Processors and their evolution of the last years, have become a key piece for IoT devices. Intel Edison and Intel Curie are the most recognized technologies in the market and provide all requirements that suit to IoT.

My application is based on this kind of devices to connect the human body to the cloud. The technological market is invaded of a great variety of wearable devices like smart watch or glasses that do not use their full potential in IoT. These devices can only acquire a litter bit part of our Bio-Information. It could be used to monitor our vital sign and create other application to introduce the human into the IoT. For example, The Bio-Smart Wear can be used to monitor patients in their own home or nursing. The future expectations are that all people are connected to the cloud, monitoring their vital signs so that diseases can be detected through clothing.

My Bio-SmartWear allows to acquire ECG signal, breathing frequency, body temperature and heart rate. My project is based on an Arduino-101 technology taking advantage of the Ble-Bluetooth and its small size.

Arduino 101 would capture the data using different sensors, as show in the next figure.

The T-shirt has three sensors: three ECG electrodes, one photo-plethysmography sensor and one temperature sensor. The ECG electrodes need to have a specific configuration such as that described by einthoven triangle.

Using this configuration and an operational amplifier as AD8232 (Figure), it could be possible acquire the ECG signal.

The photoplethysmography sensor uses the absorption of light to calculate the beat heart rate.

Nevertheless, it is possible change this sensor by a AXREFDES117 to calculate the SPO2. As temperature sensor I use a LM35 ensor which is placed under the armpit. The Arduino 101 is used to acquire the information and is embedded into the T-shirt showed in the next figure:

Signals:

However it is necessary to incorporate a second hardware in order to introduce an intelligent application. This second hardware is an Intel Edison which is a Bluetooth server and act as a bridge between the smart wear and some artificial intelligent entities. Once data has been captured through Arduino 101 and sent to the Bluetooth server (intel Edisons), it is received by an intelligent entity or agent.

This agent is the representation of the human into the intelligent virtual environment or IVE. Inside the IVE co-exist many agents representing humans and interacting with others agents. The agent acting as virtual representation of the human will have a direct connection with the smart wear. This connection allows to the agent know the human vital sign and be at the same time a container of machine learning algorithm that helps to predict some issues.

To create this IVE I use tools developed for my master degree project and is called JaCalIVE (). JaCalIVE is a tool that allows to create complex simulations working with multi agent systems. In JaCalIVe we can define the entities that live into an IVE in three blocks : situated, not situated and physical, as is showed in the next figure.

In this project I use the physical entities such as the human immersed agent. This agent is a representation of the human into the IVE, i.e. the agent is connected to the human. In this case the connection is through the Arduino 101. The agent capture the information sending by the Arduino 101 and it knows the state of the human. The next figure show how the Arduino 101 send the information to the human immersed agent.

The next step is to stablish communication between other entities.One a possible entity is a hospital. This hospital can be represented as an agent and if the human immersed agent detects an anomaly in the vital sign, it sends a message to the hospital agent in order to help to the patient. Nevertheless, this part does not take in to account in this project as well as the detection of abnormalities in vital signs is an important topic that I am currently working on.

Reference

  • J.A. Rincon, Emilia Garcia, V. Julian and C. Carrascosa
  • Developing Adaptive Agents Situated in Intelligent Virtual Environments
  • International Conference on Hybrid Artificial Intelligence Systems pp. 98-109. (2014)
  • J.A. Rincon, C. Carrascosa and Emilia Garcia
  • Developing Intelligent Virtual Environments using MAM5 Meta-Model
  • International Conference on Practical Applications of Agents and Multi-Agent Systems pp. 379-382. (2014)
  • J.A. Rincon, Emilia Garcia, V. Julian and C. Carrascosa
  • From Virtual to Real, Human Interaction as a Validation Process for IVEs
  • 9th International Symposium on Intelligent Distributed Computing - IDC'2015 pp. 49-59. (2015)
  • J.A. Rincon, J. L. Poza, V. Julian, J. L. Posadas and C. Carrascosa
  • Extending MAM5 Meta-Model and JaCalIV E Framework to Integrate Smart Devices from Real Environments Plos ONE N. 10.1371/jo pp. 1-27. (2016)

Code

Arduino 101 Read signalsArduino
#include <CurieBLE.h>
#include <CurieIMU.h>



// Create my own UUIDs; used https://www.uuidgenerator.net/
#define SMARTWEAR_SERVICE_UUID "2947ac9e-fc38-11e5-86aa-5e5517507c66"
#define AX_CHAR_UUID "2947af14-fc38-11e5-86aa-5e5517507c66"
#define AY_CHAR_UUID "2947b090-fc38-11e5-86aa-5e5517507c66"
#define AZ_CHAR_UUID "2947b180-fc38-11e5-86aa-5e5517507c66"
#define GX_CHAR_UUID "2947b252-fc38-11e5-86aa-5e5517507c66"
#define GY_CHAR_UUID "2947b5ae-fc38-11e5-86aa-5e5517507c66"
#define GZ_CHAR_UUID "2947b694-fc38-11e5-86aa-5e5517507c66"
#define ECG_CHAR_UUID "0c3f3508-089a-11e7-93ae-92361f002671"
#define PPG_CHAR_UUID "0c3f38fa-089a-11e7-93ae-92361f002671"
#define TEMP_CHAR_UUID "0c3f38fB-089a-11e7-93ae-92361f002671"

#define TIMER2VAL (1024/(SAMPFREQ))
#define SAMPFREQ 256

// Arduino 101 acts as a BLE peripheral
BLEPeripheral blePeripheral;

// IMU data is registered as a BLE service
BLEService imuService(SMARTWEAR_SERVICE_UUID);

// Each IMU data point is its own characteristic
BLEIntCharacteristic axChar(AX_CHAR_UUID, BLERead | BLENotify);
BLEIntCharacteristic ayChar(AY_CHAR_UUID, BLERead | BLENotify);
BLEIntCharacteristic azChar(AZ_CHAR_UUID, BLERead | BLENotify);
BLEIntCharacteristic gxChar(GX_CHAR_UUID, BLERead | BLENotify);
BLEIntCharacteristic gyChar(GY_CHAR_UUID, BLERead | BLENotify);
BLEIntCharacteristic gzChar(GZ_CHAR_UUID, BLERead | BLENotify);
BLEIntCharacteristic ecgChar(ECG_CHAR_UUID, BLERead | BLENotify);
BLEIntCharacteristic ppgChar(PPG_CHAR_UUID, BLERead | BLENotify);
BLEIntCharacteristic tempChar(TEMP_CHAR_UUID, BLERead | BLENotify);


// Assign pin to indicate BLE connection
const int INDICATOR_PIN = 13;

int ax = 0;
int ay = 0;
int az = 0;
int gx = 0;
int gy = 0;
int gz = 0;
int ecg = 0;
int ppg = 0;
int counter = 0;
float celsius = 0.0;
long previousMillis = 0;

void setup() {

  // Initialize IMU
  Serial.println("Initializing IMU...");
  CurieIMU.begin();
  CurieIMU.autoCalibrateGyroOffset();
  CurieIMU.autoCalibrateAccelerometerOffset(X_AXIS, 0);
  CurieIMU.autoCalibrateAccelerometerOffset(Y_AXIS, 0);
  CurieIMU.autoCalibrateAccelerometerOffset(Z_AXIS, 1);

  // Initialize BLE peripheral
  blePeripheral.setLocalName("SmartWear");
  blePeripheral.setAdvertisedServiceUuid(imuService.uuid());
  blePeripheral.addAttribute(imuService);
  blePeripheral.addAttribute(axChar);
  blePeripheral.addAttribute(ayChar);
  blePeripheral.addAttribute(azChar);
  blePeripheral.addAttribute(gxChar);
  blePeripheral.addAttribute(gyChar);
  blePeripheral.addAttribute(gzChar);
  blePeripheral.addAttribute(ecgChar);
  blePeripheral.addAttribute(ppgChar);
  blePeripheral.addAttribute(tempChar);

  // Set initial values
  axChar.setValue(ax);
  ayChar.setValue(ay);
  azChar.setValue(az);
  gxChar.setValue(gx);
  gyChar.setValue(gy);
  gzChar.setValue(gz);

  ecgChar.setValue(ecg);
  ppgChar.setValue(ppg);

  tempChar.setValue(celsius);


  // Now, activate the BLE peripheral
  blePeripheral.begin();
  Serial.println("Bluetooth device active, waiting for connections...");
}

void loop() {
  // Check if the connection to the central is active or not
  BLECentral central = blePeripheral.central();

  if (central) {
    Serial.print("Connected to central: ");
    Serial.println(central.address());
    digitalWrite(INDICATOR_PIN, HIGH);

    while (central.connected()) {
      updateImuData();
      updatePPG();
      updateECG();
      updateTemperature();
    }

    Serial.print("Disconnected from central: ");
    Serial.println(central.address());
    digitalWrite(INDICATOR_PIN, LOW);
  }
}


void updateECG() {
  int valueECG = analogRead(1);
  ecgChar.setValue(valueECG);
}

void updatePPG() {
  int valuePPG = analogRead(0);
  ppgChar.setValue(valuePPG);
}

void updateTemperature() {
  int value = analogRead(2);
  float millivolts = (value / 1023.0) * 5000;
  celsius = millivolts / 10;
  tempChar.setValue(celsius);
}

void updateImuData() {
  CurieIMU.readMotionSensor(ax, ay, az, gx, gy, gz);

  axChar.setValue(ax);
  ayChar.setValue(ay);
  azChar.setValue(az);
  gxChar.setValue(gx);
  gyChar.setValue(gy);
  gzChar.setValue(gz);
  //gzChar.setValue('\n');

}
Intel Edison Bluetooth ServerJavaScript
var noble = require('noble');

// These should correspond to the peripheral's service
var IMU_SERVICE_UUID = '2947ac9efc3811e586aa5e5517507c66';

var ECG_CHAR_UUID = "2947af14-fc38-11e5-86aa-5e5517507c66"
var PPG_CHAR_UUID = "2947b090-fc38-11e5-86aa-5e5517507c66"
var AX_CHAR_UUID = "0c3f3508-089a-11e7-93ae-92361f002671"
var AY_CHAR_UUID = "0c3f38fa-089a-11e7-93ae-92361f002671"
var AZ_CHAR_UUID = "2947b180-fc38-11e5-86aa-5e5517507c66"
var GX_CHAR_UUID = "2947b252-fc38-11e5-86aa-5e5517507c66"
var GY_CHAR_UUID = "2947b5ae-fc38-11e5-86aa-5e5517507c66"
var GZ_CHAR_UUID = "2947b694-fc38-11e5-86aa-5e5517507c66"


var net = require('net');
var client = net.connect(4445, function() { //'connect' listener
  console.log('client connected');
  var Data =  "SDA_0X02:ECG,PPG,accx,accy,accz,Gyro,gyrox,gyroy,gyroz";
  client.write(Data);
  client.write('\r\n')
  
});

noble.on('stateChange', function(state) {
  if(state === 'poweredOn') {
    console.log('Start BLE scan...')
    noble.startScanning([IMU_SERVICE_UUID], false);
  }
  else {
    console.log('Cannot scan... state is not poweredOn')
    noble.stopScanning();
  }
});

// Discover the peripheral's IMU service and corresponding characteristics
// Then, emit each data point on the socket stream
noble.on('discover', function(peripheral) {
  peripheral.connect(function(error) {
    console.log('Connected to peripheral: ' + peripheral.uuid);
    peripheral.discoverServices([IMU_SERVICE_UUID], function(error, services) {
      var imuService = services[0];
      console.log('Discovered IMU service');

      imuService.discoverCharacteristics([], function(error, characteristics) {
		  characteristics.forEach(function(characteristic) {
			console.log('discovered characteristics');
			// Assign Characteristics
			var characteristic_ECG = characteristics[0];
			var characteristic_PPG = characteristics[1];
			var characteristic_accX = characteristics[2];
			var characteristic_accY = characteristics[3];
			var characteristic_accZ = characteristics[4];
			var characteristic_gX = characteristics[5];
			var characteristic_gY = characteristics[6];
			var characteristic_gz = characteristics[7];
			
			
			// Subscribe to each characteristic
			characteristic_ECG.subscribe(function(error) {
			  if(error) console.log(error);
			});

			characteristic_PPG.subscribe(function(error) {
			  if(error) console.log(error);
			});

			characteristic_accX.subscribe(function(error) {
			  if(error) console.log(error);
			});

			characteristic_accY.subscribe(function(error) {
			  if(error) console.log(error);
			});		
			
			characteristic_accZ.subscribe(function(error) {
			  if(error) console.log(error);
			});
			
			characteristic_gX.subscribe(function(error) {
			  if(error) console.log(error);
			});

			characteristic_gY.subscribe(function(error) {
			  if(error) console.log(error);
			});		
			
			characteristic_gZ.subscribe(function(error) {
			  if(error) console.log(error);
			});
			
			writeSensorData(characteristic) ;
		
		
        });
      });
    });
  });
});

function getSocketLabel(uuid) {
  var label = null;

  if(uuid == AX_CHAR_UUID) {
    label = 'ax:edison';
  }
  else if(uuid == AY_CHAR_UUID) {
    label = 'ay:edison';
  }
  else if(uuid == AZ_CHAR_UUID) {
    label = 'az:edison';
  }
  else if(uuid == GX_CHAR_UUID) {
    label = 'gx:edison';
  }
  else if(uuid == GY_CHAR_UUID) {
    label = 'gy:edison';
  }
  else if(uuid == GZ_CHAR_UUID) {
    label = 'ecg:edison';
  }
  else if(uuid == ECG_CHAR_UUID) {
    label = 'gz:edison';
  }
  else if(uuid == PPG_CHAR_UUID) {
    label = 'ppg:edison';
  }

  return label;
}


function writeSensorData(characteristic) {
  var socketLabel = getSocketLabel(characteristic.uuid);
  console.log(socketLabel);

  characteristic.on('read', function(data) {
	client.write(socketLabel + " " + data.readUInt8(0));
	client.write('\r\n')
  
    //socket.emit(socketLabel, data.readUInt8(0));
  });

  characteristic.notify('true', function(error) { if (error) throw error; });
}

Schematics

Circuit
circuit_sVbIq8Xc5h.fzz

Comments

Similar projects you might like

Handheld Infinity Kaleidoscope Group Kit

Project tutorial by Lucas Ainsworth

  • 8,589 views
  • 4 comments
  • 63 respects

Wolf: Search and Rescue Multi-Terrain Robot

Project tutorial by Husky Mai

  • 7,426 views
  • 3 comments
  • 46 respects

J.A.R.V.I.S. : A Virtual Home Assistant

Project tutorial by Team Blitzkrieg

  • 39,739 views
  • 14 comments
  • 225 respects

Arduino101 / tinyTILE BLE: Match-Making Sunglasses

Project tutorial by Kitty Yeung

  • 11,335 views
  • 2 comments
  • 35 respects

Intel Arduino 101 BLE Blynk Tank

Project tutorial by Johnathan Hottell

  • 10,437 views
  • 6 comments
  • 41 respects

Arduino 101 - Intel Curie Pattern Matching Dress

Project tutorial by Kitty Yeung

  • 9,525 views
  • 17 comments
  • 51 respects
Add projectSign up / Login