Development of Non-Invasive Ventilator for Homecare and Patient Monitoring System

.


Introduction
There has been increasing interest in the treatment of respiratory diseases due to the recent severe acute respiratory syndrome coronavirus 2 (SARS-CoV-2) pandemic and other respiratory infections, characterized by profound hypoxemia and dyspnea, often requiring mechanical ventilation [1][2][3].Intensive care units (ICUs) were one of the main units affected by the shortage of ventilation devices due to the number of patients with critical respiratory failure [4][5][6].
In a retrospective study on SARS-CoV-2, 99% of 1591 critically ill patients required respiratory support, including endotracheal intubation and non-invasive ventilation (NIV) [7].NIV technology has been extensively used to support respiration via a nasal cannula or facemask.The terms invasive/non-invasive are related to the bypassing of the upper airway with a tracheal tube, laryngeal mask, or tracheostomy [8].One of the most widespread NIV methods is continuous positive air pressure (CPAP), which comprises a closed respiratory circuit that provides a continuous predetermined airflow.Evidencebased data have demonstrated NIV as a useful treatment for hospitalized patients with respiratory failure (e.g., obstructive sleep apnea, etc.) [9,10].Bilevel positive airway pressure (BiPAP) works with two pressure levels, a higher level during inhalation and a lower level during exhalation.In [11,12], slightly more than half of those who received NIV survived free of invasive intubation.This positive pressure helps to keep the airways open and improves oxygenation during ventilation [13][14][15].In the BiPAP configuration, the high pressure level is called inspiratory positive air pressure (IPAP) [16][17][18].The lower level is called expiratory positive airway pressure (EPAP).EPAP helps to keep the airways open and facilitates the removal of carbon dioxide [19][20][21].The ability to set different pressure levels for inspiration and expiration allows for more customized and comfortable breathing support, making BiPAP useful in conditions where patients require assistance during both phases of the breathing cycle.The choice between these methods depends on the patient's condition and specific respiratory needs [22][23][24].Based on these considerations, this paper focuses on the design and fabrication of a cost-effective NIV device for daily homecare applications.The purpose of an NIV is to provide respiratory support while strictly following medical and clinical indications.An NIV device supplies airflow externally via a facial mask, reducing the work of breathing and avoiding the use of an endotracheal tube and the consequences of invasive mechanical ventilation.Developing an NIV that continuously monitors respiration parameters has many challenges, many of which have recently been addressed in the literature [25].Sensorizing the whole process by remotely monitoring an NIV and integrating multiple physiological data (capnography, oxygen saturation level, etc.) can improve the system [26].Recent literature has focused on physiological signal processing and analysis that could enable personalized treatment plans, shorten patient stays at medical facilities, and reduce treatment costs.Nevertheless, innovative designs for airflow generation and monitoring to reduce size and power consumption are still needed.Recent equipment shortages due to infectious diseases have evidenced the possibility of developing a multiplexed NIV paradigm [27].Furthermore, the continuous monitoring of ventilatory parameters has led to the implementation of novel signal processing and machine learning techniques to enable the predictive capabilities of such equipment [28,29].The proposed NIV's core is a turbine for airflow generation and a microcontroller for operational monitoring and control.The turbine is the main element in the device because it is responsible for generating the airflow required for the ventilation process [30].The turbine must be chosen for its efficiency, compact design, and ability to provide the air pressure required for ventilation.Simultaneously using a turbine for airflow generation and a microcontroller for monitoring and operational control constitutes a sophisticated, automated system to assist ventilation in a non-invasive manner.The NIV system can work in the set and start modes.In both modes, the microcontroller is responsible for setting the turbine parameters retrieving data from the flow sensor and turbine controller.The turbine is driven by pulse width modulation (PWM) signals to control its speed.The microcontroller also receives signals from the turbine's electronic unit with information concerning its rotational speed and status.This real-time feedback allows the microcontroller to dynamically adjust the PWM signals to maintain the desired turbine speed.The microcontroller functions as the brain of the system, managing control functions and monitoring various parameters, such as airflow, pressure, and patient-specific data.Control functions include adjusting ventilation settings, responding to changes in the patient's condition, and ensuring the overall safety and effectiveness of the NIV system.Combining these components produces a high level of automation and precision in the proposed NIV system.In addition, this combination represents a technological approach to respiratory support, in which the microcontroller interfaces with the sensors to collect data in real time, processing and adjusting the operation of the turbine in response.
The device is equipped with failure monitoring, such as inadequate volume delivery, airflow generator overload, the failure of some parts of its controller, and overtemperature.The airflow timing and level can be finely set and controlled in the range of 4-20 cmH2O with 0.5 cmH2O increments.The device provides a bi-level positive pressure to support spontaneous breathing and prevent respiratory fatigue induced by mechanical and/or parenchymal alterations, improving gas exchange and, thus, the clinical outcomes of patients.Moreover, a wireless monitoring system is included to provide alarm signals in case of malfunctioning as well as remote monitoring of the NIV status via a smartphone.The airflow is generated with a turbine (up to approximately 500 slpm), with a maximum pressure level of 50 cmH2O.A mass flow sensor is used for airflow monitoring.Calibration is performed using a commercial NIV.The NIV's core is an ATMEL microcontroller with a 16 MHz clock.An analog-to-digital converter is used to read the status of two analog inputs (to set the inhalation and exhalation time) and the output signal from the flow sensor.A digital-to-analog converter is used to drive the turbine.I2C protocol signals are used to manage the display.An LCD provides a user interface for displaying ventilation parameters in a clear and easily readable format.Users, such as carers or doctors, can monitor the displayed information without the risk of inadvertent changes during this phase.The microcontroller continues to monitor the parameters internally and updates the information on the LCD in real time while the analog inputs (e.g., potentiometers and encoder) are disabled.The proposed NIV is intended to improve the actual capacity of homecare and clinical setting equipment, allowing real-time data retrieval and equipment monitoring.

Hardware Design
Designing the hardware for a non-invasive ventilation system involves careful consideration of various components and functionalities to ensure the device's effectiveness, safety, and reliability.Specific details may vary based on the intended use and technology involved.The NIV device proposed in this study was designed according to the scheme shown in Figure 1.Its operation is based on the generation of multi-level positive pressure at two levels and predetermined levels, calibrating the airflow according to the phase of inspiration/expiration.The microcontroller can implement control algorithms that produce positive airway pressure levels (such as IPAP and EPAP in BiPAP) based on sensor inputs [31].The microcontroller can facilitate communication between the NIV device and external systems.This could include data logging, remote monitoring, and connectivity with other medical devices in the hospital environment.The proposed scheme is also equipped with a central control system that receives data from the ventilator, providing functional information remotely via a Wi-Fi connection.Possible causes of ventilator failure can be inadequate volume delivery, airflow generator overload, the failure of some parts of its controller, and overtemperature [32][33][34].Using an NIV is far more difficult if not remotely controlled, especially at night, and unforeseen failures can arise due to hardware, parameters, and physiological changes.
Hardware malfunctioning can induce the quick deterioration of clinical conditions, leading to sudden death.Other consequences can arise when sleep induces significant ventilatory changes.NIV monitoring can greatly affect physicians caring for these patients [35,36].
The microcontroller (ATMEL-Atmega328P-PU, Microchip Technology, Itasca, IL, USA) provides the operational monitoring and control of the NIV via three manual controls: system start-up integrated with the rotary encoder (grey), stop (red), and set (blue).The NIV status can also be monitored with a system consisting of three LEDs indicating START (green), STOP (red), and SET (blue) conditions.Furthermore, it controls the airflow timing and level using two potentiometers and sets the airflow level with a rotary encoder in the range of 4-20 cmH2O with 0.5 cmH2O increments [37].Most commercial CPAP and BiPAP devices use increments varying from 0.2 and 0.5 cmH2O [12].A detailed overview of the microcontroller connection is reported in Figure 2, and the values of its components are summarized in Table 1.The turbine is a 3-phase 24 V brushless high-pressure blower designed for high-impedance and high-suction devices.It is based on a plastic centrifugal impeller capable of generating a maximum air pressure of approximately 50 cmH2O (an airflow of 511 L/min) with a maximum fan speed of 36,000 rpm.These fans offer an average power consumption of 36 W and vibration and noise levels as low as 38dBA in a circular enclosure of 67 × 57.5 mm and a weight of 230 g.It can work with humidity ranging from 5 to 95% and is compliant with the REACH and RoHS3 directives for environment-related substances in the product.
The airflow levels are set using pulse-width modulation (PWM) signals to adjust the turbine rotation speed using an electronic speed control (ESC) integrated into the turbine circuit controller board.The ATMEL-Atmega328P-PU works with a 16 MHz clock, using an embedded analog-to-digital converter (ADC) and a digital-to-analog converter (DAC) to perform ventilation support tasks.
The ADC is used to read the status of the two analog potentiometers (which set the inspiration and exhalation times) and the output signal of the flow sensor.The DAC controls the turbine speed by driving the turbine controller via PWM.A display is also provided, and all the data are transmitted/received via the inter-integrated circuit (I 2 C) protocol using a serial data line (SDA) and a serial clock line (SCL).The airflow is provided with a brushless turbine (BFN0724SS-01, Delta Electronics, Taipei, Taiwan), which is equipped with a system of Hall sensors to evaluate the rotational speed.Two physical interrupts are used for the instantaneous stop of the NIV (STOP button) and the continuous turbine speed evaluation.The available I/O pins are dedicated to reading the rotary encoder (the airflow level) and monitoring the start (integrated into the encoder) and setting controls.Moreover, I/O pins are used as the interface with the Wi-Fi module and light controls (start-green, stop-red, and set-blue).It is also equipped with a brake for the immediate lock of the turbine in an emergency.The turbine controller provides a control signal for turbine rotation and sends a signal with a frequency of 1 kHz and amplitude of 5 V to the microcontroller and a variable duty cycle, which depends on the error (10% for turbine lock, 20% for high-speed conditions, 30% for over-voltage protection, and 40% for over-temperature protection).The turbine can deliver an airflow of up to approximately 500 slpm (standard liters per minute), with a pressure of up to approximately 50 cmH2O.The airflow is monitored using a mass flow sensor (SFM3020, Sensirion, Stäfa, Switzerland) working in the −10 ÷ 160 slpm range.The sensor is connected between the output of the turbine and the face mask and is used for initial calibration operations.In our case, it is applied to the output of a Philips CPAP device model REMstar Auto A-Flex, and the output values from the sensor are then recorded by applying the AP (air pressure) values necessary for our device at an ambient temperature of 25 °C.All the information collected during the operating or SET phases is sent to a backlit display with 4 lines of 20 characters.Moreover, to ensure the maximum reading accuracy of the ADC, a stable voltage is used for the specific input of the microcontroller, provided by a voltage reference-type integrated circuit; thus, the behavior of the ADC is not affected by any changes in the voltage power supply.This supply is provided by an external Mean Well GSM90B24-P1M unit designed for electro-medical applications, which delivers 24 V with a maximum power output of 90 W [38].The power supply stage receives the 24 V input and directly reports it to the turbine controller.The power supply output is also reduced via a step-down switching module and then stabilized at 5 V using a linear stabilizer integrated circuit, which is ideal for powering microcontroller-based circuits.

Microcontroller Programming
Programming a microcontroller for an NIV system involves writing code that controls the operation of the hardware components, reads sensors, and ensures the safe and effective delivery of ventilatory support.The microcontroller operates independently following an instruction set from a predefined algorithm according to the flowchart reported in Figure 3.With power on, the firmware checks whether the patient's operating parameters (air pressure and inhalation and exhalation times) are in the microcontroller's non-volatile memory.If all the required parameters are correctly retrieved, the NIV is placed in start mode (with the green LED on), starting the respiratory cycle; otherwise, a warning message is displayed, and the NIV is placed in set mode (with the blue LED on).The latter requires the end user to provide the air pressure, inhalation, and expiration times.The information provided is constantly displayed.Once the parameters are set, they are stored, and the blue and red LEDs are turned on simultaneously, placing the NIV in stop mode (with the red LED on).In this case, the switch to start mode is allowed by using the encoder (start mode).During this phase, the potentiometers and the encoder are disabled to avoid accidental changes in the parameters, while the LCD shows the current parameters.In the start or set modes, the microcontroller sends PWM signals to the turbine controller for speed adjustment, and the controller simultaneously sends the pulses to the microcontroller, which allows real-time rotational speed evaluation.
The display modes are relevant to the presented ventilation process.The user interface provides important information about the operating parameters of the ventilation device.The proposed NIV features simple and easy-to-understand state indicators on the display, even for non-workers.The information provides a quick visual assessment of the system's overall state.

Results and Discussion
The manufacturing of the prototype is reported in Figure 4, in which the brushless turbine on the rear connected to the flow sensor via a rubber tube is shown, the end of which emerges from the container for the connection of the corrugated tube to the respirator mask.In the central part, the PCB of the internal power supply is visible on the left and the turbine controller is on the right.The PCB containing the microcontroller logic and Wi-Fi is positioned behind the front mask of the container [39][40][41][42][43].
The NIV prototype was mounted in a commercial container using 3D-printed features.The main power switch, three control knobs, control buttons, and control LEDs are located on the front panel, while the LCD, with 4 lines of 20 characters each, is located on the top cover.The proposed NIV is equipped with sound and light indicators to better monitor its functioning to facilitate the supervision of the activity.The integration of the ESP8266 ESP-01 Wi-Fi module allows the device to connect to Wi-Fi networks, facilitating signal exchanges with the microcontroller.The logic connection between the Wi-Fi module and the microcontroller is made via a series of level shifters to adjust the signals operating at two different voltage levels (3.3 V for the Wi-Fi module and 5 V for the microcontroller).This allows the fan to receive/send commands or requests directly from a smartphone, improving the management and customization of settings.In addition, to ensure optimal remote control, a remote monitoring system is implemented using the Telegram app.With this solution, the NIV ventilator's status can be viewed in real time, providing an intuitive interface for monitoring and controlling operations.The ESP8266-01 Wi-Fi module, interfaced with the microcontroller, allows a smartphone to be employed via the Telegram application, for which a dedicated BOT was developed.After start mode, the module enters router mode, providing a Wi-Fi network named AutoCon-nectAP, which is used to log in and check the connection status (e.g., the module management, or the SSID data of the Internet network) [44][45][46].Once the connection parameters have been stored, the device must be restarted, and the module then instantly connects to the network without entering server mode again.If the device is transferred to another location, the module will not find the stored network by turning on the device and will go back to router mode for the replacement of the SSID parameters.Once the parameters are provided, the module connects to the selected network.By activating the BOT, the operator can manage the NIV operation status.Each time the device is turned on, the module sends a START message to the operator.During operation, the operator can receive two possible error messages in the event of a failure in the turbine or flow sensor.If the error is promptly fixed, a confirmation message is sent.The operator can send a status request and immediately receive a confirmation message regarding the correct operation of the device at any time.Figure 5 shows all the messages and commands currently provided by the app.The connection between the ESP8266 module and the ATmegar328P-PU microcontroller is a bidirectional serial communication, with which it is possible to control the NIV via the Telegram APP by making some minimal hardware and software implementations, sending commands that can be useful in safety matters.For example, the turbine controller is equipped with a BRAKE input, connected to the ATmega328P-PU microcontroller, which can instantly stop the turbine for a few seconds in an emergency by sending a digital signal.The remote-control functions of both STOP, to put the NIV in a resting state, and START, to restart the respiratory cycle with preset parameters, are easily implemented.Replacing the current ESP8266 module with a more extended version could also provide total remote control of the NIV, adding, for example, the ability to set operating parameters and store them in the EEPROM of the ATmega328P-PU.Table 2 provides a limited and non-exhaustive comparison of the characteristics and distinguishing features between commercial and non-commercial NIVs to classify the implemented NIV.The airflow sensor used for the NIV can read values between −10 and 160 slpm, generating a variable voltage between 0.5 and 4.5 V at the output.This voltage is applied to the microcontroller ADC.The sensor was connected to the turbine output and the values of PWM (% duty cycle) were obtained to be applied to the turbine controller to generate the number of RPM needed to obtain the required AP values.The results obtained during the measurement campaign carried out on this device concerned the behavior of the turbine and the flow sensor by varying the PWM duty cycle (at 25 kHz) and, thus, the management of the turbine with the microcontroller.This adjustment was accomplished using an encoder, allowing for a range between 6.5% and 32%. Figure 6a shows the correlation between the air pressure exerted on the sensor (monitored with a commercial device) and its corresponding voltage response.The response evidenced a linear response, with a voltage sensitivity of 0.11 V/cmH2O and an R 2 = 0.989.The evaluated flow sensor output voltage was between 1.85 and 3.57 V, which falls inside the linear range provided by the manufacturers (10-90% of the supply voltage).Moreover, this voltage range corresponds to air pressure levels spanning from 4 to 20 cmH2O, which is widely the standard in commercial NIVs.An analysis of the variation in the turbine rotation speed relative to changes in the PWM was performed.As shown in Figure 6b, the turbine linearly varied its rotational speed in the range of 6800 to 14,600 rpm with a sensitivity of 283.6 rpm/% and an R 2 = 0.963.As evidenced by the manufacturer, the blower stopped using a PWM with a duty cycle of <3% and reached its maximum speed (31,500 rpm) with a PWM with a duty cycle of >85%.While increasing the duty cycle was expected to increase the turbine speed (in free air conditions), the deviation from the ideal linear behavior and high speeds was because the flow was forced inside a tube, and the counter pressure in running mode was not negligible (compressibility effects).The relationship between the PWM and emitted air pressure is evidenced in Figure 6b.Based on the measurements, a duty cycle ranged between 6.5% and 32%, and the turbine delivered an airflow with a pressure between 4 and 20 cmH2O with a sensitivity of 0.61 cmH2O/% and an R 2 = 0.991.The characteristics and calibration were therefore determined per the factory specifications and the comparison with commercial devices.However, as evidenced by the manufacturer, the pressure coefficient and flow coefficient exhibited an almost linear correlation (negative slope).The results show that the proposed NIV is adequate for use in clinical and homecare settings.Furthermore, the functionality improvements, such as remote monitoring, are desirable for better patient management and cost reduction.Monitoring and alarm messages that are poorly diffused in clinical devices allow a safer NIV in a non-clinical environment.The power consumption can affect the future development of the device, leading to a more portable/wearable device [39,40].The energy consumption is mainly due to the turbine and the controller (see Figure 6c), as well as the microcontroller and the Wi-Fi module.The average power consumption in running mode is estimated to be 2.1 ± 0.5 W. The overall cost of the equipment can be mainly attributed to the turbine controller, which accounts for approximately 80% of the overall cost.It is possible to find a wide range of alternative suppliers, though the supply chain can impact the overall cost.At this stage, the cost of the proposed NIV is approximately ten times less than that of a mid-class commercial NIV.The prototype appears to be competitive in terms of technical (pressure, airflow) and energy (power consumption) characteristics with commercial solutions in the literature.While Wi-Fi monitoring offers significant improvements in patient and device management, the architecture requires the integration of additional sensors for physiological assessment of the patient.In addition, the literature points out that the latter aspect is attractive for the integration of Machine Learning and Deep Learning algorithms that can make the management of therapy and NIV increasingly unsupervised.

Conclusions
In this paper, we proposed a proof of the concept of an NIV for the homecare of patients with respiratory diseases.The design incorporates off-the-shelf components, including a turbine, a flow sensor, and a respiratory sensor, all coordinated via a microcontroller to regulate the supply of airflows.Following the initial calibration, the device demonstrated its capability to continuously monitor airflow, effectively mitigating respiratory fatigue.This integrated system exemplifies a sophisticated yet accessible solution, harnessing the power of technology to enhance respiratory well-being.Specifically, these innovations address problems such as abrupt alterations in respiratory mechanics or gas exchange, particularly in cases where medical personnel may not be adequately trained.The proposed innovations face important challenges in the context of non-invasive ventilation systems.Closed-cycle control with real-time monitoring is crucial for maintaining a stable respiratory mechanism.In addition, closed-cycle control allows the NIV system to adapt to changes in the patient's condition, preventing abrupt changes in respiratory mechanics.Using an LCD to display parameters improves ease of use and ensures medical staff can easily monitor current parameters without the risk of involuntary adjustments.Automation via microcontroller control algorithms and real-time monitoring contributes to the overall safety of the NIV system.The system becomes more resistant to potential errors or variations in user input by automating the adjustment of ventilation parameters, which is especially important when users have not undergone thorough training.In short, the proposed innovations contribute to the safety, adaptability, and ease of use of the NIV system.They address the challenges associated with abrupt changes in respiratory mechanics or gas exchange, providing a more reliable and affordable solution, especially in scenarios where medical personnel using the equipment may not have thorough training.The integrated monitoring system ensures the continuous transmission of essential parameters, enabling healthcare providers to obtain comprehensive data for effective health monitoring.The integrated monitoring system records several parameters, such as respiratory frequency and other relevant metrics.This comprehensive data collection provides a holistic view of patient health, enabling healthcare providers to assess overall well-being and identify potential problems in advance.In summary, the integrated monitoring system significantly contributes to patient care by providing continuous and comprehensive data for effective health monitoring.It provides healthcare providers with the necessary information to make timely and informed decisions, ultimately improving outcomes and patient safety.Future improvements to the monitoring system will focus on the development of a mobile application on Android and iOS platforms.In the initial setting phase, the patient or a specialist calculates the duration of the NIV inhalation and expulsion times upon instructions from the medical staff.When the parameters are stored during the first lighting by specialized staff, they remain active for all subsequent operating sessions, ensuring the efficient and continuous management of parameters, and a well-defined personalized treatment.

Figure 1 .
Figure 1.Block diagram of the proposed NIV.

Figure 2 .
Figure 2. Electric scheme of the circuit with microcontroller.

Figure 3 .
Figure 3. Flow chart of the microcontroller circuit operation.

Figure 4 .
Figure 4. NIV.(a) Front panel of the proposed NIV.(b) Internal view of the NIV in which the turbine is evidenced in blue, red boxes include the power supply units, yellow box shows the turbine controller, and green box highlights the microcontroller board.

Figure 5 .
Figure 5. Example of telegram BOT for NIV monitoring and control via the Telegram app.

Figure 6 .
Figure 6.(a) Calibration of the flow sensor output voltage compared with air pressure.(b) Turbine rotational speed vs. PWM duty cycle.(c) Power consumption in running mode.

Table 1 .
Values of the components of the electrical scheme in Figure2.

Table 2 .
Representative characteristics of commercial and non-commercial NIVs.