Visualizando datos en Arduino y Netduino

 

GLCD

La biblioteca de e-salud incluye funciones para gestionar una pantalla gráfica LCD para la visualización de datos. La mochila de serie gráfica LCD está soldada a la 128×64 pixel LCD gráfico y proporciona al usuario una interfaz serial simple.
Caracteristicas:
Voltaje: 5V – 7V DC
Corriente: 220mA (luz de fondo al 100%)
De entrada: 0-5V, 115.200 bps (ajustable), 8 bits de datos, 1 bit de parada, sin paridad
Conexión del GLCD
Es necesario conectar el dispositivo con las señales en la posición correcta. El cable rojo que alimenta el módulo muestra cómo conectarlo.

Las medidas de los sensores se distribuye en tres pantallas que cambian al presionar el botón.

En la primera pantalla podemos ver algunos valores como la temperatura, el pulso o el oxígeno.

En la segunda pantalla se utiliza para la presentación de la onda de flujo de aire.

Cuando no se detecta la respiración, la pantalla se aconsejan de un RISQ de apnea.

La última pantalla recibe la onda del ECG.

Después de la tercera pantalla, si se presiona el botón de nuevo, volverá a la primera pantalla.
GLCD biblioteca
La biblioteca de la sanidad electrónica incluye todas las funciones necesarias para la gestión de la pantalla LCD y mostrar en tiempo real las medidas de sensores de datos. Para utilizar esta función, ante todo, debe incluir la biblioteca correspondiente.
 #include
Library functions:
  •  init() // Configure and initializes the LCD.
  •  InitValuesScreen() // Configure some parameters of the values screen.
  •  PrintValuesScreen() // It prints (refresh) the values of the sensors in the screen.
  •  InitECGScreen() // Configure some parameters of the ECG screen.
  •  printECGScreen() // It prints (refresh) the ECG wave in the LCD screen.
  •  initAirFlowScreen() //Configure some parameters of the AirFlow screen.
  •  PrintAirFlowScreen() // It prints (refresh) the AirFlow wave in the LCD screen.
Inicializar el LCD
Utilice la función de inicio en la configuración antes de empezar a usar la pantalla LCD.
Example
   {
    eHealthDisplay.init ();
    }
Los valores de la pantalla:
En esta pantalla se pueden ver algunos parámetros numéricos como el pulso, el oxígeno, la temperatura, amd una representación de la posición del cuerpo actual.
Inicialización
Esta pantalla debe ser inicializado con la siguiente función:
Example:
   {
    eHealthDisplay.initValuesScreen ();
    }
Obtención de datos
Para actualizar los valores de la LCD ejecutar la siguiente función.
Example
   {
    eHealthDisplay.printValuesScreen ();
    }
AirFlow pantalla:
En esta pantalla podemos ver el flujo de aire (respiración) de onda y el número de respiraciones por minuto. Esta pantalla incluye un asesor apnea cuando no respira.
Inicialización
Esta pantalla debe ser inicializado con la siguiente función:
Example:
   {
    eHealthDisplay.initAirFlowScreen ();
    }
Obtención de datos
Para actualizar los valores de la LCD ejecutar la siguiente función.
Example
   {
    eHealthDisplay.printAirFlowScreen ();
    }
ECGScreen:
Esta pantalla recibe la onda de electrocardiograma y mide la frecuencia de latido del corazón.
Inicialización
Esta pantalla debe ser inicializado con la siguiente función:
Example:
   {
    eHealthDisplay.initECGScreen ();
    }
Obtención de datos
Para actualizar los valores de la LCD ejecutar la siguiente función.
Example
   {
    eHealthDisplay.printECGScreen ();
    }
El pulsador:
La junta eHealth icludes un botón pulsador integrado para cambiar entre la pantalla o se puede utilizar un botón de lika purpuose general para cualquier aplicación. El botón pulsador se enruta al pin digital 4.
Example
Arduino
Sube el siguiente código para ver los datos en el GLCD:

 # Include
# Include
# Include

#define pushButton 4

uint8_t screenNumber = 1;
uint8_t buttonState;
uint8_t cont = 0;

void setup () {
Serial.begin(115200);
retardo (100);

//Configure and initializes the LCD.
eHealthDisplay.init();
retardo (100);
}

void loop () {

//Screen number one with the numerical sensor values and body position
//=========================================================================

eHealthDisplay.initValuesScreen();
retardo (100);

//Attach the inttruptions for using the pulsioximeter

PCintPort::attachInterrupt(6, readPulsioximeter, RISING);

while(screenNumber == 1) {
//It prints data sensor measures in the LCD.
buttonState = digitalRead(pushButton);
delay(10);

if(buttonState == 1) {
screenNumber++;
}

eHealthDisplay.printValuesScreen();
}

PCintPort::detachInterrupt(6);

//Screen number two wich represent the air flow wave
//=========================================================================

eHealthDisplay.initAirFlowScreen();

while( screenNumber == 2) {
buttonState = digitalRead(pushButton);
delay(10);

if(buttonState==1){
screenNumber++;
}

eHealthDisplay.printAirFlowScreen();
}

//Screen number three wich represent the ECG wave
//=========================================================================

eHealthDisplay.initECGScreen();

while( screenNumber == 3) {
buttonState = digitalRead(pushButton);
delay(10);

if(buttonState==1){
screenNumber++;
}

eHealthDisplay.printECGScreen();
}

screenNumber = 1;
delay(10);
}

//Include always this function for using the pulsioximeter sensor
//=========================================================================
void readPulsioximeter() {

cont ++;

if (cont == 50) {
//Get only one 50 measures to reduce the latency
eHealth.readPulsioximeter();
cont = 0;
}
}

El GLCD muestra la información de los nodos se envía, que contiene los datos de sensor recogidos.

KST: Real-time data viewing and plotting

KST es el más rápido en tiempo real a gran conjunto de datos de visualización y trazado herramienta disponible (usted puede estar interesado en algunos puntos de referencia) y tiene una funcionalidad integrada de análisis de datos. Es muy fácil de usar y contiene muchas potente incorporado en funciones y se puede ampliar con plugins y extensiones.
KST está licenciado bajo la GPL, y es como tal libremente disponible para cualquier persona. Lo que es más, a partir de 2.0.x está disponible en todas las plataformas: Microsoft Windows, Linux, Mac OSX.
Antes de todo, usted tiene que instalar el programa KST en su PC. Puede descargar el programa desde la página web KST:
http://kst-plot.kde.org/
Vamos a utilizar KST para representar la onda ECG, flujo de aire y la respuesta galvánica de la piel.
Ejemplo de código
Este ejemplo es para el sistema operativo Linux. Se representan las diferentes olas y los datos medidos por el sensor plataforma e-Salud.
Puede encontrar más información acerca de cómo utilizar KST en este video tutorial.
Para comenzar a trabajar con los datos en tiempo real primero debe cargar el código apropiado en el Arduino.
Como vamos a trabajar con Linux vamos a utilizar la consola para guardar los datos en un archivo (. Txt).
Enchufe en el dispositivo, y ejecutar

 stty -F /dev/ttyACM0 cs8 9600 ignbrk -brkint -icrnl -imaxbel -opost -onlcr -isig -icanon 
  -iexten -echo -echoe -echok -echoctl -echoke noflsh -ixon -crtscts
en la consola «A».
Con esta orden se debe configurar el puerto ttyACM0.
A continuación, utilice el comando en la consola del mismo para crear el archivo de texto en el que se almacenarán los datos.
  tail-f / dev/ttyACM0> Desktop / test.txt
Los programas de Arduino KST muestras están listas para enviar datos de forma continua cuando recibe una «C» y dejar de enviar cuando se recibe una «F». Estos datos se enviarán por consola «B» con los comandos:
 echo 'C' > /dev/ttyACM0
  echo 'F' > /dev/ttyACM0
Cconfiguración básica
Ahora con el archivo creado y actualizado con los datos recibidos, tenemos que abrir el programa KST.
Para configurar KST para cada ejemplo, tendremos que establecer parámetros comunes.
1) En la ventana emergente, seleccione el directorio en el txt. Creado anteriormente y pulse el botón Configurar.
2) El siguiente paso, es configurar la fuente de datos.
3) Seleccione los datos de medición. Los datos de campo / columna 2.
El paso final es diferente dependiendo de cada ejemplo.
ECG ejemplo en KST
En este ejemplo se configura el KST para mostrar un determinado período de tiempo x (x = 300). Estamos interesados sólo en los valores más actuales del ECG.
The Arduino code used in this program is presented next:
#Include

extern volatile unsigned long timer0_overflow_count;
float fanalog0;
int analog0;
unsigned long time;

byte serialByte;
void setup () {
Serial.begin (9600);
Serial.println(«Starting…»);
}

void loop () {
while (Serial.available()>0){
serialByte=Serial.read();
if (serialByte==’C’){
while (1) {
fanalog0=eHealth.getECG();
// Use the timer0 => 1 tick every 4 us
time=(timer0_overflow_count << 8) + TCNT0;
// Microseconds conversion.
time=(time*4);
//Print in a file for simulation
Serial.print(time);
Serial.print(«;»);
Serial.println(fanalog0,5);

if (Serial.available()>0){
serialByte=Serial.read();
if (serialByte==’F’) break;
}
}
}
}
}

Respuesta Galvánica de la Piel ejemplo en KST
En el ejemplo de respuesta galvánica de la piel que está interesado en todos los datos desde el inicio de la medición. Vamos a configurar el KST para mostrar una onda con todos los datos.
The Arduino code used in this program is presented next:
Show Code

  / *
 * eHealth sensor platform for Arduino and Raspberry from Cooking-hacks. 
  *
 * Description: "The e-Health Sensor Shield allows Arduino and Raspberry Pi 
 * users to perform biometric and medical applications by using 9 different 
 * sensors: Pulse and Oxygen in Blood Sensor (SPO2), Airflow Sensor (Breathing),
 * Body Temperature, Electrocardiogram Sensor (ECG), Glucometer, Galvanic Skin
 * Response Sensor (GSR - Sweating), Blood Pressure (Sphygmomanometer) and 
 * Patient Position (Accelerometer)."  
  *
 * In this example we read the value of the GSR sensor 
 * and print the GSR wave form in the KST .
  *
 * Copyright (C) 2012 Libelium Comunicaciones Distribuidas SL
  * Http://www.libelium.com
  *
  * Este programa es software libre: usted puede redistribuirlo y / o modificarlo
  * Bajo los términos de la Licencia Pública General de GNU según es publicada por
 * the Free Software Foundation, either version 3 of the License, or
  * (A su elección) cualquier versión posterior.
  *
  * Este programa se distribuye con la esperanza de que sea útil,
  * Pero SIN NINGUNA GARANTÍA, incluso sin la garantía implícita de
  * COMERCIALIZACIÓN o IDONEIDAD PARA UN PROPÓSITO PARTICULAR.  Consulte la
  * GNU General Public License para más detalles.
  *
  * Usted debe haber recibido una copia de la Licencia Pública General de GNU
  * Junto con esta librería. If not, see .
  *
 * Version 0.1
 * Author: Luis Martin & Ahmad Saad 
  * /

# Include

extern volatile unsigned long timer0_overflow_count;
float fanalog0;
int analog0;
unsigned long time;
byte serialByte;

void setup () {
Serial.begin (9600);
Serial.println(«Starting…»);
}

void loop () {
while (Serial.available()>0){
serialByte=Serial.read();

if (serialByte==’C’){
while (1) {
fanalog0=eHealth.getSkinConductance();
// Use the timer0 => 1 tick every 4 us
time=(timer0_overflow_count << 8) + TCNT0;
// Microseconds conversion.
time=time*4;
//Print in a file for simulation
Serial.print(time);
Serial.print(char(‘ ; ‘));
Serial.println(fanalog0,5);
if (Serial.available()>0){
serialByte=Serial.read();
if (serialByte==’F’) break;
}
}
}
}
}

Flujo de aire en el ejemplo KST
Podemos configurar el programa KST en este ejemplo de acuerdo con los datos que queremos Muestra (métodos anteriores).
The Arduino code used in this program is presented next:
Show Code

  / *
 * eHealth sensor platform for Arduino and Raspberry from Cooking-hacks.
  *
 * Description: "The e-Health Sensor Shield allows Arduino and Raspberry Pi 
 * users to perform biometric and medical applications by using 9 different 
 * sensors: Pulse and Oxygen in Blood Sensor (SPO2), Airflow Sensor (Breathing),
 * Body Temperature, Electrocardiogram Sensor (ECG), Glucometer, Galvanic Skin
 * Response Sensor (GSR - Sweating), Blood Pressure (Sphygmomanometer) and 
 * Patient Position (Accelerometer)."  
  *
 * In this example we read the value of the air flow sensor 
 * and print the air Flow wave form using KST.
  *
 * Copyright (C) 2012 Libelium Comunicaciones Distribuidas SL
  * Http://www.libelium.com
  *
  * Este programa es software libre: usted puede redistribuirlo y / o modificarlo
  * Bajo los términos de la Licencia Pública General de GNU según es publicada por
 * the Free Software Foundation, either version 3 of the License, or
  * (A su elección) cualquier versión posterior.
  *
  * Este programa se distribuye con la esperanza de que sea útil,
  * Pero SIN NINGUNA GARANTÍA, incluso sin la garantía implícita de
  * COMERCIALIZACIÓN o IDONEIDAD PARA UN PROPÓSITO PARTICULAR.  Consulte la
  * GNU General Public License para más detalles.
  *
  * Usted debe haber recibido una copia de la Licencia Pública General de GNU
  * Junto con esta librería. If not, see .
  *
 * Version 0.1
 * Author: Luis Martin & Ahmad Saad 
  * /

# Include

extern volatile unsigned long timer0_overflow_count;
float fanalog0;
int analog0;
unsigned long time;
byte serialByte;

void setup () {
Serial.begin (9600);
Serial.println(«Starting…»);
}

void loop () {
while (Serial.available()>0) {
serialByte=Serial.read();

if (serialByte==’C’){
while (1) {
fanalog0=eHealth.getAirFlow();
// Use the timer0 => 1 tick every 4 us
time=(timer0_overflow_count << 8) + TCNT0;
// Microseconds conversion.
time=time*4;
//Print in a file for simulation
Serial.print(time);
Serial.print(«;»);
Serial.println(fanalog0,5);
if (Serial.available()>0){
serialByte=Serial.read();
if (serialByte==’F’) break;
}
}
}
}
}

La consola serie

Todos los datos se pueden visualizar en el monitor serie de Arduino / RasberryPi utilizando el siguiente programa de consola serie.
Cargar el programa eHealth_SerialMenu ejemplo y abrir el monitor serie de Arduino IDE.
En el menú principal podemos encontrar todos los sensores de salud electrónica. Mediante el envío de un comando para el puerto serie que se puede seleccionar uno de ellos.
NOTA: La medición de la glucosa no se ha aplicado en este ejemplo porque ambos procesos utilizan UART comunicación y puede causar un mal funcionamiento
Para ver las medidas del sensor, envía el comando correspondiente y pulse la tecla Intro.
Puede volver al menú principal mediante el envío de la orden de «B».
Ejemplo
Arduino
The Arduino code used in this program is presented next:
Show Code

  / *
 * eHealth sensor platform for Arduino and Raspberry from Cooking-hacks.
  *
 * Description: "The e-Health Sensor Shield allows Arduino and Raspberry Pi 
 * users to perform biometric and medical applications by using 9 different 
 * sensors: Pulse and Oxygen in Blood Sensor (SPO2), Airflow Sensor (Breathing),
 * Body Temperature, Electrocardiogram Sensor (ECG), Glucometer, Galvanic Skin
 * Response Sensor (GSR - Sweating), Blood Pressure (Sphygmomanometer) and 
 * Patient Position (Accelerometer)." 
  *
 * In this example we have used the serial monitor like a programed
 * console where we can choose the sensor we want to view.  *   
  * 
  * Este programa es software libre: usted puede redistribuirlo y / o modificarlo
  * Bajo los términos de la Licencia Pública General de GNU según es publicada por
 * the Free Software Foundation, either version 3 of the License, or
  * (A su elección) cualquier versión posterior.
  *
  * Este programa se distribuye con la esperanza de que sea útil,
  * Pero SIN NINGUNA GARANTÍA, incluso sin la garantía implícita de
  * COMERCIALIZACIÓN o IDONEIDAD PARA UN PROPÓSITO PARTICULAR.  Consulte la
  * GNU General Public License para más detalles.
  *
  * Usted debe haber recibido una copia de la Licencia Pública General de GNU
  * Junto con esta librería. If not, see .
  *
 * Version 0.1
 * Author: Luis Martín & Ahmad Saad
  * /

# Include
# Include

char serialByte;
uint8_t state = 0;
uint8_t cont = 0;

float parameter = 0.098;

void setup ()
{
Serial.begin(115200);
initScreen();
retardo (100);
}

void loop ()
{
state = 0;

while (Serial.available()>0){
serialByte=Serial.read();

if ((serialByte==’A’) || (serialByte == ‘a’)){ //Airflow sensor
airFlowMenu();
airFlowBucle();

} else if ((serialByte==’S’) || (serialByte == ‘s’)){
skinSensorMenu();
skinSensorBucle();

} else if ((serialByte==’E’) || (serialByte == ‘e’)){
ECGMenu();
ECGBucle();

} else if ((serialByte==’P’) || (serialByte == ‘p’)){
pulsioximeterMenu();
pulsioximeterBucle();

} else if ((serialByte==’B’) || (serialByte == ‘b’)){
bodyPositionMenu();
bodyPositionBucle();

} else if ((serialByte==’T’) || (serialByte == ‘t’)){
temperatureMenu();
temperatureBucle();

} else if ((serialByte==’N’) || (serialByte == ‘n’)){
BloodPressureMenu();
BloodPressureBucle();
}
}
}

void initScreen(void)
{
printLogoEhealth();
retardo (100);
mainMenu();
}

void mainMenu(void)
{
lineFeed(); Serial.print(F(» ——–> EHEALTH MENU OPTIONS <——–«)); lineFeed(); lineFeed();

initialSpace(); Serial.print(F(«A : AirFlow sensor options»)); lineFeed();
initialSpace(); Serial.print(F(«S : Skin sensor options»)); lineFeed();
initialSpace(); Serial.print(F(«E : ECG sensor options»)); lineFeed();
initialSpace(); Serial.print(F(«P : Pulsioximeter sensor options»)); lineFeed();
initialSpace(); Serial.print(F(«B : Body position sensor options»)); lineFeed();
initialSpace(); Serial.print(F(«T : Temperature sensor options»)); lineFeed();
initialSpace(); Serial.print(F(«N : Blood Pressure sensor options»));lineFeed();
}

void airFlowMenu(void)
{
lineFeed(); Serial.print(F(«——–> AIRFLOW MENU OPTIONS <——–«)); lineFeed(); lineFeed();
initialSpace(); Serial.print(F(«W : Wave form»)); lineFeed();
initialSpace(); Serial.print(F(«V : Analogic value»)); lineFeed();
initialSpace(); Serial.print(F(«B : BACK MAIN MENU»)); lineFeed();
}

void airFlowBucle(void) {
while (state == 0) {
while (Serial.available()>0){
serialByte=Serial.read();
if ((serialByte==’W’) || (serialByte == ‘w’)){ //Airflow sensor
while (1) {
serialByte=Serial.read();
eHealth.airFlowWave(eHealth.getAirFlow());

if ((serialByte== ‘B’) || (serialByte == ‘b’)) {
airFlowMenu();
break;
}
}
} else if ((serialByte==’V’) || (serialByte == ‘v’)){
while (1) {
serialByte=Serial.read();
Serial.print(F(» Airflow analogic value : «));
Serial.println(eHealth.getAirFlow());
delay(20);
if ((serialByte== ‘B’) || (serialByte == ‘b’)) {
airFlowMenu();
break;
}
}
} else if ((serialByte==’B’) || (serialByte == ‘b’)){
state = 1;
}
}
}
mainMenu();
}

void skinSensorMenu(void)
{
lineFeed(); Serial.print(F(«——–> SKIN SENSOR MENU OPTIONS <——–«)); lineFeed(); lineFeed();
outputMenu();
}

void skinSensorBucle(void) {
while (state == 0) {
while (Serial.available()>0){
serialByte=Serial.read();
if ((serialByte==’S’) || (serialByte == ‘s’)){
while (1) {

lineFeed();

serialByte=Serial.read();
float conductance = eHealth.getSkinConductance();
long resistance = eHealth.getSkinResistance();
float conductanceVoltage = eHealth.getSkinConductanceVoltage();

if (conductance == -1) {
Serial.println(» No patient connection»);
} Else {

Serial.print(F(» Skin conductance value : «));
Serial.println(conductance);

Serial.print(F(» Skin resistance value : «));
Serial.println(resistance);

Serial.print(F(» Skin conductance value in volts: «));
Serial.println(conductanceVoltage);

retardo (500);
}

if ((serialByte== ‘B’) || (serialByte == ‘b’)) {
skinSensorMenu();
break;
}
}

} else if ((serialByte==’B’) || (serialByte == ‘b’)){
state = 1;
}
}
}
mainMenu();
}

void ECGMenu(void) {
lineFeed(); Serial.print(F(«——–> ECG MENU OPTIONS <——–«)); lineFeed(); lineFeed();
outputMenu();
}

void ECGBucle(void) {
while (state == 0) {
while (Serial.available()>0){
serialByte=Serial.read();
if ((serialByte==’S’) || (serialByte == ‘s’)){
while (1) {

lineFeed();
serialByte=Serial.read();

retardo (500);

if ((serialByte== ‘B’) || (serialByte == ‘b’)) {
ECGMenu();
break;
}
}
} else if ((serialByte==’B’) || (serialByte == ‘b’)){
state = 1;
}
}
}
mainMenu();
}

void pulsioximeterMenu(void)
{
lineFeed(); Serial.print(F(«——–> PULSIOXIMETER MENU OPTIONS <——–«)); lineFeed(); lineFeed();
outputMenu();
}

void pulsioximeterBucle(void)
{
//Attach the interruptions for using the pulsioximeter.
PCintPort::attachInterrupt(6, readPulsioximeter, RISING);
eHealth.initPulsioximeter();

while (state == 0) {
while (Serial.available()>0){
serialByte=Serial.read();
if ((serialByte==’S’) || (serialByte == ‘s’)){
while (1) {

//eHealth.readPulsioximeter();

lineFeed();
serialByte=Serial.read();
Serial.print(«PRbpm : «);
Serial.print(eHealth.getOxygenSaturation());

Serial.print(» % SPo2 : «);
Serial.print(eHealth.getBPM());

Serial.print(«\n»);
retardo (500);

if ((serialByte== ‘B’) || (serialByte == ‘b’)) {
pulsioximeterMenu();
break;
}
}
} else if ((serialByte==’B’) || (serialByte == ‘b’)){
state = 1;
}
}
}
mainMenu();

PCintPort::detachInterrupt(6);
}

void bodyPositionMenu(void)
{
lineFeed(); Serial.print(F(«——–> BODY POSTITIONMENU OPTIONS <——–«)); lineFeed(); lineFeed();
outputMenu();
}

void bodyPositionBucle(void)
{
while (state == 0) {
while (Serial.available()>0){
serialByte=Serial.read();
if ((serialByte==’S’) || (serialByte == ‘s’)){
while (1) {

lineFeed();
serialByte=Serial.read();

Serial.print(«Current position : «);
uint8_t position = eHealth.getBodyPosition();
eHealth.printPosition(position);
retardo (100);

if ((serialByte== ‘B’) || (serialByte == ‘b’)) {
bodyPositionMenu();
break;
}
}
} else if ((serialByte==’B’) || (serialByte == ‘b’)){
state = 1;
}
}
}
mainMenu();
}

void temperatureMenu(void)
{
lineFeed(); Serial.print(F(«——–> TEMPERATURE MENU OPTIONS <——–«)); lineFeed(); lineFeed();
outputMenu();
}

void temperatureBucle(void)
{
while (state == 0) {
while (Serial.available()>0){
serialByte=Serial.read();
if ((serialByte==’S’) || (serialByte == ‘s’)){
while (1) {

lineFeed();
serialByte=Serial.read();

float temperature = eHealth.getTemperature();
Serial.print(«Temperature (ºC): «);
Serial.println(temperature, 2);

delay (1000);

if ((serialByte== ‘B’) || (serialByte == ‘b’)) {
temperatureMenu();
break;
}
}
} else if ((serialByte==’B’) || (serialByte == ‘b’)){
state = 1;
}
}
}
mainMenu();
}

void BloodPressureMenu(void)
{
lineFeed(); Serial.print(F(«——–> BLOOD PRESSURE MENU OPTIONS <——–«)); lineFeed(); lineFeed();
outputMenu();
}

void BloodPressureBucle()
{
while (state == 0) {
while (Serial.available()>0){
serialByte=Serial.read();
if ((serialByte==’S’) || (serialByte == ‘s’)){
while (1) {

lineFeed();
serialByte=Serial.read();
Serial.println(«Press On/Off button please…»);

eHealth.initBloodPressureSensor(parameter);

Serial.println(«****************************»);
Serial.print(«Systolic blood pressure value : «);
Serial.println(eHealth.getSystolicPressure());

Serial.println(«****************************»);
Serial.print(«Diastolic blood pressure value : «);
Serial.println(eHealth.getDiastolicPressure());
retardo (3000);

if ((serialByte== ‘B’) || (serialByte == ‘b’)) {
BloodPressureMenu();
break;
}
}
} else if ((serialByte==’B’) || (serialByte == ‘b’)){
state = 1;
}
}
}
mainMenu();
}

void outputMenu(void) {
initialSpace(); Serial.print(F(«S : Serial output value»)); lineFeed();
initialSpace(); Serial.print(F(«B : BACK MAIN MENU»)); lineFeed();
}

void printLogoEhealth(void)
{
starLine();
starPrint(); blank(); HLeterOne(); blank(); blank(); blank(); tLeterOne(); hLeterOne(); starPrint(); lineFeed();
starPrint(); eLeterTwo(); HLeterTwo(); eLeterTwo(); aLeterTwo(); lLeterTwo(); tLeterTwo(); hLeterTwo(); starPrint(); lineFeed();
starPrint(); eLeterThree(); HLeterThree(); eLeterThree(); aLeterThree(); lLeterThree(); tLeterThree(); hLeterThree(); starPrint(); lineFeed();
starPrint(); eLeterFour(); HLeterFour(); eLeterFour(); aLeterFour(); lLeterFour(); tLeterFour(); hLeterFour(); starPrint(); lineFeed();
starPrint(); eLeterFive(); HLeterFive(); eLeterFive(); aLeterFive(); lLeterFive(); tLeterFive(); hLeterFive(); starPrint(); lineFeed();
starPrint(); eLeterSix(); HLeterSix(); eLeterSix(); aLeterSix(); lLeterSix(); tLeterSix(); hLeterSix(); starPrint(); lineFeed();
starLine();
}

void eLeterTwo(void) { Serial.print(F(» _____ «)); }
void eLeterThree(void) { Serial.print(F(«| __ | «)); }
void eLeterFour(void) { Serial.print(F(«| ___| «)); }
void eLeterFive(void) { Serial.print(F(«| |___ «)); }
void eLeterSix(void) { Serial.print(F(«|_____| «)); }

void HLeterOne(void) { Serial.print(F(» _ _ «)); }
void HLeterTwo(void) { Serial.print(F(«| | | | «)); }
void HLeterThree(void) { Serial.print(F(«| |__| | «)); }
void HLeterFour(void) { Serial.print(F(«| __ | «)); }
void HLeterFive(void) { Serial.print(F(«| | | | «)); }
void HLeterSix(void) { Serial.print(F(«|_| |_| «)); }

void aLeterTwo(void) { Serial.print(F(» ______ «)); }
void aLeterThree(void) { Serial.print(F(«| | «)); }
void aLeterFour(void) { Serial.print(F(«| {} | «)); }
void aLeterFive(void) { Serial.print(F(«| __ | «)); }
void aLeterSix(void) { Serial.print(F(«|_| |_| «)); }

void lLeterTwo(void) { Serial.print(F(» _ «)); }
void lLeterThree(void) { Serial.print(F(«| | «)); }
void lLeterFour(void) { Serial.print(F(«| | «)); }
void lLeterFive(void) { Serial.print(F(«| |____ «)); }
void lLeterSix(void) { Serial.print(F(«|______|»)); }

void tLeterOne(void) { Serial.print(F(» _ «));}
void tLeterTwo(void) { Serial.print(F(» _| |__ «)); }
void tLeterThree(void) { Serial.print(F(«(_ __) «)); }
void tLeterFour(void) { Serial.print(F(» | | «)); }
void tLeterFive(void) { Serial.print(F(» | |__ «)); }
void tLeterSix(void) { Serial.print(F(» |____) «)); }

void hLeterOne(void) { Serial.print(F(» _ «));}
void hLeterTwo(void) { Serial.print(F(«| | «)); }
void hLeterThree(void) { Serial.print(F(«| |___ «)); }
void hLeterFour(void) { Serial.print(F(«| _ | «)); }
void hLeterFive(void) { Serial.print(F(«| | | | «)); }
void hLeterSix(void) { Serial.print(F(«|_| |_| «)); }

void blank(void) { Serial.print(F(» «));}

void initialSpace(void)
{
Serial.print(F(» «));
}

void starPrint(void)
{
Serial.print(F(«* «));
}

void lineFeed(void)
{
Serial.print(F(«\n»));
}

void starLine(void)
{
for (int i = 0; i< 63; i++)
{
Serial.print(F(«*»));
}
lineFeed();
}

int freeRam () {
extern int __heap_start, *__brkval;
int v;
return (int) &v – (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
}

//Include always this code for using the pulsioximeter sensor
//=========================================================================
void readPulsioximeter(){

cont ++;

if (cont == 30) { //Get only one of 25 measures to reduce the latency
eHealth.readPulsioximeter();
cont = 0;
}
}

Upload the code and watch the Serial monitor.

SmartPhone Application

The wifi module may perform direct communications with iPhone and Android devices without the need of an intermediate router by creating an Adhoc network between them.
We have developed the application e-Health Sensor Plattform, for both iPhone and Android platforms. The application may be also downloaded from the official App markets or from the Libelium website for free: http://www.cooking-hacks.com/apps
Official app markets URL’s:
 
Connecting to an iPhone
Instalación:
a) Download the application from App Store:
  • From the iPhone, go to App Store. Go to Search screen and search “e-Health Sensor Plattform”.
  • Select e-Health app. Press FREE button, and then INSTALL button.
  • Accept the rights and then the app will appear in your iPhone screen.

You can do the same from the Computer with iTunes. Open iTunes and search “e-Health Sensor Plattform”: https://itunes.apple.com/us/app/e-health-sensor-platform/id581953525

  • Save the app in iTunes and synchronize it with your iPhone or iPod.

 

b) Download the application (e-Health.ipa) from the Libelium website: http://www.libelium.com/apps
  • Then double click on the icon, or right click and open with iTunes.
  • Inside iTunes, on the left panel, click on DEVICES->Your Device.
  • Select on the top “Apps”, and select Sync Apps. Drag into the desired screen e-Health app.
Once installed, the app appears in your iPhone/iPod screen.
iPhone app tutorial
The use of the app is very simple, first you have to connect to one of the Arduino nodes selecting it in Settings->Wi-Fi, and then launch the application.
To connect to the network created by the wifi module of Arduino: Go to Settings->Wi-Fi and select iPHONE_ADHOC .
Once connected, you can launch the App.
The App shows the information the nodes are sending which contains the sensor data gathered.
The first tab “Charts” shows:
  • Respiratory rate chart
  • Electrocardiogram: is necessary to correctly set the delay between frames for the correct measurement of electrocardiogram
The “Current data” tab, shows data that is in continuous change:
  • Temperatura
  • Pulso
  • Oxígeno
  • Conductividad
  • Resistencia
  • Flujo de aire
The “Tests” tab shows the information about:
  • Systolic Pressure
  • Diastolic Pressure
  • Glucometer
Finally, in the “Movement” tab shows the position of the body.
NOTE: The measurement of glucose has not been implemented in this example because both processes use UART communication and can cause malfunction
Ejemplo
Arduino
The Arduino code used in this program is presented next:
Show Code

  / *
 * eHealth sensor platform for Arduino and Raspberry from Cooking-hacks.
  *
 * Description: "The e-Health Sensor Shield allows Arduino and Raspberry Pi 
 * users to perform biometric and medical applications by using 9 different 
 * sensors: Pulse and Oxygen in Blood Sensor (SPO2), Airflow Sensor (Breathing),
 * Body Temperature, Electrocardiogram Sensor (ECG), Glucometer, Galvanic Skin
 * Response Sensor (GSR - Sweating), Blood Pressure (Sphygmomanometer) and 
 * Patient Position (Accelerometer)."  
  *
 * Explanation: This example shows the way to communicate with  
 * the Arduino Wifi Demo iPhone app. 
  *
 * Copyright (C) 2012 Libelium Comunicaciones Distribuidas SL
  * Http://www.libelium.com
  *
  * Este programa es software libre: usted puede redistribuirlo y / o modificarlo
  * Bajo los términos de la Licencia Pública General de GNU según es publicada por
 * the Free Software Foundation, either version 3 of the License, or
  * (A su elección) cualquier versión posterior.
  *
  * Este programa se distribuye con la esperanza de que sea útil,
  * Pero SIN NINGUNA GARANTÍA, incluso sin la garantía implícita de
  * COMERCIALIZACIÓN o IDONEIDAD PARA UN PROPÓSITO PARTICULAR.  Consulte la
  * GNU General Public License para más detalles.
  *
  * Usted debe haber recibido una copia de la Licencia Pública General de GNU
  * Junto con esta librería. If not, see .
  *
 * Version 0.1
 * Author: Luis Martin & Ahmad Saad 
  * /

# Include
# Include

char recv[256];
float parameter = 0.098;
uint8_t cont = 0;

void setup () {

//eHealth.readGlucometer();
Serial.begin (9600);
eHealth.initPulsioximeter();
eHealth.initPositionSensor();
}

void loop () {

Serial.print(«$$$»);
marcar ();

/ / 1. Configure the transport protocol (UDP, TCP, FTP, HTTP…)
Serial.print(«set ip 3\r»); check();
/ / 2. Configure the way the modules will resolve the IP address.
Serial.print(«set id 2\r»); check();
/ / 3. Configure how to connect the AP.
Serial.print(«set wa 6\r»); check();
// 3.1 Sets the name of the ADhoc network.
Serial.print(«set ws iPHONE_ADHOC\r»); check();
// 3.2 Sets the channel of the ADhoc network
Serial.print(«set wc 6\r»); check();

Serial.print(«set wj 4\r»); check();
Serial.print(«save\r»); check();
Serial.print(«exit\r»); check();
Serial.print(«$$$»); check();
// Configures UDP host and ports.
Serial.print(«set ih 255.255.255.255\r»); check();
Serial.print(«set ir 12345\r»); check();
Serial.print(«set il 2000\r»); check();
// Checks if everything is Ok, even if It’s correctly connected.

// Exits from command mode, and then the UDP messages
// can be sent and received.
Serial.print(«exit\r»);
marcar ();

//Attach the inttruptions for using the pulsioximeter.
PCintPort::attachInterrupt(6, readPulsioximeter, RISING);
delay (1000);

while (1) {

eHealth.initBloodPressureSensor(0.1);

//1. Read from eHealth.
int airFlow = eHealth.getAirFlow();
float temperature = eHealth.getTemperature();
float conductance = eHealth.getSkinConductance();
float resistance = eHealth.getSkinResistance();
float conductanceVol = eHealth.getSkinConductanceVoltage();
int BPM = eHealth.getBPM();
int SPO2 = eHealth.getOxygenSaturation();
uint8_t pos = eHealth.getBodyPosition();
int syst = eHealth.getSystolicPressure();
int diast = eHealth.getDiastolicPressure();
float ECG = eHealth.getECG();
//uint8_t glucose = eHealth.glucoseDataVector[0].glucose;

/ / 2. Send data to the Android smartphone
Serial.print(int(airFlow)); Serial.print(«#»);
Serial.print(ECG); Serial.print(«#»);
Serial.print(temperature); Serial.print(«#»);
Serial.print(int(BPM)); Serial.print(«#»);
Serial.print(int(SPO2)); Serial.print(«#»);
Serial.print(conductance); Serial.print(«#»);
Serial.print(int(resistance)); Serial.print(«#»);
Serial.print(int(airFlow)); Serial.print(«#»);
Serial.print(syst); Serial.print(«#»);
Serial.print(diast); Serial.print(«#»);
Serial.print(int(0)); Serial.print(«#»);
Serial.print(int(pos)); Serial.print(«#»);
Serial.print(«\n»);

// Reduce this delay for more data rate
retardo (100);
}

}

//=========================================================================

void check(){
cont=0;
retardo (500);
while (Serial.available()>0)
{
recv[cont]=Serial.read();
delay(10);
cont + +;
}
recv[cont]=’\0′;
Serial.println(recv);
Serial.flush ();
retardo (100);
}

//Include always this code when using the pulsioximeter sensor
//=========================================================================
void readPulsioximeter(){

cont ++;

if (cont == 50) { //Get only one 50 measures to reduce the latency
eHealth.readPulsioximeter();
cont = 0;
}
}

Connecting to an Android
Instalación:
a) Download the application from Android Market:
  • From the Android device, go to Android Market.
  • Search “” or “” and press enter
b) Download the application () from Libelium website: http://www.libelium.com/apps
  • Insert it to the SD card of your Android device.
  • Then explore the SD card in your Android device and install the application. You can explore the SD card with “Astro”, “ES Explora”, or “File Explorer” applications.
Once installed, the app appears in your device screen.
Android app tutorial
The use of the app is very simple, first you have to create an AP from your Android device and then set Waspmote to connect to it.
To create the AP from the Android device:
Go to Settings->Tethering & Portable Hotspot or Settings->Wifi-> My Wifi Zone (depending of the version of mobile).

Then configure the WLAN hotspot (name= ANDROID, Security= Open).

Finally, enable Portable WLAN hotspot (or My Wifi Zone), and Arduino will connect to the Android device. Once connected, you can launch the e-Health App.
The App shows the information the nodes are sending which contains the sensor data gathered.
The first tab “Charts” shows:
  • Respiratory rate chart
  • Electrocardiogram: is necessary to correctly set the delay between frames for the correct measurement of electrocardiogram
The “Current data” tab, shows data that is in continuous change:
  • Temperatura
  • Pulso
  • Oxígeno
  • Conductividad
  • Resistencia
  • Flujo de aire
The “Tests” tab shows the information about:
  • Systolic Pressure
  • Diastolic Pressure
  • Glucometer
Finally, in the “Movement” tab shows the position of the body.
NOTE: The measurement of glucose has not been implemented in this example because both processes use UART communication and can cause malfunction
Ejemplo
Arduino
The Arduino code used in this program is presented next:
Show Code

  / *
 * eHealth sensor platform for Arduino and Raspberry from Cooking-hacks.
  *
 * Description: "The e-Health Sensor Shield allows Arduino and Raspberry Pi 
 * users to perform biometric and medical applications by using 9 different 
 * sensors: Pulse and Oxygen in Blood Sensor (SPO2), Airflow Sensor (Breathing),
 * Body Temperature, Electrocardiogram Sensor (ECG), Glucometer, Galvanic Skin
 * Response Sensor (GSR - Sweating), Blood Pressure (Sphygmomanometer) and 
 * Patient Position (Accelerometer)."  
  *
 * Explanation: This example shows the way to communicate with  
 * the Arduino Wifi Demo Android app. 
  *
 * Copyright (C) 2012 Libelium Comunicaciones Distribuidas SL
  * Http://www.libelium.com
  *
  * Este programa es software libre: usted puede redistribuirlo y / o modificarlo
  * Bajo los términos de la Licencia Pública General de GNU según es publicada por
 * the Free Software Foundation, either version 3 of the License, or
  * (A su elección) cualquier versión posterior.
  *
  * Este programa se distribuye con la esperanza de que sea útil,
  * Pero SIN NINGUNA GARANTÍA, incluso sin la garantía implícita de
  * COMERCIALIZACIÓN o IDONEIDAD PARA UN PROPÓSITO PARTICULAR.  Consulte la
  * GNU General Public License para más detalles.
  *
  * Usted debe haber recibido una copia de la Licencia Pública General de GNU
  * Junto con esta librería. If not, see .
  *
 * Version 0.1
 * Author: Luis Martin & Ahmad Saad 
  * /

# Include
# Include

char recv[128];
float parameter = 0.098;
uint8_t cont = 0;

void setup ()
{
Serial.begin (9600);

eHealth.initPulsioximeter();
eHealth.initPositionSensor();

//Attach the inttruptions for using the pulsioximeter.
PCintPort::attachInterrupt(6, readPulsioximeter, RISING);
delay (1000);

}

void loop ()
{
while (Serial.available()>0) {}
// Enters in command mode
Serial.print(«$$$»); check();
// Sets DHCP and TCP protocol
Serial.print(«set ip dhcp 1\r»); check();
Serial.print(«set ip protocol 1\r»); check();
// Configures the way to join the network AP
Serial.print(«set wlan join 0\r»); check();
Serial.print(«join ANDROID\r»); check();

Serial.print(«set ih 255.255.255.255\r»); delay(1000);

Serial.print(«set ir 12345\r»); check();
Serial.print(«set il 2000\r»); check();
Serial.print(«exit\r»); check();

while (1) {

eHealth.initBloodPressureSensor(0.098);

//1. Read from eHealth.
int airFlow = eHealth.getAirFlow();
float temperature = eHealth.getTemperature();
float conductance = eHealth.getSkinConductance();
float resistance = eHealth.getSkinResistance();
float conductanceVol = eHealth.getSkinConductanceVoltage();
int BPM = eHealth.getBPM();
int SPO2 = eHealth.getOxygenSaturation();
uint8_t pos = eHealth.getBodyPosition();
int syst = eHealth.getSystolicPressure();
int diast = eHealth.getDiastolicPressure();
float ECG = eHealth.getECG();
//uint8_t glucose = eHealth.glucoseDataVector[0].glucose;

//Data sensor must be sent in this order to mobile android application
Serial.print(int(airFlow)); Serial.print(«#»);
Serial.print(ECG); Serial.print(«#»);
Serial.print(syst); Serial.print(«#»);
Serial.print(diast); Serial.print(«#»);
Serial.print(int(0)); Serial.print(«#»); //Glucose is not implemented yet
Serial.print(temperature); Serial.print(«#»);
Serial.print(int(BPM)); Serial.print(«#»);
Serial.print(int(SPO2)); Serial.print(«#»);
Serial.print(conductance); Serial.print(«#»);
Serial.print(int(resistance)); Serial.print(«#»);
Serial.print(int(airFlow)); Serial.print(«#»);
Serial.print(int(pos)); Serial.print(«#»);
Serial.print(«\n»);

// Reduce this delay for more data rate
delay(250);
}
}

void check(){
cont=0; delay(500);
while (Serial.available()>0)
{
recv[cont]=Serial.read(); delay(10);
cont + +;
}
recv[cont]=’\0′;
Serial.println(recv);
Serial.flush(); delay(100);
}

//Include always this code when using the pulsioximeter sensor
//=========================================================================
void readPulsioximeter(){

cont ++;

if (cont == 50) { //Get only one 50 measures to reduce the latency
eHealth.readPulsioximeter();
cont = 0;
}
}

Para más informacion,pulse aquí

🤞 No se pierda nuestro boletín mensual !es gratis!

¡No hacemos spam! Más información en nuestra política de privacidad

Deja una respuesta