Low-cost AI-based SpO2 monitoring and oxygen delivery system

06 Oct, 2021

Low-cost AI-based SpO2 monitoring and oxygen delivery system

A novel application of AI in the form of SpO2 monitoring of critical patients and commensurately providing them with the required level of oxygen to save their lives before it is too late while preserving oxygen when it is not in dire need.

The second wave of the Coronavirus pandemic claimed the lives of over 400,000 people in India alone, according to Reuters’ tally. The reason, as stated by the news agency, was two-fold: the lack of beds in hospitals as well as the shortage of oxygen to be given to critical patients. The following article presents a novel method of using common supervised learning algorithms to achieve two principal tasks: to save oxygen when the patient has a sufficient amount already being supplied to them, and secondly, to provide adequate pure oxygen before the patient enters the irreversible stage of the deadly virus. Combining a set of rudimentary hardware with some sophisticated supervised learning, a device that has the potential to save millions can be made. 

Figure 1.1 Dismal state of COVID in lesser developed nations 

The first case, as described above, aims to stifle the supply of oxygen to the patient when their SpO2 values are in the “safe” range. According to a podcast from the World Health Organization (WHO) 2 the “normal” level of oxygen in a patient’s body is between 94% and 98%. Assuming a healthy patient has been admitted for the coronavirus, if their SpO2 levels stabilize in the upper half of the normal range, continuously providing the same amount of oxygen to them would be imprudent and wasteful. Similarly, when the oxygen levels of the patient are below the safe level, the supply of O2 should be increased promptly without any delay so that the condition of the patient does not exacerbate. In fact, the oxygen levels being supplied must gradually increase as the patients’ condition deteriorates.

In the current hospital scenario, at least in lesser developed nations, there is a warning signal only if the oxygen levels enter the “critical” region, which as described by WHO is below 91%. After the warning is issued, it takes a few minutes for a nurse or doctor to attend to the patient and elevate the supplied oxygen so that it can mitigate the effects of the preceding drop. During this interval (or even before the warning is produced), it is possible that the human enters an irreversible condition wherein even providing a surfeit of purified oxygen will not bring their vitals back to normal. To avoid this irreparable condition, sufficient oxygen must be delivered before a patient’s oxygen levels drop below a threshold value and also reduce the supply when the body stabilizes at a threshold so that there is oxygen remaining for those in dire need.

 To solve this pressing problem cost-effectively and efficiently, the hardware aspect must be discussed before moving on to embedding supervised learning into the algorithm. Using a proportional control valve in conjunction with a simple microcontroller with Bluetooth or Wi-Fi capabilities is sufficient to achieve this application. The proportional control valve is an off-the-shelf device that needs to be modified to have communication (either Bluetooth or Wi-Fi) potential with the microcontroller. First, the microcontroller and proportional control valve must be able to communicate with each other; the microcontroller should be able to provide PID information to the valve and the valve must be able to provide feedback for more accurate fuzzy-based PID parameter tuning. To do this, a suitable microcontroller such as the Motorola 68HC12 could be used as it can handle fuzzy logic and provide real-time outputs to multiple actuators. Furthermore, it can be used with a Wi-Fi module which can be used to store data on the cloud as well as communicate with the proportional control valve. The pure oxygen cylinders are usually kept at a distance from the patient with a pipe reaching the manual regulator on the mask. This is the regulator which is controlled by the hospital officials when a patient’s oxygen levels plummet suddenly. Hence, the proportional control valve, which will continuously use PID control to control the flow of the gas to the mask, must be placed in between the oxygen tank and the regulator to allow fully autonomous control. The last stage of the hardware would include a gas flow sensor which would detect the amount of oxygen passing through the pipe so that there is feedback to the PID controller. Without this sensor, there would be no way of knowing whether or not the required amount of oxygen is travelling to the patient’s mask and body. While the hardware seems relatively straightforward, the software aspect of this AI-based SpO2 monitoring and Oxygen delivery system would require data collection from several patients over a long period to become self-adjusting. 

Figure 2.1 Motorola 68HC12

As for the software aspect of this supervised fuzzy algorithm, before any patient data is available to use supervised learning, a simple fuzzy logic must be implemented with arbitrary thresholds based on the WHO conditions; which constitute a “critical” and “safe” range. However, a third case for “excess” must be added to save oxygen when a patient’s SpO2 levels have stabilized in a safe range. Once these restrictions are set, and the program is implemented as shown in Figure 3, there will be continuous control of the oxygen supply to the patient. However, it must be made sure that the signals to the actuator do not go every second, but readings must be taken every 10 minutes (at least) so that a considerable amount of data points can be plotted before a decision can be made. If data were to be taken every millisecond and the supply were to be varied every second, the system would do more harm than good for the patient because the software would not be able to gather enough data points to make an informed decision. Once the fuzzy logic makes a suitable decision, it must pass on its constant values, i.e. Kp, Ki and Kd to the PID controller where a conversion is made. This conversion transfers the constants’ values to a suitable angle that the proportional control valve’s regulator must be turned in order to reach the required oxygen supply levels. Once this transformation is made, the value of the angle is sent to the proportional control valve via Wi-Fi and concurrently, a data point is saved to the cloud elucidating the oxygen levels at which the particular angle was set (to collect data points for supervised learning). After this stage, the required amount of oxygen starts to be transmitted to the patient’s body. While this is happening, the gas flow sensor placed in between the mask and the oxygen reservoir collects readings and sends them back to the microcontroller where this feedback is used to make further necessary changes to achieve an accurate supply of oxygen. The next stage of this project would be to use the data collected over a longer period and use it for supervised learning so that the program itself recognizes when the patient is entering the critical range and autonomously increases the oxygen supply for them. Similarly, the program will be able to manipulate and make the threshold values more precise so that there is less oxygen wasted and more lives are saved. 

Figure 3. Fuzzy Logic Based PID Controller for controlling the proportional control valve

There have been a few attempts in the recent past to combat this difficulty and certain developments have been publicized; however, they are in their nascent stages. For instance, The Defence Research and Development Organization (DRDO) implemented a similar system during the second wave of COVID. However, there were a few hiccups which the “Oxycare” system developed by DRDO faced. For instance, there was a tremendous change in the architecture of the current oxygen delivery system required. This made the device impractical to implement in a short period during this crisis. In the above-explained system, the only change in hardware required is a proportional control valve placed between the mask of the patient and the oxygen tanks. Furthermore, the approach used by DRDO only allowed for discrete levels of oxygen to be supplied to the patient, unlike the aforementioned system which uses PID to decide how much oxygen to supply to the patient. Lastly, the Oxycare system does not have a provision for a feedback loop or any sort of data acquisition for supervised learning. There is no proof that the oxygen that is being supplied to the patient is, in reality, the same as being shown on the system display; a closed-loop system is required for this purpose. Hence, the aforementioned system would work much more efficiently than the Oxycare system developed by DRDO. 

Figure 4 Oxycare System developed by DRDO

By uniting some elementary hardware with somewhat sophisticated software, it is possible to reduce the oxygen wastage by over 32%  according to some elementary simulations and calculations. Moreover, as the algorithm improves once it receives enough data points, the oxygen wastage will be further minimized and hence engender the saving of several precious lives. By implementing this form of a polished system in hospitals, there could be over 10,000 Metric Tonnes of Oxygen saved if the figures presented by the Economic Times are to be believed. Retrenchment of this volume of oxygen could prove to rescue over 1.5 million lives, based on the figures provided by Reuters.










More about Jash Shah

Wevolver 2022