Project tutorial
Monitoring Health Station

Monitoring Health Station © GPL3+

Android app-controlled, Arduino-based kit that provides simultaneous data about body t°, heart rate, room humidity and t° data.

  • 2,126 views
  • 1 comment
  • 22 respects

Components and supplies

Apps and online services

About this project

Wired electronics with sensors and an app will provide an easy way of controlling the state of health and surrounding parameters

Code

CodeC/C++
#include <SoftwareSerial.h>
#include <cactus_io_AM2302.h>

#define AM2302_PIN 7

#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 2


OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
AM2302 dht(AM2302_PIN);


SoftwareSerial Bluetooth(10, 9);
String Data;
int pulsePin = 0;
int blinkPin = 13;
volatile int BPM;

volatile int Signal;

volatile int IBI = 600;

volatile boolean Pulse = false;

volatile boolean QS = false;

volatile int rate[10];                    
volatile unsigned long sampleCounter = 0;          
volatile unsigned long lastBeatTime = 0;           
volatile int P = 512;                     
volatile int T = 512;                     
volatile int thresh = 512;                
volatile int amp = 100;                   
volatile boolean firstBeat = true;        
volatile boolean secondBeat = false;      

void interruptSetup() {
  
  TCCR2A = 0x02;    
  TCCR2B = 0x06;   
  OCR2A = 0X7C;      
  TIMSK2 = 0x02;     
  sei();            
}



ISR(TIMER2_COMPA_vect) {                        
  cli();                                      
  Signal = analogRead(pulsePin);              
  sampleCounter += 2;                         
  int N = sampleCounter - lastBeatTime;       

  if (Signal < thresh && N > (IBI / 5) * 3) { 
    if (Signal < T) {                       
      T = Signal;                         
    }
  }

  if (Signal > thresh && Signal > P) {       
    P = Signal;                            
  }                                        


  if (N > 250) {                                  
    if ( (Signal > thresh) && (Pulse == false) && (N > (IBI / 5) * 3) ) {
      Pulse = true;                               
      digitalWrite(blinkPin, HIGH);               
      IBI = sampleCounter - lastBeatTime;        
      lastBeatTime = sampleCounter;               

      if (secondBeat) {                      
        secondBeat = false;                  
        for (int i = 0; i <= 9; i++) {       
          rate[i] = IBI;
        }
      }

      if (firstBeat) {                       
        firstBeat = false;                   
        secondBeat = true;                   
        sei();                               
        return;                              
      }


      
      word runningTotal = 0;                  

      for (int i = 0; i <= 8; i++) {          
        rate[i] = rate[i + 1];                
        runningTotal += rate[i];              
      }

      rate[9] = IBI;                          
      runningTotal += rate[9];                
      runningTotal /= 10;                     
      BPM = 60000 / runningTotal;             
      QS = true;                              
    }
  }

  if (Signal < thresh && Pulse == true) {  
    digitalWrite(blinkPin, LOW);           
    Pulse = false;                         
    amp = P - T;                           
    thresh = amp / 2 + T;                  
    P = thresh;                            
    T = thresh;
  }

  if (N > 2500) {                          
    thresh = 512;                          
    P = 512;                               
    T = 512;                               
    lastBeatTime = sampleCounter;          
    firstBeat = true;                      
    secondBeat = false;                    
  }

  sei();                                   
}

void setup() {
  Bluetooth.begin(9600);
  Serial.begin(9600);
  dht.begin();
  sensors.begin();
  interruptSetup();
}

void loop() {
  sensors.requestTemperatures();
  dht.readHumidity();
  dht.readTemperature();
  if (isnan(dht.humidity) || isnan(dht.temperature_C)) {
    return;
  }
  if (QS == true) {
    
    Serial.print(sensors.getTempCByIndex(0)); Serial.print(" "); Serial.print(dht.temperature_C); Serial.print(" "); Serial.print(dht.humidity); Serial.print(" "); Serial.println(BPM);
    
    Bluetooth.print(sensors.getTempCByIndex(0)); Bluetooth.print(" "); Bluetooth.print(dht.temperature_C); Bluetooth.print(" "); Bluetooth.print(dht.humidity); Bluetooth.print(" "); Bluetooth.println(BPM);

    QS = false;

  }


  delay(1500);
}

Custom parts and enclosures

Android app for monitoring health station

Schematics

Sketch for the wiring
Untitled sketch bb xnltv56u5l
Wiring of arduino and breadboard
Img 20181205 181638 uywv9aimyi
Temperature sensor to get the data about body temperature
5555 ze4vet51gw
Construction of mobile app. part 1
1111 z6axknh39z
Construction of mobile app. part 2
2222 hfdmupebch
Construction of mobile app. part 3
3333 o4qbhojw02
Working app. part 1
Screenshot 2018 12 05 17 34 58 x1qnbmsx5y
Working app. part 2
Screenshot 2018 12 05 17 35 03 08s5erikrd
Working app. part 3
Screenshot 2018 12 05 17 35 07 cvezfio4xn
Working app. part 4 (receiving the data)
Screenshot 2018 12 05 17 37 21 vpqu4m2xvd

Comments

Similar projects you might like

Health Kit: Humidity and Temperature Control

Project tutorial by Diana Khalipina

  • 3,404 views
  • 2 comments
  • 32 respects

WIZ750SR Based Remote Health Monitoring with Amazon Alexa

Project tutorial by Madhur Gupta

  • 902 views
  • 0 comments
  • 6 respects

Arduino UNO Mini-Weather Station

Project tutorial by Igor Fonseca Albuquerque

  • 25,830 views
  • 21 comments
  • 67 respects

Portable Temperature Station

Project tutorial by Isaac100

  • 8,066 views
  • 8 comments
  • 35 respects

Life Band - Health Assistant For Elderly

Project tutorial by Dibu kk

  • 11,361 views
  • 3 comments
  • 37 respects

Wireless weather station (Arduino + ESP8266 + Thingspeak)

Project tutorial by Alin-Constantin Paun

  • 8,862 views
  • 2 comments
  • 11 respects
Add projectSign up / Login