Internet-of-Things-Based Sensor Module for Respiratory Tracking System

Respiration is a necessary process for producing energy and maintaining normal bodily functioning in all living organisms. The respiratory system and breathing frequency change per the body’s needs in response to different physical activities, such as running, and to emotional states such as joy and fear. Therefore, this work presents a simulation-based Internet-of-Things (IoT) sensor module using thermistors to estimate the respiration rate (RR) of a human subject and to compare the temperature at the time of breathing. The circuit diagram of the explained sensor was designed and validated using simulations with Proteus software. The results are presented in the form of graphs, comparing resistance and voltage. Specifically, the resistance varies with the temperature near the thermistor, subsequently changing the voltage, which is converted into a digital value to calculate the RR and length of respiration. The main focus of the proposed work for developing this basic circuit is to observe the breathing pattern of a person. From the breathing pattern, many physical activities can be predicted, like he is in a consciousness stage or unconsciousness stage, because every physical activity makes an impact on the breathing pattern. The obtained information can be stored and communicated across the cloud, from which the automated respiratory tracking system can manage and monitor accidental situations. In the case of an emergency, the system sends an alert so that necessary steps can be taken to help the user. Finally, we discuss some applications of the proposed module, specifically for reducing accidental deaths.

airways, lungs, and blood vessels. The muscles that support the lungs are also part of the respiratory system. These parts work together to move oxygen around the body and filter out undesirable gases, such as carbon dioxide [1]. In addition to breathing, the respiratory system has many functions that assist in talking and smelling. It is capable of warming air to regulate the body temperature, providing oxygen to cells in the body, and protecting the respiratory tract from harmful substances and irritants. Some common terminologies regarding the respiratory system are given as follows [2]. 1) Residual Air Volume: Volume of air that remains in the lungs and cannot be expelled even after forced expiration. 2) Vital Capacity: The amount of air inhaled and exhaled with maximum effort. In the presented study, we only evaluated changes in RR. When a person inhales, oxygen enters the lungs and passes to the organs. Upon exhalation, carbon dioxide leaves the body. A standard respiratory rate plays a vital role in maintaining the balance of oxygen and carbon dioxide. Normal breathing levels can vary slightly from person to person. The average respiratory rate for healthy adults is between 12 and 20 breaths per minute (bpm), in which carbon dioxide leaves the lungs at the same rate the body produces it. Respiratory levels ≤12 or ≥20 can lead to disruptions in normal respiratory processes. Average breathing rates (per minute) of infants to adults are defined as [3] follows. Year Respiration birth to 1 year 30-60 1-3 years 24-40 3-6 years 22-34 6-12 years 18-30 12-18 years [12][13][14][15][16] Breathing is involuntary but can also be controlled voluntarily, and in certain situations, the body needs to change its breathing rate. For example, when receptors in the brain detect low oxygen or high carbon dioxide, it sends signals to the respiratory muscles to alter the lungs and, thus, the breathing rate. Excessive breathing rate can indicate several things. In some cases, a high or low breathing rate is the result of an activity, such as exercise, and is not a sign that something is wrong. Specific diseases, injuries, and substances can also influence the rate of breathing; in which an excessive respiratory rate may indicate a health problem. A study of more than 15 000 people [4], who had visited the emergency department, showed that a high respiratory rate predicted worsening medical complications after discharge. People with a higher respiratory rate returned to the hospital more often than those with a normal respiratory rate. As mentioned, many factors affect a person's breathing rate, including injury, exercise, mood, emotion, and a range of medical conditions. Common causes for high RR include anxiety, fever, respiratory diseases, heart problems, dehydration, and so on. Factors that can cause a low respiratory rate include drug overdose, obstructive sleep apnea (OSA), head injury, and so on.
A slight change in the standard breathing rate should not be a cause for concern. However, in some cases, too high or too low breathing can signify a problem. The proposed work aimed to construct a sensor that can determine the frequency of both inhalation and exhalation within a minute so that any presenting issues can be quickly identified. From the defined parameters, we can predict different abnormal physical situations that a human subject may encounter. In future works, we plan to add this sensor to the cloud environment with ensured security to further enhance the automated monitoring process, which has an abundance of benefits.
The novelty of this work is the blueprint of a new Internetof-Things (IoT)-based sensor that has been designed to monitor the respiration system of an individual in an auto-mated manner and identify potential problems. If a harmful change is detected, certain measures can be taken to save a life from unavoidable accidents. The sensor circuit was designed using thermistor and tested in the Proteus simulation platform. The proposed sensor can be globally connected via the IoT for the whole automated process interconnected between patients, doctors, and the emergency department. The main contributions of this work are given as follows.
1) The sensor circuit was designed and tested in a simulation model using Proteus software.
2) Analog values obtained from the sensor were used as a reference point for respiratory rate and converted to digital data via a microcontroller.
3) The automated accidental monitoring system can be designed using the proposed IoT sensor module.
The rest of the article is organized as follows. Section II presents the literature survey, Section III explains the proposed methodology, Section IV describes the analysis of results and simulation, Section V introduces the potential applications, Section VI focuses on the comparative analysis, and finally, Section VII concludes the work.

II. LITERATURE SURVEY
The respiratory rate is an imperative measure that can be used to predict health-related accidents in order to save lives and minimize residual damage to the body. An abundance of research has been carried out worldwide to design sensors for monitoring such situations. For instance, an IoT-based accident detection and emergency response system is installed into vehicles and transmits information about an accident to nearby hospitals, fire stations, and police stations via using a GSM communication system. Thereby, help can be rapidly sent to the scene on an emergency basis. This system is an attempt to monitor the accident, by tracking the respiration of the driver or the person available within the vehicle. When an accident occurs and entices fear, an abnormal RR is produced, which is an indicator of the situation. However, the device may face communication issues in a remote area due to the unavailability of GSM networks.
In this study, we designed a blueprint of an IoT module to track the respiratory system and performed a simulation using Proteus software, which can be used for monitoring the accidental situation. A comparative study has reported IoT-based accident detection systems for smart vehicles [6]. The study discusses monitoring the vehicle's accidental situation and mentions specific techniques such as sensors used by the work and the logic behind its function. Here, fear has been taken as an important clue for unexpected problems people may suffer from sunstrokes during summer and so on. To monitor such types of incidents, including vehicle accident systems, an RR tracking system may be helpful. The proposed work is based on this theory to track the RR of human beings and can monitor each individual using the IoT to avoid unwanted accidental events.
In 2013, Zhai et al. [7] presented a theoretical model for a low-cost thermistor-based respiration monitor system that may be treated as a base paper for this study. The proposed sensor architecture and circuit were designed and tested via simulation using Proteus software. The circuit is very compact and can easily fit in a facemask. The whole idea of the proposed work is to design the sensor and add it to the IoT for sharing the information with access permission. As a result, each human being is monitored using this automated system to minimize accidental death. In the proposed work, the concept and sensor circuit design has been discussed.
Cha et al. [8] proposed a pillow designed with a reflective-type PPG sensor and used some simple extraction algorithm to read the respiratory system and, thus, monitor heart rate. This technique can be used during sleep mode or rest mode. In the same year, Kang et al. [9] designed a monitoring system using a gauze mask and a pyroelectric detector, which is an infrared-sensitive optoelectronic component that detects electromagnetic radiation in a wavelength range of 2-14 µm. The sensor identifies the fluctuation of the airflow. In an open place, filtering the respiration using airflow is very difficult and the reading information is also noisy.
Raji et al. [10] proposed an RR tracking system to monitor asthmatic patients, which implements an LM35 sensor to measure temperature differences. However, in this work, we utilized thermistors instead of LM35 or similar sensors since they are cheaper and smaller, can be used in applications where many points have to be sensed and little room is available, cover a more comprehensive temperature range, have two leads and require less power per sensor, and can provide higher accuracy. For example, oceanographic thermistors are designed just for measuring the temperature of seawater that is accurate to less than 0.1 • C in the range from −5 • C to 35 • C. They are useful in circuits where a temperature variable resistor is needed instead of a voltage proportional to temperature.
Agnihotri [11] proposed an I2C interface to communicate the respiratory tracking system sensor to other devices or microcontrollers. As stresses in life have increased over the past years, primarily due to the COVID-19 pandemic, cardiovascular disease [12] has become the leading cause of death. Thus, it is significant that cardiorespiratory status [13] should be closely monitored in order to detect abnormal heart conditions, physiological decline [14], cardiovascular disease [15], and long-term cardiovascular-associated diseases [16] earlier.
In addition, both postoperative treatment [17] and rehabilitation management [18] can be performed at an early stage before any critical situation occurs. It is worth noting that both heart rate and respiratory rate are important parameters for revealing health conditions. To measure these respiration signals, multiple consumer electronics used, which is not suitable for the common public, can monitor cardiorespiratory activity through these symptoms with continuous, noninvasive, and comfortable methods.
The properties of the respiratory system are essential to the good health of the body as a whole. The health and effectiveness of the respiratory system and its pattern are severely modified by a variety of diseases and physiological conditions. Some examples are given as follows.
1) Respiratory Infections: Inflammation, coughing, and trouble breathing can be brought on by respiratory infections such as the common cold, the flu, pneumonia, bronchitis, and TB. The purpose of the aforementioned research [24] was to learn more about the frequency and severity of respiratory infections in a tertiary care facility in southern India. Patients with respiratory infections were tracked for a full year in this study.
Influenza was the most often diagnosed viral infection, and the study indicated that viral respiratory infections were more common than bacterial ones. The most prevalent bacterial illness was pneumonia, and the next most common was bronchitis.
Fever, cough, and sore throat were more common symptoms reported by patients with viral infections, while high fever, chest discomfort, and shortness of breath were more common symptoms reported by patients with bacterial infections. Patients with viral infections were also shown to have shorter hospital stays and less severe illnesses than those with bacterial infections, according to the study.
Because respiratory infections can differ in clinical appearance and severity, the study emphasizes the significance of correct diagnosis and adequate treatment. During peak seasons for influenza and other respiratory viruses, it also highlights the need for effective interventions to prevent and control respiratory infections.
2) Chronic Obstructive Pulmonary Disease (COPD): Breathing becomes more difficult for those with COPD. Tobacco smoking, air pollution, and chemical and dust exposure at work are common causes. The purpose of research [25] was to examine the effects of COPD exacerbations on healthcare outcomes and costs in the U.K. Patients with COPD who suffered exacerbations during a two-year period were the focus of this study.
Healthcare resource use, such as hospitalizations, ER visits, and outpatient consultations, was observed to rise significantly with COPD exacerbations. Patients' lung function, symptoms, and quality of life all declined during exacerbations.
To better patient outcomes and save healthcare costs, the study emphasizes avoiding and controlling COPD exacerbations. It also highlights the importance of implementing measures to lessen the prevalence of COPD-causing environmental irritants, including cigarette smoke and air pollution. The study's authors hypothesize that better disease management and earlier detection of exacerbations might lessen the financial and emotional toll of COPD.
3) Asthma: Inflamed and narrowed airways make breathing difficult for those with asthma, a chronic respiratory disorder. It is often triggered by allergens in the surrounding environment. An article from a scholarly journal about asthma is presented here as an example [26].
This article summarizes what is now understood about how exposure to pollution might trigger asthma attacks. The authors reviewed all available research on how outdoor and indoor pollution and occupational exposures affect asthma prevalence and severity.
The analysis concluded that inhalation of air pollutants, especially PM2.5, NOx, and ozone, is a significant contributor to the onset and worsening of asthma. Tobacco smoke, mold, and volatile organic compounds are all examples of indoor Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.
pollutants that disproportionately affect at-risk populations, such as children and the poor.
Certain activities, including farming and cleaning, are linked to a greater risk of asthma, and the authors note the influence of occupational exposures, such as dust and chemicals, on this risk.
The assessment highlights the need to identify and manage asthma triggers in those who suffer from the condition, as well as the necessity for effective policies to reduce environmental pollution and improve air quality. Exposures at work and low socioeconomic status are two examples of social determinants of health that might exacerbate asthma symptoms in susceptible groups. The authors argue that lowering the toll that asthma takes on people and communities requires an all-encompassing strategy that incorporates public health initiatives, environmental legislation, and individualized asthma management. 4) Obesity: Reduced lung function and an increased vulnerability to respiratory illnesses are both associated with obesity. Extra pounds can make it tough to breathe since they restrict lung movement.
This article [27] summarizes the research between obesity and respiratory illnesses. Obesity is a major risk factor for a number of respiratory disorders, including asthma, COPD, and sleep apnea, as evidenced by a review of the literature conducted by the authors here.
The authors describe the negative effects of obesity on breathing, including diminished lung volume and capacity, increased airway resistance, and weakened respiratory muscles. They also explain how inflammation and metabolic inefficiency brought on by obesity might advance preexisting respiratory conditions.
In light of the current worldwide obesity pandemic, the study emphasizes the need to take action to reduce obesity as a preventable risk factor for respiratory disorders. According to the authors, the prevalence of respiratory disorders can be mitigated by the use of efficient interventions to prevent and manage obesity, such as behavioral change and bariatric surgery. The authors also advocate for more study into the processes connecting obesity and respiratory health, as well as the creation of tailored therapies for those who are both overweight and suffering from respiratory illnesses.

5) Pregnancy:
The strain on the diaphragm caused by the pregnancy hormones and the expanding fetus can make breathing difficult. In addition, respiratory infections are more common in pregnant women.
The physiology of breathing undergoes significant modifications during pregnancy, and this page reviews those alterations. Increased oxygen demand, reduced functional residual capacity, and reduced expiratory reserve volume are just a few of the ways the authors describe how hormonal changes and the developing fetus can alter lung function.
This study also emphasizes pregnant women's heightened vulnerability to respiratory illnesses, especially influenza and pneumonia, and the potential hazards associated with these diseases for both the mother and the unborn. The authors stress the necessity of managing respiratory illnesses properly and vaccinating pregnant women against influenza and pneumococcal.
Clinicians, according to the authors, can better manage respiratory symptoms and problems in pregnant women if they are aware of the changes in respiratory physiology during pregnancy. They also stress the need for more study into the processes driving these shifts and the creation of tailored therapies to boost maternal respiratory health. The overall findings of the review stress the significance of maternal and fetal respiratory health throughout pregnancy.
The respiratory system is closely connected to various body states and physiological processes. Here are some examples of how different body states can impact respiration. 6) Exercise: During exercise, the body requires more oxygen to produce energy. This leads to an increase in breathing rate and depth to deliver more oxygen to the muscles.
Schneiderman et al. [29] provided a comprehensive overview of the literature on the effects of exercise on respiratory health, with a particular emphasis on the positive effects of exercise on lung function and the prevention and treatment of respiratory disorders.
The authors describe how working out can enhance lung function and respiratory muscle strength by increasing breathing rate and depth to supply more oxygen to working muscles. Asthma, COPD, and pulmonary fibrosis are just some of the respiratory ailments discussed, along with how regular exercise may help prevent and treat them.
Exercise treatments may help people with respiratory disorders in a number of ways, including better lung function, fewer symptoms, and higher quality of life, as highlighted in this review. The authors also highlight the significance of tailor-made workout plans based on each person's requirements and limits.
The authors also note that exercise may promote respiratory health in healthy people by lowering the risk of respiratory infections and increasing the efficiency of respiratory muscles. According to their findings, encouraging regular physical exercise is crucial to promoting respiratory health and preventing illness. The review emphasizes the significance of exercise for respiratory health in general, for people who already have breathing problems as well as for healthy people who want to enhance their lung function and prevent breathing problems. 7) Sleep:As oxygen consumption decreases during sleep, so does the respiratory rate. However, sleep disorders, such as sleep apnea, can interrupt normal breathing patterns while you are sleeping.
Prather et al. [30] summarized the current state of knowledge on sleep's effect on lung function. The authors discuss how the reduced oxygen demand during sleep causes a slowing of the respiratory rate. They also discuss the ways in which OSA and other sleep disorders can interrupt normal breathing patterns while one is asleep. This study focuses on OSA because of its great prevalence and the wide variety of negative health consequences it has been linked to, such as cardiovascular disease, metabolic dysfunction, and cognitive impairment. Increased susceptibility to respiratory infections and exacerbations of existing respiratory disorders are only two examples of the negative effects that sleep fragmentation and poor sleep quality have on respiratory health, as described by the authors.
The authors stress that high-risk individuals, such as those with obesity, hypertension, and metabolic diseases, need to be screened for and treated for sleep-disordered breathing as soon as possible. They discuss the various treatments for sleep apnea, such as continuous positive airway pressure (CPAP) therapy, positional therapy, and oral appliances. Improvements in sleep length and quality are only two examples of the sleep hygiene strategies discussed in this study and may have positive effects on respiratory health. The authors claim that treating insomnia and practicing better sleep hygiene might be useful in the treatment and prevention of respiratory diseases.
The overall analysis highlights the significance of sleep for respiratory health and the possible dangers associated with sleep disruptions and sleep-disordered breathing. To improve respiratory health outcomes in people with sleep problems, the authors advocate for more study into the processes behind these connections.
8) Stress and Anxiety: They can lead to shallow and rapid breathing, known as hyperventilation. This can cause dizziness, lightheadedness, and other symptoms. In this overview [31], we look at the research on how stress and anxiety affect breathing. The authors describe how hyperventilation (characterized by shallow, fast breathing) can result from stress and worry, triggering dizziness and other symptoms.
This study focuses on the influence of stress and anxiety on respiratory symptoms and outcomes and underlines their frequency among people with respiratory disorders such as asthma and COPD. Possible mechanisms, such as the part played by stress hormones and inflammation, which underlie these associations, are discussed by the authors. The authors also emphasize the hazards of hyperventilation and other respiratory symptoms linked with stress and anxiety in healthy persons and address the influence of these psychological variables on respiratory health. 9) Altitude: At higher altitudes, the air pressure is lower, which means that there is less oxygen in the air. This can lead to hypoxia [32] a condition where the body does not get enough oxygen, which can cause shortness of breath, fatigue, and other symptoms. The effects of high altitude on breathing are the subject of this review article. The scientists explain that because of decreased air pressure at higher elevations, there is less oxygen available there. This may induce hypoxia, a lack of oxygen in the blood, which manifests itself in a variety of ways, including shortness of breath and weariness.
This study focuses on the increased incidence of respiratory symptoms and diseases, such as COPD and high-altitude pulmonary emphysema (HAPE), among those who reside at high elevations. The effects of hypoxia on pulmonary function and inflammation, among other things, are among the processes the authors explain as contributing to these associations. The authors also address the effects of altitude on the respiratory health of otherwise healthy people, drawing attention to the dangers of hypoxia and other.
10) Aging: As our respiratory system undergoes changes, this can lead to reduced lung function and capacity. This can make it more difficult to breathe and increase the risk of respiratory diseases. The effects of aging on the respiratory system are the focus of this review article. In this article, the authors discuss how age-related alterations to the respiratory system can cause impairments in lung function and capacity. Structures, such as lungs and airways, become less flexible and more resistant to airflow, while functions, such as coughing and breathing, become less effective.
COPD and pneumonia are only two of the many respiratory ailments that affect the elderly that are highlighted in this article. The effects of aging on immune function and inflammation are among the factors the authors describe as contributing to these associations.
The authors also underline the hazards of declining lung function and capacity due to aging, which they describe at length.
The author summarizes that the different body states can impact respiration in various ways, from changes in breathing rate and depth to alterations in oxygen levels. Understanding these relationships can help individuals better manage their respiratory health in different situations.

III. PROPOSED METHODOLOGY
In the proposed work, a respiratory tracking sensor was designed, and all the corresponding parameters were analyzed through a simulation. The proposed sensor can be placed in a face mask to measure changing patterns of the RR, as shown in Fig. 1. Each person was the sensor-enabled face mask. The sensor present in the mask can be integrated with the cloud through the mobile phone for storing and analyzing the collected data. The software application (future work of the proposed work) present in the cloud monitors automatically based on the changes RR and can identify the condition of the human subject to predict the occurrence of a problematic situation and determine whether any necessary action is needed. If any unusual information is identified, the system is directly allotted to individuals, police, and healthcare workers via the cloud portal. Because this information is very sensitive and can be misused by intruders, which may inhibit an individual from getting help, we aim to establish a security policy for accessing such information in future works. In this study, we measured the external body's respiration through the inhalation and exhalation processes. During exhalation, the temperature near the nose increases greater than the surrounding environment temperature. During inhalation, the increased temperature is reduced and matches the environmental temperature. The time between increasing and decreasing temperature is referred to as respiration time, which is directly proportional to the heartbeat and, thus, can be used to predict the subject's situation.
A thermistor, a combination of "thermal" and "resistance," is a protective thermometer or a variable resistor whose resistance is temperature-dependent. It consists of metallic oxide that is pressed into a bead, disk, or cylinder shape and is surrounded by an impermeable material, such as epoxy or glass. There are two types of thermistors: negative temperature coefficient (NTC) and positive temperature coefficient (PTC). With an NTC thermistor, the most commonly used thermistor, resistance decreases as the temperature rises. Comparatively, in a PTC thermistor, which is typically used in a smelter, resistance increases as temperature increases. The basic properties of a thermistor are shown in Table I.

A. Circuit Diagram
The circuit diagram of the proposed sensor is shown in Fig. 2, including the interconnection of all electronic components and current flow within the circuit. This diagram illustrates the potential difference within the circuit at different levels, where RV 1 (T 1 ) and RV 2 (T 2 ) represent two thermistors. Each thermistor functions as a variable resistor, in which the resistance changes as the temperature changes. Hence, for the simulation process, we take two variable resistors in place of the thermistor, labeled RV 1 and RV 2 , in the simulation circuit present in Fig. 6. RV 1 is used to measure ambient temperature, which serves as a reference point, and RV 2 measures the respiration temperature. The results of the simulation are given in Fig. 6 and the Appendix.
In the diagram, the op-amp circuit amplifies the compared voltage, and the output is utilized as an input to the ATmega328P Microcontroller to convert analog voltage to a digital value. The microcontroller is connected to a 16 × 2 LCD to display the resultant digital value. Four voltmeters (V 1 , V 2 , V 3 , and V 4 ) are also used to display the voltage in different sections of the circuit.

B. Mathematical Model
In addition, a potential divider circuit was created to compare ambient and respiration temperatures, as shown in Fig. 3. The basic rules of changing voltage are explained in (1)-(5) based on Ohm's law, where R indicates resistance, I represent current, and V is voltage. Variables A, B, C, and D are used for connecting points. The four resistors are denoted R 1 , R 2 , R 3 , and R 4 , where R 1 is mapped with RV 1 and R 2 is mapped with RV 2 . V 1 displays the voltage change in R 1 , and V 2 displays the voltage change in R 2 . The resultant comparison voltage is displayed as V 3 , and the amplified voltage is noted as V 4 (1) Here, an example is given to further explain the above equations. Suppose that we want to calculate V 1 , V 2 , and V 3 , which are obtained from the simulation in the Appendix. Suppose that RV 1 = 50%, RV 2 = 30%, R 3 = 10 K, R 4 = 10 K, RV 1 = 1 K, and RV 2 = 1 K RV 1 = 50% = 1 K/2 = 0.5 K RV 2 = 30% = 1 K -(30/100) × 1 K = 0.7 K (NTC is used).
As per (1) As per (2) As per (3) Difference due to the resistance of connecting wire. As per (4) = 0.57 ∼ = 0.60 in the simulation table.
Difference due to the resistance of the connecting wire, and now, we can calculate V 3 directly V 3 = −11.4 + 11.26 = −0.14V.
The above example proves that we can find out all the values we derived from the simulation using the above equation.

C. Function of Op-Amp
In this study, a 741IC operational amplifier, or op-amp, amplifies the lower voltage to a higher voltage proportionally. The important pins and functions of 741IC are explained in Fig. 4. Specifically, Pin 2 is used as the inverting input pin, Pin 3 is the noninverting input pin, Pin 4 is connected with maximum negative supply, Pin 7 is biasing with maximum positive supply, and Pin 6 is used for the output. Gain is the parameter that is added to the input voltage, namely gain voltage, and is calculated as Gain = 1 + (R 1 /R 2 ).
As an example, consider R 1 = 47 k and R 2 = 4.7 k. Then,  Suppose that the input voltage = 1.2 V, and then, the output voltage is A simulation of the 741IC op-amp was performed using Proteus software, as shown in Fig. 4, where the resultant voltage is displayed on the voltmeter.

D. Working Procedure
This section presents the working procedure of the whole circuit using a flowchart, as shown in Fig. 5. In the sensor, the ambient temperature is first read from Thermistor 1, which is Authorized licensed use limited to the terms of the applicable license agreement with IEEE. Restrictions apply.

Algorithm 1 Converting Analog to Digital in ATMEGA328P Microcontroller
Set ADMUX Register REFS1, REFS0 bits as 0,0 as AREF is the reference voltage pin Set ADLAR = 0 to set the result stored in 10 bit, ADCH 2bit and ADCL 8bit Select channel 1 for ADC conversion and put the value 00001 in MUX4 to MUX0 Whilel do Set ADSC bit as 1 of ADCSRA register for start conversion Convert ADCL value to integer Convert ADCH value to integer and multiply with 256 digitalvalue = int(ADCL) + (int(ADCH) * 256) Print digital value End while labeled T 1 in Fig. 2 and RV 1 in Fig. 6. Initially, the resistance of T 1 is set as the reference point for Thermistor 2, which reads the respiration temperature and is labeled T 2 in Fig. 2 and RV 2 in Fig. 6. When the user exhales, the temperature is increased in the place of VR 2 and the resistance of VR 2 is decreased. The temperature near VR 2 increased slowly until the exhalation process started. When the exhalation process started the temperature decreased near VR 2 , and by the completion of the inhalation process, the temperature near VR 2 was approximately matched with the temperature near VR 1 , which is the reference point of the ambient temperature. The distance between respiration peak temperature and ambient temperature is the length of the respiration. The compared voltage is then amplified by the op-amp, which is connected to the ADC pin (PC0) of the ATMEGA328P Microcontroller to convert the analog voltage to digital data. Algorithm 1 explains the steps to convert analog to digital data, and in Section IV, we analyze the process using simulation.

IV. RESULT AND DISCUSSION
The analyzed circuit was tested through simulation using Proteus software, as shown in Fig. 6. On the left side of the circuit, Voltmeter 1 (V 1 ) displays the changed voltage across RV 1 , and Voltmeter 2 (V 2 ) shows the voltage across RV 2 . Voltmeter 3 (V 3 ) displays the comparison voltage between RV 1 and RV 2 . Voltmeter 4 (V 4 ) presents the amplified voltage displayed in Voltmeter 3. As mentioned, the microcontroller converts amplified voltage from analog to digital data, which is then displayed on an LCD. The information recorded from the simulation is given in the Appendix.
In Fig. 6, both RV 1 and RV 2 are 50%, which means that the respiration temperature and ambient temperature are equal. According to the simulation data in the Appendix, the voltages across RV 1 and RV 2 are both 0.55 V. In the next stage of the circuit, the comparison voltage is 0, confirming the equality of the ambient temperature and respiration temperature. The digital value in this state is 57, which is considered the base value. In other words, when the respiration temperature increases, the digital value will increase above 57, and when the temperature decreases, the digital value will decrease below 57. By using the NTC Thermistor, the resistance decreases when the temperature increases. Based on the data in the Appendix, we can determine the value when the resistance is reduced in the form of a percentage (this means that the temperature is increased) and the change in voltage rate in different stages. The graphs in Fig. 7 are used to analyze the results of the simulation. Specifically, Fig. 7(a) presents all parameters of the RR sensor, which demonstrates the voltage across T 1 and T 2 in terms of respiration temperature resistance and ambient temperature resistance. Fig. 7(b) indicates the variation in voltage at V 1 , V 2 , and V 3 . Fig. 7(c) shows the digital value of amplified voltage with respect to ambient temperature resistance and respiration temperature resistance. Fig. 7(d) presents the digital value with respect to amplified voltage.

V. APPLICATIONS
The respiratory rate is measured as the number of bpm, typically when a person is at rest. The standard respiratory rate of an adult is 12-16 bpm. The factors that affect the respiratory rate are given as follows: 1) emotional state; 2) physical fitness; 3) internal temperature; 4) diseases and health status.

A. Diseases and Health Status From Respiratory Rate
A respiratory rate under 12 or over 16 bpm while resting is considered abnormal. Respiratory rate is a vital sign of the body, from which we can assess the general physical health of a person and identify clues to possible diseases. The standard respiratory rate can change due to certain conditions, such as asthma, anxiety, pneumonia, congestive heart failure, lung disease, and drug overdose.

B. Blood Loss During Accident and Rate of Respiration
The amount of blood loss during an accident also influences the respiratory rate. For example, if an adult loses 14% of their blood, they will not experience any significant side effects or changes in vital signs. When blood loss reaches 15%-30% of the total blood volume, both the respiratory rate and the heart rate will noticeably be affected. When blood loss reaches 30%-40%, breathing will become more rapid and shallow.
Losing too much blood may lead to hemorrhagic shock, a condition of reduced tissue perfusion (blood supply) that  reduces the adequate supply of oxygen and nutrient required for cellular function. For example, when a person loses 20% or more of their total blood volume, they undergo hemorrhagic shock and may experience rapid breathing.

C. Anxiety or Panic Attacks
Hyperventilation, or fast breathing, is a common symptom of anxiety and panic attacks. In response, the fight or flight response is activated, whereby heart rate, blood pressure, and respiratory rate increase to prepare the body to "fight" or "flight." In present-day society, the concept of solitary living has become pervasive, especially during the COVID-19 pandemic. Due to this type of lonely life, the rise of panic attacks and symptoms of anxiety has been observed due to the virus itself and also having to handle incidents alone, like a fire outburst or home intruder. Thus, it is critical to measure RR to predict the onset of a panic attack.

VI. COMPARATIVE ANALYSIS
The respiratory system is an autonomous function within the body that begins in the mother's womb and ends in death. It automatically changes depending on the body's requirement in response to activity and emotion. By analyzing the changing patterns of respiration, we can predict abnormal conditions within the human body, which is the basis of our proposed work. Many researchers have invested valuable time investigating the accident rate to monitor situations and avoid health-related accidents and damage. Therefore, we designed an RR sensor that can monitor the status of individuals to predict a problem by observing the RR. A detailed comparative analysis is presented in Table II.

VII. CONCLUSION
In this article, we present a simple RR tracking system that can be integrated with the IoT to automatically monitor the human respiratory system and update changes in a database. From the updated information, accidental situations can be predicted automatically, and subsequent alerts will be sent to the corresponding authority for immediate aid. Here, the results of simulating the system are presented as a graph of resistance versus voltage. Although the presented respiration tracking sensor is still in its nascent stage, it already exhibits high potential to inhibit accidental deaths significantly. Future works are suggested to design architectures and algorithms for establishing communication between the sensor and the cloud and enhance security for the entire system.

APPENDIX
See Table III.