Introduction

Health is characterized as a full state of physical, mental, and social well-being and not merely a lack of illness. Health is a fundamental element of people’s need for a better life. Unfortunately, the global health problem has created a dilemma because of certain factors, such as poor health services, the presence of large gaps between rural and urban areas, physicians, and nurses unavailability during the hardest time.

IoT is making any objects internally connected in the recent decade and it has been considered as the next technological revolution. Smart health monitoring mechanism [1, 2], smart parking [3], smart home [4], smart city [5], smart climate [6], industrial sites [7], and agricultural fields [8] are some of the applications of IoT. The most tremendous use of IoT is in healthcare management which provides health and environment condition tracking facilities. IoT is nothing but linking computers to the internet utilizing sensors and networks [9, 10]. These connected components can be used on devices for health monitoring. The used sensors then forward the information to distant locations like M2M, which are machinery for computers, machines for people, handheld devices, or smartphones [11]. It is a simple, energy-efficient, much smarter, scalable, and interoperable way of tracking and optimizing care to any health problem. Nowadays, modern systems are providing a flexible interface [12], assistant devices [13], and mental health management [14] to lead a smart life for the human being.

Heart rate and body temperature are the two most significant indicators for human health. Heart rate is the per-minute amount of heartbeats, commonly known as the pulse rate. To measure the pulse rate, an increase in the blood flow volume can be used by calculating the pulses. Normal heart rate ranges between 60 and 100 beats per minute for healthy people. The typical restful heart for adult males is roughly 70 bpm and for adult females 75 bpm [15]. Female with 12 years of age and above, typically have higher rates of heart in contrast with males. The temperature of human body is simply the heat of body and the sum of heat radiated by the body is scientifically determined. The average person’s body temperature relies on different factors such as ambient temperature, the person’s gender, and his eating habits. In healthy adults, it is likely to range between 97.8 °F (36.5 °C) and 99 °F (37.2 °C). Different factors such as flu, low-temperature hypothermia, or any other illness may lead to a change in body temperature. In almost all illnesses, fever is a typical indicator [16]. Various methods exist to invasively and noninvasively assess the heart rate and body temperature. For the consumer, noninvasive approaches over a while have proven accurate and convenient [17]. It is suggested that a healthcare should provide good room conditions to facilitate the patients [18]. Some measures like room humidity, level of all gases like CO, and CO2 can determine the quality of room environment. The toxic gases and certain levels of humidity are very harmful to patients. For optimum comfort, the room humidity should be between 30 and 65%. Some studies [19, 20] are done only for a smart home, not for dedicated healthcare.

There are several fatal diseases like heart disease [21], diabetes [22], breast cancer [23, 24], liver disorder [25], etc. in medical sector but the main concern of our developed system is to monitor the fundamental signs of all types of patients and the patient’s room environment. This paper proposes a customized healthcare system that monitors the pulse and body temperature of patients as well as room humidity, CO, and CO2 gas level of patient’s room via sensors and transmits the data through Wi-Fi that enables the medical staffs to get data from the server. The developed system also provides a solution for the problem of maintaining a single database of patients in hospitals using a web server, apart from the personalization of critical health-related criteria. In this system, the gas sensor is used to identify an unexpected occurrence that contrasts the performance with the threshold and produces a PPM signal if the output value crosses the threshold.

The rest of the work is organized as follows. “Related Works” section describes the recent development of health monitoring system in IoT environment. The major hardware components which are used to develop the prototype are illustrated in “Major Hardware Components” section. “System Design” section demonstrates the design methodology of the proposed system. The implementation details with user prototype are depicted in “Implementation Details” section. The experimental results are described in “Experimental Results Analysis” section. “Conclusion” section concludes the paper with some future work.

Related Works

Some important works have been done in the field of medical science using IoT to monitor patient’s health. The works associated in this field are outlined as follows.

Tamilselvi et al. [26] developed a health monitoring system that can monitor basic symptoms of a patient like heart rate, percentage of oxygen saturation, body temperature, and eye movement in IoT network. For this purpose, the system used Heartbeat, SpO2, Temperature, and Eye blink sensors as capturing elements and Arduino-UNO as a processing device. The developed system was implemented but no specific performance measures are described for any patient. Acharya et al. [27] introduced a healthcare monitoring kit in IoT environment. The developed system monitored some basic parameters of human health like Heartbeat, ECG, body temperature, and Respiration. The major hardware components which are used here are pulse sensor, temperature sensor, BP sensor, ECG sensor, and raspberry pi. The data were collected from sensors and sent it to raspberry pi for processing and again transmitted it to IoT network. The major drawback of the system is that no interfaces for data visualization are developed.

Banerjee et al. [28] proposed a pulse rate detection system based on a noninvasive technique. The proposed system used plethysmography process and correspondingly displayed the output digitally that made it a real-time monitoring device. The method has proved as reliable for the patient compared to other invasive techniques. Gregoski et al. [29] introduced a smartphone-based heart rate monitoring system. The system used a mobile light and camera to track finger blood flow and calculated blood flow-based cardiac output. The developed system described an integrated device that wirelessly transmitted a person’s pulse to a computer, empowering people to test their heart rate by merely looking at their phones instead of using hands each time. This is an excellent design but it is not feasible if continuous heart monitoring is needed. Oresko et al. [30] mentioned a fully functional cardiovascular disease sensing system for smartphones, identifying a tool that is developed to be the same given sufficient time and monetary resources. The developed prototype only tracked coronary rhythm in real-time, did not track heart rate over time, and could not detect any cardiovascular disease.

Trivedi et al. [31] suggested a mobile device regulated Arduino-based health parameter surveillance framework. The collected sensor data are analog and sent it to the board of Arduino Uno. By the integrated analog to digital converter, the recorded analog values are converted into digital data. Bluetooth transmitted the physical qualities to the developed device. The Bluetooth device used a module not covering a wide area. Kumar et al. [32] developed an adaptive IoT safety monitoring device. The configuration of the framework is separated into 3 layers such as the control layer, the device layer, and the transport layer. A DS18B20 sensor was used for the measurement of body temperature in the control segment and a pulse sensor is used for the pulse measurement. The data were loaded from Arduino into the cloud through the Wi-Fi module and Ethernet shield on the transport layer. The framework layer finally collected the server details. However, Arduino Uno was used here, and hence, many sensors cannot be treated properly. Desai et al. [33] developed a wireless sensor network (WSN) to track smart homes and heartbeat. Here, Spartan3 is used in parallel data processing with FPGA architecture. The MCU results are shown by an LCD, and all sensors are connected with a microcontroller. Nevertheless, all machine elements are not integrated in one unit.

Major Hardware Components

Some sort of hardware components is being used in the proposed system. The components which are used to develop the system are outlined as follows.

ESP32 Processor

ESP32 is one of the main IoT learning tools. This offers a full Linux system on a small platform at a very low price. ESP32 connects device sensors and actuators through GPIO pins. ESP32 and IoT merge to be a new technology for creativity in the healthcare system. ESP32 is designed extremely with integrated antenna switches, RF-balun, control amplification, low-noise amplifier, and filters as well as power management modules. It can function as a complete stand-alone scheme or as a slave to a host MCU, decreasing overhead interaction within the main application processor. EPS32 can communicate with other Wi-Fi and Bluetooth devices via its SPI/SDIO, or I2C/UART interfaces. The ESP32 microcontroller is shown in Fig. 1a.

Fig. 1
figure 1

The hardware components for the healthcare monitoring system. a ESP32 b heart beat sensor c body temperature sensor d room temperature sensor e CO sensor f CO2 sensor

Heart Beat Sensor

The heartbeat sensor is developed based on the plethysmography theory. It measures the change in blood volume through anybody’s organ that causes the light intensity to move through that organ. The timing of the pulses is more critical in systems where the heart pulse rate is to be tracked. The rate of heartbeats determines the distribution of blood volume, and the signal pulses are equal to the pulses of heartbeat when light is consumed by the blood. The heart beat sensor is depicted in Fig. 1b.

Body Temperature Sensor (LM35)

The LM35 series are accurate optimized temperature circuits with output voltage, which is linearly relative to the temperature in centigrade. The LM35 has a vantage point over Kelvin’s linear temperature sensors, as a realistic centigrade scaling does not allow the consumer to delete the huge constant voltage from the display. LM35 is shown in Fig. 1c.

Room Temperature Sensor (DHT11)

DHT11 is a sensor for temperature and humidity which is commonly used. The sensor comes with a dedicated temperature measurement NTC and an 8-bit microcontroller for the processing of temperature and humidity values in series. The sensor is also calibrated by the factory, making it easy to interface with other microcontrollers. The DHT11 sensor is depicted in Fig. 1d.

CO Sensor (MQ-9)

MQ-9 is appropriate for LPG, CO, and CH4 detection. Owing to its high sensitivity and fast response time, measurements can be taken fastly. Using the potentiometer, the sensor’s sensitivity can be modified. The MQ-9 sensor is shown in Fig. 1e.

CO2 Sensor (MQ-135)

For air quality control systems, the MQ-135 gas sensors are used for NH3, Nicotine, Benzene, Smoke, and CO2 detection as well as measurement. The MQ-135 sensor module comes with a digital pin that enables this sensor to work even without a microcontroller and is beneficial for detecting specific gases. The gasses in PPM are calculated using the analog pins. The analog pin is powered by TTL and works on 5 V, and hence it can be used with most modern microcontrollers. The MQ-135 sensor is depicted in Fig. 1f.

System Design

Continuous online patient and patient’s room condition monitoring is the main idea of the proposed system. Therefore, the healthcare monitoring system utilizes the three-stage architectural features, namely (1) Sensor Module (2) Data Processing Module (3) Web User Interface.

The sensors are wired which are used to collect data from the patient’s body and the environment by gathering physiological signs. The collected data are then processed via an ESP32 module and send to the gateway server. For the web user interface, ThingSpeak is used for the graphical interpretation, and display of collected results. ThingSpeak shows the current status and process of transactions. The HTTP protocol provides easy connectivity for the correspondence between a Wi-Fi module and the web server. The HTML user interface is updated every 15 s, allowing patients to be tracked in real-time.

The overall system architecture of the developed system is illustrated in Fig. 2. From Fig. 2, it can be seen that all the sensors are used to collect data from hospital environment. The sensors all are connected to a processing unit called ESP32. Upon attaching these (temperature, heartbeat, gas) sensors, ESP32 works as a heart of the system. ESP32 collects sensor data and then wirelessly transfers them to IoT websites. The board uses its Wi-Fi and its own processing unit, which is Xtensa dual-core 32-bit LX6 microprocessor. The sensor output is then linked to the website of IoT.

Fig. 2
figure 2

The overall system architecture of the healthcare monitoring system

The data are accessed through any network supported device. There, the data are graphically shown and it is a channel-based system, and every time while accessing it needs password.

Implementation Details

The system is implemented using the combination of hardware components. All the hardware components are assembled in the implementation phase. The circuit diagram of the developed system is demonstrated in Fig. 3a. All the sensors are connected with ESP32 using physical pins. ESP32 is used as a processing device as it has a built-in Wi-Fi module. For all sensors, the Vcc and GND are connected with the Vcc and GND pin of ESP32. In the case of heart beat sensor, the signal pin is connected with D26 pin of ESP32. The data pin of LM35 is mapped with D35 pin of microcontroller (ESP32). These are the case with a specific patient. For room condition monitoring, the data pin of DHT11 is linked with ESP32’s D14 pin. In the implementation, DHT11 is only considered for room humidity measurement. The digital out pin of MQ-9 and MQ-135 are connected with D27 and D34 of ESP32, respectively, for the measurement of toxic gases in room environment.

Fig. 3
figure 3

Implementation details of the proposed system. a Circuit diagram b user prototype

The user prototype is depicted in Fig. 3b where the system is tested with one user. From Fig. 3b, it can be shown that the hand of one user is attached with body temperature sensor (LM35) and the data are displayed in the web server.

Experimental Results Analysis

The developed system was tested with various subjects of different ages in different conditions. In the test cases, for heartbeat, body temperature, and room temperature sensors, we manually calculated the actual value and observed value from the developed system. Here, the room temperature sensor is used to measure the humidity only. From the data, we measured error rate to show the effectiveness of the system. As there is no alternative way to measure the toxic gas level, we just show the data of MQ-9 and MQ-135 in the web server. The actual and observed data with error rate for heartbeat, body temperature, and room temperature sensors are demonstrated in Tables 1, 2 and 3, respectively.

Table 1 Heart rate data collected by analog machine (actual) and developed system (observed)
Table 2 Body temperature data collected by analog machine (actual) and developed system (observed)
Table 3 Room humidity data collected by analog machine (actual) and developed system (observed)

To analyze the deviation of data obtained by the developed system from actual data, Fig. 4 is depicted here. From Fig. 4, it is shown that there is some deviation between the actual and observed data. Figure 4a represents the data for heart rate which are collected using six different subjects of different ages in hospital environment. The deviation is occurred due to motion artifact which is caused by the movement of patients during treatment. Sometimes, the sensor is displaced that leads to inaccurate data. Moreover, scattering of light from other sources causes deviation. The deviation of body temperature is found due to the miss-positioning of the system and environmental effect that is shown in Fig. 4b. The discrepancy in the case of room humidity is illustrated in Fig. 4c that is happened due to weather (sunny or rainy) of that day.

Fig. 4
figure 4

Test results of the actual and calculated value. a Heart rate b body temperature c room humidity

The error rate of the developed system for heart rate, body temperature, and room humidity measurement is demonstrated in Fig. 5a–c, respectively. The highest error rate for the three cases is 4.28%, 0.81%, and 3.07% individually and the lowest cases are 1.49%, 0.41%, and 1.47%, respectively. It is notable that for all every case, the error rate is not more than 5% which is acceptable.

Fig. 5
figure 5

The error rate of the developed system for each case. a Heart rate b body temperature c room humidity

A snapshot of the continuously collected data in web server (ThingSpeak) is illustrated in Fig. 6. The level toxic gases (CO and CO2) are measured in ppm unit. Any medical staff can easily monitor the specific patient as well as the room condition where the patient is now through any type of device which has internet access. The patient data here is secure because for accessing data, one needs to pass through a password protected system, i.e., only the authentic staff can monitor the system. By analyzing data, a doctor can easily decide on from a remote location. For a smart health environment, there is some specific level of the threshold for these measurements. When the data crosses the level, then the medical staff can easily take necessary steps for healthcare.

Fig. 6
figure 6

A snapshot of web server for data visualization. a Heart rate b body temperature c room humidity d level of CO e level of CO2

Conclusion

The system introduced smart healthcare to monitor the basic important signs of patients like heart rate, body temperature, and some measures of hospital room’s condition such as room humidity, the level of CO and CO2 gases. The rate of success between the observed data and actual data is approximately greater than 95% for all cases of the developed healthcare system. Authentic medical staff can view and track the data in real-time even though the patients perform the tests outside of the hospital. The system can also benefit nurses and doctors in situations of epidemics or crises as raw medical data can be analyzed in a short time. The developed prototype is very simple to design and use. The system is very useful in the case of infectious disease like a novel coronavirus (COVID-19) treatment. The developed system will improve the current healthcare system that may protect lots of lives from death.

Although the system looks somewhat bulky, it will be a tiny device by proper manufacturing in the near future. The video feature can be added for face to face consultation between the doctors and patients. Some more measures which are very significant to determine a patient’s condition like the level of diabetes, respiration monitoring, etc. can be addressed as future work.