{'fraction_non_alphanumeric': 0.021956856702619414, 'fraction_numerical': 0.007490155795240541, 'mean_word_length': 4.844172086043021, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Wearable Device for Yogic Breathing with Real-Time Heart Rate and Posture Monitoring

Background: Yogic breathing also called as “Pranayama” is practiced with inhalation (Pooraka), holding the breath for some time (Kumbhaka) and then exhalation (Rechaka). The effective methods of yogic breathing keep oneself healthy and also improves immunity power. The yogic breathing can be practiced irrespective of one's age and gender and even in the office which helps to reduce the stress. To get the best results through yoga, a person has to follow certain timings and sit in a correct posture. Although many devices are existing in the market to monitor heart rate, posture and breathing during physical activity, there is a need of a device which is simple, cheap, and easy to use without an additional requirement of a smartphone. Moreover, the proposed device is able to evaluate the breathing data by transmitting it to a webpage through a Wi-Fi hotspot of the Microcontroller. Methods: The developed device has two subsystems: (i) A wrist subsystem to measure the heart rate, visual aid of breathing and vibration feedback for kapalabhati. (ii) A waist subsystem to monitor the posture with help of flex sensor and the results are displayed on the display of the wrist device. It also provides vibration feedback. The inertial measurement unit is used for breath detection. The subsystems are communicated through SPI communication. The breathing data are transmitted to a webpage through a Wi-Fi hotspot of the microcontroller. Results: The various yogic breathing and normal breathing exercises are tested on different normal subjects using the developed device and analyzed. The heart rate and beats per minute are evaluated. The heart rate sensor is validated using a standard medical device and it is observed that there was a 97.4% accuracy. Conclusion: The results show that the device is able to accurately monitor different kinds of breathing and additionally provide heart rate and posture information while performing the breathing exercises.


Introduction
Yogic breathing helps to experience its true essence. The steady in and out the action of breathing creates and stimulates a transformation in the body and mind, purifying and cleansing them so that our true essence shines forth. The yogic breathing is practiced as inhalation (Pooraka), holding the breath (Kumbhaka), and exhalation (Rechaka) for a particular duration. This way there is a conscious controlled rhythmic pattern of breathing. Further different advanced yogic breathing techniques, such as "Kapalabhati," "Bhastrika" pranayama can also be practiced. The systematic practice of yogic breathing and exercises has their unique benefits on the body and mind which helps in improving health. Yoga is a body-mind practice. Breath is the key link between body and mind. Effective breathing not only brings health to our organs but also balances the nervous system, and calms the mind. Pranayama traditionally practiced by chanting "Gayathri mantra" in ancient days. This was done early in the morning during sunrise to prepare mind and body for the day.
The work stress brings increase in heart rate and systolic blood pressure (BP) and lowers 24-h vagal tone. [1] This in turn leads to an increase in cardiac diseases. With yogic breathing exercises, it is possible to normalize the heart rate and BP. Hence, Yogic breathing is an effective solution to maintain one's health despite a busy stressful schedule.
These days everyone is extremely busy, especially the working who has a very stressful sedentary work pattern which may contribute to poor health and consequential lifestyle disorders. These poor sitting postures cause mild to severe back and neck aches, which when neglected, lead to postural deformities of Vertebral bodies. Most of us do not give importance to these aspects and later succumb to several lifestyle issues. Correction of our posture, therefore, plays an important role in keeping ourselves fit and healthy. Yoga is one of the perfect ways to correct our posture. Yogic postures (Asanas) have soothing effects on both body and mind and hence can flush out negative thinking linked to depression and anxiety. Harvard Medical School conducted a study on yoga and states that practicing yoga works by modulating stress response systems. This leads to a reduction in heart rate and a healthier level of BP. The systolic and diastolic BP has decreased significantly on a few volunteers with a slight fall in heart rate while testing. [2] The study was done on volunteers who practiced "bhastrika pranayamic" breathing (respiratory rate 6/min) for 5 min.
Research of diaphragmatic breathing practice on healthy adults showed that it improves the cognitive performance and reduces negative subjective and physiological consequences of stress. [3] The paper also shows that deep breathing links mind and body together to regulate the information processing related to attention. Breathing at resonance frequency shows greater heart rate variability biofeedback (HRVB) and lowers BP due to stress; [4] also has a more positive effect on the mood of an individual. People having higher heart rate variability (HRV) are more resilient physically and emotionally. There is an increase in HRV with a slow breathing exercise and is showed through a higher HRVB. A study on slow breathing exercises on individuals showed that it has benefits on cardiovascular autonomic regulation in health and also on cardiovascular diseases. [5] HRV is measured using the R-R interval (QRS peak) on an electrocardiogram with the beat-to-beat variation reflecting the chaotic properties of the heart. There are a variety of different algorithmic approaches for operationalizing HRV. [6][7][8] The differences are observed in respiratory patterns under different conditions [9] for intra-and inter-individual. The results showed that the differences in respiratory patterns may influence the HRV spectra independent of autonomic output. [10] The entrainment between HR, BP, and the relaxation response result from breathing at an optimal frequency occurring at large-amplitude HR oscillations at low frequency are called as resonance. [11] Instead of sympathetic tone resonance are produced which are also known as "coherence." Such entrainment of heart rhythm coherence may lead to improved BP control and gas exchange via efficient ventilation/perfusion matching. [11,12] The article [13] suggests that with yoga practice there will be an increase in HRV and vagal dominance due to the effect of cardiac autonomic regulation. The spectral analysis of heart rate and BP variability measurements have shown that there is a notable change in respiratory rate with postural changes. [14] The sitting postures very much influences our breathing. The proper sitting posture results in an increase in lung capacity and expiratory flow. [15] To improve the efficiency of assessing the health, posture signals of the human body are analyzed using Wireless Body Area Network. Hence, designing a wearable sensor system for posture recognition and an algorithm with high posture recognition rate are of great significance. [16] A review is done on research activity about wearable motion detectors for physical activity monitoring and assessment. [17,18] The posture and movements are classified while estimating the energy expenditure, and also balance control is studied. [18] A wearable device "Prana" [19] available in the market for yogic breathing, which keeps track of both breathing and posture. It is a portable device which can be placed in the waistband. It displays all data on a smartphone application which is connected through Bluetooth. The different games are supported by this device for practicing breathing exercises. Spire and Being are devices designed for stress and breath pattern recognition. [20,21] It detects the stress and tells the user to breathe well. Being is available in the form a smartwatch which has a heart rate sensor and an inbuilt display. However, Spire does not have these features. The limitations of these two devices are they do not track posture. A device is designed to track heart rate while practicing "pranayama." [22] This helps to compare the heart rate of an individual with the average range heart rate of that particular age group. A wearable device for detecting heart rate, posture, and quantitative physical activities were designed for improving or to maintain the workouts. [23,24] The wearable devices such as smartwatches and fitness bands for health monitoring are available in the market. Even though these devices monitor breath, posture, heart rate, etc., they connect to a smartphone over Bluetooth to display the information and control the device. [25] And they are not cost-efficient. The proposed device is compact, provides visual information of the posture, breathing, and heart rate. In yogic breathing, it is very important to monitor the duration of breath such as inhalation, exhalation, and pause in between. Furthermore, a bad posture leads to less intake of oxygen/air. [15] To make the breathing exercises more effective it is essential to monitor both duration of breath and sitting posture and hence improvement in health.
The major objectives of this work are: • Developing a wearable device which can monitor yogic breathing along with heart rate, breathe and posture • The device should have an in-built display and touchpads to visualize the breathing information without the need for a smartphone • Developing a low-cost device which is good enough to be used for monitoring yogic breathing as well as normal breathing for breath analysis • To enhance the practicality of the device, the breathing data of patients can be transmitted wirelessly through the Wi-Fi hotspot of the microcontroller.
An individual who wish to practice yogic breathing and exercises with proper monitoring which in turn improves the health, the proposed device will be useful. This wearable device can be used even in the office to keep track of their breathing and heart rate. Even they can ensure that they are sitting in the right posture. It is also useful to the patients having breathing problems; they can monitor their breath and check breathing capacity.

Methodology
Wearable sensors are placed on different parts of the human body where the movements have to be studied.
In most of the studies, motion sensors are placed on the waist, as it is close to the center of mass of the human body. An accelerometer is most appropriate to estimate the movements. With the help of waist-worn accelerometer, daily activities such as walking, postures are classified. [26][27][28] Vertical acceleration patterns were used to identify the sit-stand postural transitions. [27] To monitor breathing such as pranayama in a correct posture and also to measure the heart rate a wearable device is developed. It has two subsystems: 1. Wrist subsystem: This subsystem is used to measure the heart rate, visual aid of breathing, and vibration feedback for kapalabhati. The system has microcontroller interfaced with an OLED display of 0.96 inches, pulse sensor and vibration motor and a touchpad to navigate the UI. The entire system is powered by 3.7V Li-Ion rechargeable battery of 1020 mAh capacity which is charged over micro-USB socket. Figure 1 shows the entire circuit diagram. The vibration motor used here is coin type which is very small and hence does not interfere with Arduino board. Its specification is as follows: Max. Current : 90 mA, speed : 9000 ± 2000RPM, operating voltage: 2.2-4V DC, motor diameter: 10 mm. Motor thickness: 3.4 mm 2. Waist subsystem: This subsystem is used to monitor the posture and also provides vibration feedback. The system has microcontroller interfaced with inertial measurement unit (IMU) MPU 6050 for monitoring breath, flex sensor used to monitor the posture, and vibration motor to support vibration feedback. 9V high-quality battery is used to power the system. The circuit diagram of waist subsystem is shown in Figure 2.
The vibration motor used is of eccentric rotating mass type and was placed on the posture and breathe sensing belt to provide feedback based on posture. This is connected to Arduino for alerting the user about the posture (independent of breathing exercise);while the vibration motor on NodeMCU (wrist subsystem) is used for providing alerts related to breathing exercise being performed. If both were combined user will have to check each time if alert was for breathing exercise or for the posture.
The subsystems are communicated through SPI communication. The various breathing exercises and patterns are tested on different subjects using the developed device. The yogic breathing data obtained are further analyzed.
The designed device to be worn on the wrist is shown in Figure 3. The waist structure interfaced with IMU MPU 6050 and flex sensor is shown in Figure 4. IMUs consist of accelerometers, gyroscopes, and magnetometers. They are miniaturized portable devices. The relative motion between the two IMUs was used to measure the angle of interest by fixing them in two different locations. Specifically, IMUs attached to the sternum and humerus, respectively, were used to compute shoulder elevation in real-time. [29] IMUs capture the data information up to three orthogonal axes about acceleration, angular velocity, and magnetic field strength. The MPU 6050 is used for breath detection through gyroscope for normal breathing such as short breath and deep breath. As there is only exhalation with a faster rate in kapalabhathi, an accelerometer is used for measuring the breath. The flex sensor is used as a posture sensor and placed in such a way that angular slope varies by expansion and contraction of the lower abdomen. The length of flex sensor is 4.5". The flat resistance is 10K and resistance varies from 60K to 110K when bent. Flex sensor is paired with 10K-ohm resistor which acts as voltage divider. The output (o/p) of voltage divider is given to analog pin of microcontroller which converts it into digital using inbuilt ADC. Based on bending o/p voltage varies which is measured by microcontroller.
Gyroscope on MPU 6050 is used to measure the angle of a slope which changes while breathing as represented in Figure 5. During inhaling length, "A" becomes larger as the elastic band worn around the stomach stretches and on exhaling returns the elastic back to upstretched state reducing the length A. The ends of cardboard structure are joined to the elastic band at point 1, 2, and 5 in following manner:

During inhale as length A increases, height B (distance between point 4 and 5) decreases. This in turn reduces the angle Θ 2. During exhale as length A decreases, height B increases.
This in turn increases the angle Θ.
This change in angle is measured by the gyroscope of MPU 6050 that is placed between point 3 and 5.
The accelerometer in the MPU 6050 is used to monitor the sudden and strong movement of stomach during Kapalabhati. The cardboard structure gets accelerated on powerful exhale as the height B increases rapidly on sudden contraction of stomach. This spike in acceleration represents a single breath during Kapalabhati. Breath analysis is done by monitoring the pitch and acceleration values. The inhaling and exhaling show rising angular slope and falling angular slope due to contraction and expansion respectively in the lower abdomen.

Results
The heart rate is measured using a pulse sensor. The pulse sensor has an operating voltage of 5V, operating current 4 mA and has analog output. It is combination of LED and ambient light sensor on the surface which will be placed on the fingertip. Fingertips have veins that are close to skin surface. The light emitted by the LED is reflected back through the finger which is measured by ambient light sensor. As heart pumps the blood, deoxygenated blood is darker than the oxygenated blood hence varies the amount of light reflected back. This is measured by the ambient The obtained data resembles with the data obtained through medical equipment Samsung Galaxy S6e Edge. [25] The calculated beats per minute (BPM) taken using low-cost pulse plotter of the developed device are compared with serial plotter of Samsung galaxy s6 edge. The results show 97.4% accuracy as shown in Figure 6. The various postures are categorized through different readings of flex sensor which is based on the variation in resistance.
The breathing without pause data such has time taken for inhalation and exhalation for a deep breath, short breath and "kapalabhati" along with BPM for different subjects are shown in Figure 7. The data obtained through normal, healthy controls. The normal breath and deep breaths are counted separately in "Normal Breath" option. This helps the user to know the number of deep breaths taken. Figure 8 shows the results of normal breathing. Normal breathing is used to monitor the breath while a person is working or taking rest. Short breaths indicate stress. This information can be used to improve the normal breathing. Breath with pause results is shown in Figure 9. Table 1 shows the obtained breath ratio. It is clear from the results obtained that the MPU 6050 can track yogic breathing exercise successfully. Only pitch values are considered for breath analysis ignoring yaw and roll. The peak counts are used to count the number of breath. The pitch values plotted in Figure 10 for breath without pause is analyzed to design the algorithm to detect breaths. Inhalation or exhalation is detected by taking the difference between the current value and the previous value of pitch. The value of the difference is negative for upward slope and positive for downward slope. Change from positive to negative gives the position of the trough and change from negative to positive gives the position of the peak. The time difference between a current trough and previous peak gives inhale duration while the time difference between current peak and current trough gives exhale duration.
Plot for pitch values for breath with pause given in Figure 11 shows that pause in breath does not mean that the pitch values do not change. The difference between the current pitch value and previous pitch value is smaller represented by a gentle slope. This of course depends on the user's ability to hold the breath properly without any movement in the lower abdomen. If there is no movement in the lower abdomen during the pause, then we will get approximately straight lines with few small peaks as shown during exhale pause in Figure 11. Inexperienced users will not be able to do this and hence the changes in pitch value due to movement will have to be considered while designing the algorithm.
Since the slope is gentle, a small difference in value can  is detected by a sudden change in pitch value from high negative difference to low positive/negative difference. Beginning of inhalation (end of exhalation pause) is detected by a change from low positive/negative difference to high positive difference. Similarly, beginning of exhale (end of inhale pause) is detected by a change from low positive/negative difference to high negative difference. By detecting the position of these four points in time, we can obtain the duration of inhalation, pause in between inhalation, duration of exhalation and pause in between exhalation. The information displayed for various breaths is shown in Figure 12. The device can accurately track a different kind of breathing as shown in the figures. In addition, the device can show BPM accurately while breathing.

Discussion
The designed prototype device was tested on various candidates. It failed to detect breaths for breath with a pause in most cases and breath without pause in some cases. Hence, the breath plot of the individual on whom the device was originally tested was compared with that of the new individual. Comparing Figure 13a and b, we can see that the wave for an original individual for whom the device was tested while designing it, has higher amplitude compared to that of the new individual. In addition, the difference between reading 1 and reading 2 for the original individual is higher than that of the new individual. The difference in amplitude is due to the extent of expansion of belly during breathing varies from person to person. Since a threshold difference is used to classify between high difference from low difference, i.e., a steep slope while inhaling/exhaling from a gentle slope while inhale/exhale pause. This threshold value depends on the amplitude of the wave which has to be considered to detect the breaths properly. Hence, the algorithm was modified to vary the threshold dynamically depending on the amplitude of the wave. This resolved the issue where the device would fail in case of most users.
The various breathing functions are tested and the results show that the device can accurately monitor different kinds of breathing and additionally provide heart rate and posture information while performing the breathing exercises. Posture is not displayed on the screen in "Yogic Breathe" options but it is continuously monitored and vibration feedback is provided if the user deviates from the correct posture. However, a separate option to monitor the posture is provided in case the user needs to check the same. Since normal posture varies from person to person, initially it is calibrated. Figure 14 shows the posture display on the wrist device.
Custom breath ratio for "Relax Breath" was successfully set via browser as shown in Figure 15 by accessing the webpage hosted by the microcontroller. To upload all data onto an excel sheet wirelessly, the microcontroller is configured to connect to the Wi-Fi hotspot. A PushingBox Service is set up to receive the data from the microcontroller. On receiving the data, pushing box forwards the data to Google Sheets where Google script sorts the data into respective tables. These data can then be used for long term monitoring and further processing. Data Analytics techniques can further be applied to monitor past improvement in health and also to predict user-health improvements. This data can also be shared with physicians to provide them with a better picture of a user's health history.

Conclusion
To monitor breathing such as pranayama in a correct posture and also to measure the heart rate a wearable device is developed. The various breathing exercises and patterns are tested on different subjects using the developed device. The yogic breathing data obtained are further analyzed. The results showed that the developed low-cost device can accurately monitor different kinds of breathing normal and yogic in addition provides heart rate and posture information while performing the breathing exercises. The heart rate measured using the pulse sensor is accurate enough when validated with medical equipment. Posture is not displayed on the screen in "Yogic Breathe" options but it is continuously monitored and vibration feedback is provided if the user deviates from the correct posture. The current study is useful in the present situation where we need to have a low cost device, which can monitor the breathing patterns and transmit the breathing data wirelessly to the health workers.