IoT based Patient monitoring System using ESP8266, Arduino & Android Bluetooth App

(Last Updated On: October 19, 2019)

IoT based Patient monitoring System

Description:

IoT based Patient Monitoring System– In this tutorial, you will learn how to make an IoT based Patient monitoring system using Nodemcu ESP8266 Wifi module, Arduino, HC-05 Bluetooth Module and Cell phone Applications. This is an advanced level project and is entirely different from all the existing Patient monitoring systems available.

IoT based Patient monitoring System

In this project, two different cell phone applications are used for monitoring the patient temperature and BPM “Beats Per Minute”. One application is designed in Blynk while the other Cell Phone application is designed in Android Studio.

IoT based Patient monitoring System

With the help of this application the patient BPM, temperature in centigrade and Fahrenheit with two decimal points precision can be monitored from anywhere around the world. With the help of this application, the Doctor can monitor the patient in real-time from anywhere so far the internet connection is available.

IoT based Patient monitoring System


While this application can be used by the family members to wirelessly monitor the patient temperature and BPM. I have a separate video on the android cell phone application designing for the Bluetooth. I will provide a link in the related projects section given at the end of this article.

This project is designed in a way that it can be easily modified by anyone and more sensors can be interfaced. To accommodate more sensors I am using Arduino and Nodemcu esp8266 Wifi module together.

The components and tools used in this project can be purchased from Amazon, the components Purchase links are given below:

Nodemcu esp8266 wifi module: Best price https://amzn.to/2NAvmiB
Pulse Sensor: https://amzn.to/2zGiWfE
DS18b20 water proof temperature sensor: https://amzn.to/2MMO6uc
HC-05 Bluetooth Module: https://amzn.to/2ZCHII5
LM7805 Voltage Regulator: https://amzn.to/2IZEl5x
Potentiometer: https://amzn.to/2JSLbfg
330 ohm resistors pack: https://amzn.to/2NtlAeh
5v 2A adaptor: https://amzn.to/2GsNfcw
2n2222 npn transistors: https://amzn.to/2EmXsIb
10k Resistor: https://amzn.to/2KTd6OW
lm7805 Voltage Regulator: https://amzn.to/2IZEl5x
330-ohm resistors pack: https://amzn.to/2NtlAeh
LDR pack: https://amzn.to/2m2khGR
female DC power jack socket: https://amzn.to/2KEo1gt
470 uf capacitors: https://amzn.to/2xDCOzf
5×7 cm vero board: https://amzn.to/2OHGbvn
female headers: https://amzn.to/2zqmtiJ
connection wires: https://amzn.to/2DpBuW7
Super Starter kit for Beginners: https://amzn.to/2KJvmKG
Jumper Wires: https://amzn.to/2KMoVXs
Bread Board: https://amzn.to/2MS4q8X
12v Adaptor: https://amzn.to/2Ntr6h1
PCB plate: https://amzn.to/2IUwpCt
Variable Supply: https://amzn.to/2MT4Qfj
Digital Multimeter: https://amzn.to/2Nvft9i
Vero Board / strip board: https://amzn.to/2MTf9jD
Soldering iron kit: “best” You guys should definitely purchase this: https://amzn.to/2zfoNuJ
Solder wire: https://amzn.to/2ufUMWf
Wire Stripper: https://amzn.to/2KOqxfU
wire cutter: https://amzn.to/2ucIq14
PCB small portable drill machine: https://amzn.to/2Nu62XF

DISCLAIMER:

Please Note: these are affiliate links. I may make a commission if you buy the components through these links. I would appreciate your support in this way!


Circuit Diagram:

IoT based Patient monitoring System

This is the complete circuit diagram designed in Cadsoft Eagle 9.1.0 version. If you want to learn how to make a schematic and PCB, then watch the video tutorial given below.

 

 

Let’s start with the DS18b20 waterproof one-wire digital temperature sensor. As you can see a 330-ohm resistor is connected between the VCC and data wires. You can also use a 4.7k resistor. The VCC is connected with 3.3 volts. The data wire is connected with the Arduino’s digital pin 4. While the ground is connected with the Arduino’s ground.

The VCC pin of the pulse sensor is connected with the Arduino’s 3.3 volts, but you can also connect this with the 5 volts. The S Pin of the pulse sensor is connected with the analog pin A0 and the ground pin of the pulse sensor is connected with the Arduino’s ground.


This Power Supply is based on the famous LM7805 voltage regulator. J1 is the female power jack and this is where we connect a 12v adaptor or battery. Two 470uf capacitors are connected at the input and output sides of the voltage regulator. A 330-ohm resistor is connected in series with a 2.5v led. This is a current limiting resistor. The output of the voltage regulator is connected with the Vin pin of the Nodemcu esp8266 wifi module and the ground is connected with the ground. SV1 and SV2 are the female headers.

The HC05 or HC06 Bluetooth module is powered up using 3.3 volts from the Nodemcu Module. The ground of the Bluetooth module is connected with the ground of the Nodemcu Module, make sure you connect the ground of the Nodemcu Module with the Ground of the Arduino. The TX and RX pins of the Bluetooth module are connected with the Arduino’s Pin number 7 and Pin number 8. Pin number 7 is the RX while pin number 8 is the TX which will be defined in the programming.


IoT based Patient monitoring System

This is the final Nodemcu ESP8266 Wifi Module Power Supply circuit board. I have a separate video on how to design the PCB, how to place an online order.

I also have a separate video on how to change the name of the Bluetooth module and how to change the password. This tutorial explains everything you need to know about the HC-05 or HC-06 Bluetooth Module.

 

IoT based Patient monitoring System

This is the Pulse Sensor which I am using in this project for measuring the heartbeats, I personally don’t like this sensor and I am searching for another sensor, but right now this is what I have for now. If you have never used this sensor then I recommend you should watch my previous two tutorials on the Pulse Sensor which explains everything. You can find links in the related projects section.



Android cell phone Application:

The Bluetooth cell phone application is designed in Android Studio. I have a very detailed tutorial on how to design your own android cell phone application. The APK file of this project can be downloaded by clicking on the following link.

Download Patient Monitoring Application: patient monitoring application

If you want to learn how to make your own android application then you can watch the following video for the demonstration.

 

Blynk Application Designing:

  • First of all, open the Blynk application…
  • Set the project name as IoT Patient…
  • Click on the choose device and select Nodemcu….
  • Make sure you set the connection type to wifi and then click on the create button, an authentication token will be sent on your email id, which will be then used in the programming, simply copy and paste it in the programming …
  • Click anywhere on the screen and search for the gauge and add it…
  • Now click on the gauge set the name…
  • Click on the pin and select virtual pin V3…
  • Set the maximum value to 50, Change the Font size, click on the push button and select 1 second…
  • Now again click on the screen and add another gauge, follow the same exact steps but select virtual pin V4…
  • Now again click on the screen and this time search of the LCD widget and add it…
  • Select the input type as advanced…
  • Click on the pin and select virtual pin V5. That’s it.

If you find it difficult to follow these steps then you can watch my video given at the end of this article, which practically explains all the steps.

Programming:

In this project two programs are used, one program is written for the Arduino while the other program is written for the Nodemcu ESP8266 Wifi Module. Before you start the programming, first of all, make sure that you download all the necessary libraries used in the making of the IoT based Patient Monitoring System.

Download Libraries

Let’s first start with the Arduino programming.

Patient monitoring system Arduino Programming:


IoT Based Patient Monitoring System Arduino Program Explanation:

The Arduino communicates with the Nodemcu Module and Bluetooth module using Serial communication. As you know in Arduino we have only one serial port which is on pin number 0 and pin number 1. This is the Arduino’s Default serial port which I am going to use only for the debugging purposes.

To communicate with the Nodemcu module and Bluetooth module I defined two serial ports with the names Nodemcu and blue. The Nodemcu module is connected with the Arduino’s pin number 2 and pin number 3. While the Bluetooth module is connected with the Arduino’s pin number 7 and pin number 8.

The pulse sensor is connected with the Analog pin A0 of the Arduino.

const int LED13 = 13;          // The on-board Arduino LED, close to PIN 13.

int Threshold = 550;           // Determine which Signal to “count as a beat” and which to ignore.

                               // Use the “Gettting Started Project” to fine-tune Threshold Value beyond default setting.

                               // Otherwise leave the default “550” value

PulseSensorPlayground pulseSensor;  // Creates an instance of the PulseSensorPlayground object called “pulseSensor”

// for ds18b20 temperature sensor

#define ONE_WIRE_BUS 4

OneWire oneWire(ONE_WIRE_BUS);

DallasTemperature sensors(&oneWire);

 float Celcius=0;

 float Fahrenheit=0;

String cdata; // complete data, consisting of sensors values

int sdata1 = 0; // temperature centigrade

int sdata2 = 0; // temperature Farenheit

char buff[10];

String tempc;

String tempf;

These lines are already explained in my previous pulse sensor based projects and DS18B20 Water proof temperature sensor based projects. I simply combined the two programs.  Check the related projects section.

In the void setup function, I activated the serial communication. The rest of the functions are exactly the same as explained in my previous tutorials.


Then starts the void loop function. The Beats Per Minute value is stored in the variable myBPM.

  sensors.requestTemperatures();

  Celcius=sensors.getTempCByIndex(0);

  Fahrenheit=sensors.toFahrenheit(Celcius);

These instructions are used to read the temperature in Celsius and Fahrenheit.

The temperature values are converted into string values with 2 decimal points precision. Finally, I created a complete message consisting of the temperature and BPM values. Then these values are sent to the serial monitor, Nodemcu module and Bluetooth module.  Now let’s discuss the Nodemcu Programming.

IoT Patient Monitoring System Nodemcu ESP8266 Programming:



IoT Based Patient Monitoring System Nodemcu ESP8266 Program explanation:

If you are using the Nodemcu Module for the first time, then I highly recommend first watch my getting started tutorials, in which I explained how to install the Nodemcu board and how to write a basic program to control an LED and how to monitor the LDR. These tutorials will help you how to use the Nodemcu module for the first time. These tutorials are available on my YouTube channel “Electronic Clinic”. I have a dedicated playlist for Nodemcu based projects and tutorials.

This is exactly the same program which I used in the IoT based weather station monitoring system. In this program, I did a few changes. I defined a virtual pin for the LCD widget and

Increased number of variables from two to three.

      lcd.clear();

    lcd.print(0,0,”BPM:”);

    lcd.print(11,0,thirdVal);

     lcd.print(0,1,”ElectroniClinic”);

Added these instructions which are used to display the BPM value on the LCD widget.

String getValue(String data, char separator, int index)

{

    int found = 0;

    int strIndex[] = { 0, -1 };

    int maxIndex = data.length() – 1;

    for (int i = 0; i <= maxIndex && found <= index; i++) {

        if (data.charAt(i) == separator || i == maxIndex) {

            found++;

            strIndex[0] = strIndex[1] + 1;

            strIndex[1] = (i == maxIndex) ? i+1 : i;

        }

    }

    return found > index ? data.substring(strIndex[0], strIndex[1]) : “”;

}


This is the same function I have been using in all of my Arduino + Nodemcu projects. This function is used to split the string message using the comma as the delimiter. So that’s all about the programming. For the practical demonstration and step by step designing watch video tutorial given below. Support my YouTube channel by Subscribing, and don’t forget to like and share this video. If you have any questions, let me know in a comment.

Watch Video Tutorial:

 

Related projects:

Pulse Sensor/ Heartbeat Rate/ Heart rate measurement using Arduino & Bluetooth

 

Pulse Sensor/ Heartbeat Rate (BPM) measurement using Arduino & Pulse Sensor “Stable BPM value”

 

Arduino Libraries Download and Projects they are used in “Project codes”

 

 

 

 

Recommended For You

About the Author: Engr Fahad

My name is Shahzada Fahad and I am an Electrical Engineer. I have been doing Job in UAE as a site engineer in an Electrical Construction Company. Currently, I am running my own YouTube channel "Electronic Clinic", and managing this Website. My Hobbies are * Watching Movies * Music * Martial Arts * Photography * Travelling * Make Sketches and so on...

Leave a Reply

Close