Rucksikaa Raajkumar
Published © CC BY

COVID-19 Remote Health monitoring system ( IoT )

A cost-effective and open source system to data log health measurements in Google sheets and allows the doctor to monitor them from anywhere

IntermediateFull instructions provided2.5 hours1,495
COVID-19 Remote Health monitoring system ( IoT )

Things used in this project

Hardware components

NodeMCU ESP8266 Breakout Board
NodeMCU ESP8266 Breakout Board
×1
Solderless Breadboard Full Size
Solderless Breadboard Full Size
×1
Heartbeat sensor module
×1
Gravity: DS18B20 Temperature Sensor (Arduino Compatible)
DFRobot Gravity: DS18B20 Temperature Sensor (Arduino Compatible)
×1
Pushbutton switch 12mm
SparkFun Pushbutton switch 12mm
×2
IR tracking sensor module
×1
5 mm LED: Yellow
5 mm LED: Yellow
×1
Two-colour LED module
×1
Resistor 10k ohm
Resistor 10k ohm
×2
Male/Male Jumper Wires
×1

Software apps and online services

Arduino IDE
Arduino IDE
Pushingbox
Google Sheets
Google Sheets

Story

Read more

Schematics

Schematic

I could not get all the components in Fritzing, so I decided to draw the schematic by myself.

Hardware setup

Connections - NodeMCU ESP8266 Breakout board

Code

Threshold value

Arduino
GettingStartedProject.ino
/*  PulseSensor Starter Project and Signal Tester
 *  The Best Way to Get Started  With, or See the Raw Signal of, your PulseSensor.com™ & Arduino.
 *
 *  Here is a link to the tutorial
 *  https://pulsesensor.com/pages/code-and-guide
 *
 *  WATCH ME (Tutorial Video):
 *  https://www.youtube.com/watch?v=RbB8NSRa5X4
 *
 *
-------------------------------------------------------------
1) This shows a live human Heartbeat Pulse.
2) Live visualization in Arduino's Cool "Serial Plotter".
3) Blink an LED on each Heartbeat.
4) This is the direct Pulse Sensor's Signal.
5) A great first-step in troubleshooting your circuit and connections.
6) "Human-readable" code that is newbie friendly."

*/
//  Variables
int PulseSensorPurplePin = 0;        // Pulse Sensor PURPLE WIRE connected to ANALOG PIN 0
int LED13 = 13;   //  The on-board Arduion LED

int Signal;                // holds the incoming raw data. Signal value can range from 0-1024
int Threshold = 550;            // Determine which Signal to "count as a beat", and which to ingore.

// The SetUp Function:
void setup() {
  pinMode(LED13,OUTPUT);         // pin that will blink to your heartbeat!
   Serial.begin(9600);         // Set's up Serial Communication at certain speed.

}

// The Main Loop Function
void loop() {

  Signal = analogRead(PulseSensorPurplePin);  // Read the PulseSensor's value.
                                              // Assign this value to the "Signal" variable.

   Serial.println(Signal);                    // Send the Signal value to Serial Plotter.


   if(Signal > Threshold){                          // If the signal is above "550", then "turn-on" Arduino's on-Board LED.
     digitalWrite(LED13,HIGH);
   } else {
     digitalWrite(LED13,LOW);                //  Else, the sigal must be below "550", so "turn-off" this LED.
   }


delay(10);


}

Health Measurements

Arduino
// COVID-19 Remote Health Monitoring System
// ARDUINO PROJECTS BY R
// AUTHOR: RUCKSIKAA RAAJKUMAR
#include <ESP8266WiFi.h>
#include <PulseSensorPlayground.h>
#include <OneWire.h>
#include <DallasTemperature.h>
#define ONE_WIRE_BUS 5
#define Red  4
#define Green  D3 
#define LED 14 
#define USE_ARDUINO_INTERRUPTS true    // Set-up low-level interrupts for most acurate BPM math.
#define sensor 2 // IR tracking sensor
const int Button = 12; // The button used to record heart rate
int val = 0;
int old_val = 0;
int state=0;
int value;
const int Button1 = 13; // The button used to tecord temperature
int val1 = 0;
int old_val1 = 0;
int state1=0;
int Threshold = 400;
const int LED13 = 0;
OneWire oneWire(ONE_WIRE_BUS);
DallasTemperature sensors(&oneWire);
float cData;
float fData;
PulseSensorPlayground pulseSensor;  // Creates an instance of the PulseSensorPlayground object called "pulseSensor"
const int PulseWire = A0;       // PulseSensor PURPLE WIRE connected to ANALOG PIN 0       
const char WEBSITE[] = "api.pushingbox.com"; //pushingbox API server
const String devid = "Your Device ID"; //device ID from Pushingbox . Incomplete
const char* MY_SSID = "Your SSID";
const char* MY_PWD =  "Your password";

void setup(){
  Serial.begin(115200);
  sensors.begin();
  pinMode(sensor, INPUT);
  pinMode(Red, OUTPUT);
  pinMode(Green, OUTPUT);
  pinMode(LED, OUTPUT); 
  pinMode(Button, INPUT);
  pinMode(Button1, INPUT);
  pulseSensor.analogInput(PulseWire);   
  pulseSensor.blinkOnPulse(LED13);       //auto-magically blink Arduino's LED with heartbeat.
  pulseSensor.setThreshold(Threshold);
  
  // Double-check the "pulseSensor" object was created and "began" seeing a signal. 
   if (pulseSensor.begin()) {
    Serial.println("Heartbeat sensor works");  //This prints one time at Arduino power-up,  or on Arduino reset.  
  }
  Serial.print("Connecting to "+*MY_SSID);
  WiFi.begin(MY_SSID, MY_PWD);
  Serial.println("going into wl connect");
  while (WiFi.status() != WL_CONNECTED) //not connected,..waiting to connect
    {
      delay(1000);
      Serial.print(".");
    }
  Serial.println("wl connected");
  Serial.println("");
  Serial.println("Credentials accepted! Connected to wifi\n ");
  Serial.println("");
}
void loop(){ 
  val = digitalRead (Button);
  val1=digitalRead(Button1);
  value=digitalRead(sensor);
  if ((val==LOW)&& (old_val==HIGH)){
    state = 1-state;
    delay(10);
  }
  old_val = val;
  if (state == 1){ // Record heart rate
    digitalWrite(Green, HIGH);
    if (pulseSensor.sawStartOfBeat()) {
      hData = pulseSensor.getBeatsPerMinute();
    }
    Serial.println("Your heartbeat (in BPM): ");
    Serial.print (hData);
    digitalWrite(Green, LOW);
  }
  
  if((val1==LOW)&&(old_val1==HIGH)){
    state1=1-state1;
    delay(10);
  }
  old_val1=val1;
  if(state1==1){ // Record body temperature
    digitalWrite(Red, HIGH);
    delay(2000);
    Serial.println("Place your finger on the temperature sensor");
    delay(5000);
    sensors.requestTemperatures();
    cData = sensors.getTempCByIndex(0);
    fData = sensors.getTempFByIndex(0);
    Serial.println("Take your finger from the sensor");
    digitalWrite(Red, LOW);
  }
  
  if(value==LOW){ // If finger is hovered over the IR sensor
    WiFiClient client;  //Instantiate WiFi object
    //Start or API service using our WiFi Client through PushingBox
    if (client.connect(WEBSITE, 80)){
      client.print("GET /pushingbox?devid="+devid+"&hData="+(String)hData+"&cData="+(String)cData+"&fData="+(String)fData);
      client.println(" HTTP/1.1"); 
      client.print("Host: ");
      client.println(WEBSITE);
      client.println("User-Agent: ESP8266/1.0");
      client.println("Connection: close");
      client.println();
      delay(1000); 
      Serial.println("GET /pushingbox?devid="+devid+"&hData="+(String)hData+"&cData="+(String)cData+"&fData="+(String)fData);
      Serial.println("End PushBox ");
    } 
  }
  delay(20);
}

Google script

JavaScript
//-----------------------------------------------
//Originally published by Mogsdad@Stackoverflow
//Modified for jarkomdityaz.appspot.com
//Modified for Hackster.io by Stephen Borsay
//Modified for Hackster.io COVID19DetectProtect challenge by Rucksikaa Raajkumar
//-----------------------------------------------
/*
GScript, PushingBox and Arduino/ESP8266 Variables in order:

hData
cData
fData
----------------------------------------------------
*/
/* Using spreadsheet API */

function doGet(e) { 
  Logger.log( JSON.stringify(e) );  // view parameters

  var result = 'Ok'; // assume success

  if (e.parameter == undefined) {
    result = 'No Parameters';
  }
  else {
    var id = 'Your spreadsheet URL key';//docs.google.com/spreadsheetURL/d
    var sheet = SpreadsheetApp.openById(id).getActiveSheet();
    var newRow = sheet.getLastRow() + 1;
    var rowData = [];
    //var waktu = new Date();
    rowData[0] = new Date(); // Timestamp in column A
    
    for (var param in e.parameter) {
      Logger.log('In for loop, param='+param);
      var value = stripQuotes(e.parameter[param]);
      //Logger.log(param + ':' + e.parameter[param]);
      switch (param) {
        case 'hData': //Parameter
          rowData[1] = value; //Value in column B
          break;
        case 'cData':
          rowData[2] = value;
          break;
        case 'fData':
          rowData[3] = value;
          break;
        default:
          result = "unsupported parameter";
      }
    }
    Logger.log(JSON.stringify(rowData));

    // Write new row below
    var newRange = sheet.getRange(newRow, 1, 1, rowData.length);
    newRange.setValues([rowData]);
  }

  // Return result of operation
  return ContentService.createTextOutput(result);
}

/**
* Remove leading and trailing single or double quotes
*/
function stripQuotes( value ) {
  return value.replace(/^["']|['"]$/g, "");
}

Credits

Rucksikaa Raajkumar

Rucksikaa Raajkumar

5 projects • 18 followers
I have completed International A/Ls and am currently waiting for university offers. I publish Arduino projects on my blog and help people.

Comments