The block diagram of ventilator designed for this study is shown in Fig. 1. Sensors, valves, microcontroller, etc., used in the design of ventilator device, were indicated individually in the block diagram, connection types were shown and these were explained in detail between Section 2.1 and Section 2.7.
Stepper controller proportional valve
A proportional valve was used to adjust the fluidity control of gases that come from the oxygen and medical air tanks, the volume and pressure of air to be given to patient from the ventilator and the FiO2 proportion. Two counts of SCPV-1-3 valve, produced by the Clippard Company, were employed for this purpose. As shown in Fig. 1, a DC stepper motor driver was used to turn these valves on or off position. DC motors were the first practical device to convert electrical energy into mechanical energy [4]. The fuzzy-logic-based controller calculates at what rate the valves will be opened and closed. The amount of oxygen and medical air passing through the valves is adjusted by switching the valves on or off position step by step. Technical specifications of this valve are given in Table 1 [5].
Table 1 Technical specifications of SCPV-1-3 valve
The valve has an input and an output port. According to Table 1, a maximum of 7 bar pressure can be applied to input port. This valve can be used in hospitals where the pressure of oxygen and medical air given to the input of ventilator is a maximum of 6 bars [5]. The values of lung volume and lung capacities are shown in Fig. 2 [6, 7].
Inspiratory Capacity (IC) refers to the maximum amount of air that can be taken into the lungs, starting from a normal expiration level. This value can mount to a maximum of 3500 ml [6, 7]. Technical specifications given in Table 1 shows that SCPV valve makes it possible to have a control of air flow up to 300 l per minute. According to these data, maximum respiration rate that can be taken by this valve can be calculated as 300 L/3,5 L ≈ 85. Average respiratory rate of a healthy person ranges from 10 to 20 per minute. Respiratory rate may increase in cases such as coronary failure, pneumonia, ARDS (Acute Respiratory Distress Syndrome) [8]. Van Kaam AH et al. observed the respiratory rate as 41 ± 14 breaths/min on HFV(High-frequency ventilation) ventilator which coupled in the newborn intensive care units [9]. When the data sheets of present ventilators are examined, it is seen that the respiratory rate is 2-80 bpm in terms of breath/min. Respiratory rates by age group are provided in Table 2. Considering these values, it can also be said that SCVP valve is suitable for respiration rate. As it is also obviously seen in Table 2, it becomes more of an issue regarding patients’ health to carry out respiration control with an adjustable system. In this study, it was provided with a stepper motor controlled microcontroller-based proportional valve control where patients were given oxygen at more accurate rates.
Table 2 Range of respiration rates [10, 11]
Table 3 shows the values read from the AirFlow sensor in every step of SCVP valve. When these values are analyzed, it turns out that valve sensitivity (0,001”per step) is very convenient for respiratoy settings, too. These values were taken into consideration while identifying the membership functions of fuzzy-logic-based controller.
Table 3 The values read from AirFlow sensor in every step of SCVP
Embedded computer system
The software prepared for the ventilator and the fuzzy-logic-based controller, and software prepared for the control of proportional valves run inside the embedded computer. These softwares were prepared with Java programing language. The results produced by the fuzzy- logic-based controller are transmitted to PIC18F4550 microcontroller via USB port and the valves are switched on and off in line with the calculated values. The values which microcontroller reads from the oxygen, pressure and airflow sensors are also transmitted to the embedded computer system via USB port and these values are used by the ventilator software.
PIC18F4550 microcontroller
It is a microcontroller that is produced by the Microchip Technology Company and makes use of RISC (Reduced Instruction Set Computer) architecture and has a USB support. USB is one of the most commonly used communication modes. Data transmission via USB is carried out through 4 lines. The red wire carries 5 V signals, black wire 0 V, green wire data and the white wire carries CLK (Clock) signals. USB communication uses syncronous serial communication protocol [12]. The communication between the embedded computer system and PIC18F4550 microcontroller is conducted via USB port.
PIC18F4550 microcontroller sends signals to DC stepper motor drivers according to values calculated by the fuzzy-logic-based controller inside the embedded system and thus valves are switched opened and closed at the desired rate. So, the gas of oxygen and medical air mixture is given to patient in accordance with the amount of FiO2 adjusted from the ventilator.
Microcontroller also reads data from the oxygen, pressure and AirFlow sensors. The oxygen sensor used for this study produces analog signal. ADC specification of the microcontroller was utilized to read data from the oxygen sensor. On the other hand, pressure and AirFlow sensors produce digital signal. I2C communication protocol was used in order to read data from these sensors with microcontroller. Hence, the connection between the microcontroller and these sensors are indicated with SDA and SCL lines in Fig. 1.
Microcontrollers require some simple peripheral circuits when they are used for circuit designs. For example, power supply is used to supply required energy for both microcontroller and its neighboring circuits [13–16]. Power supplies must be isolated from mains and have a limited current and voltage output in order to protect the patient. Switch mode power supply provides further advantages for the isolation between the mains and human body [16, 17].
Oxygen sensor
Oxygen sensor measures the percentage of oxygen in the air which is given to the patient. KE-25 series oxygen sensor, produced by Figaro Company, was used in this study. Technical information related to this sensor is provided in Table 4 [18].
Table 4 Figaro KE-25 oxygen sensor technical information [18]
This sensor generates an analogue outcome between 0 V and 63 mV as an output. This data were firstly given to INA122 instrumentation amplifier and then amplified to a voltage between 0 V and 5 V. The structure of this integrated circuit is shown in Fig. 3 [18, 19].
In order to amplify the voltage level from 63 mV to 5 V, the the gain should be;
$$ \mathrm{G}=5\ \mathrm{V}/63\ \mathrm{mV}=79.37 $$
RG resistor in Fig. 3 is calculated as;
$$ {\mathrm{R}}_{\mathrm{G}}=200\ \mathrm{K}/\left(79.37-5\right)=2.69\mathrm{KOhm}. $$
Data cables came from the oxygen sensor were connected to 2nd and 3rd pins of INA122 in Fig. 3. The output voltage (V0) on the 6th pin was connected to the 2nd pin of PIC18F4550 microcontroller. This pin is the 0th analog convertor (AN0) of the microcontroller and the 0th pin of Port A [20]. The software in order to read data from the microcontroller and oxygen sensor was written in the language of Proton Basic and its flow diagram is given in Fig. 4.
As it also appears in the flow diagram in Figs. 4, 21 counts of data are consecutively read by the microcontroller from the oxygen sensor and saved to “Ham” sequence variable. A digital filter is applied for these data with the subsequent nested i and j loops. For the digital filter, data read through the “Selection Sort” algorithm are sorted in ascending order. Arithmetic mean of 9th, 10th, 11th and 12th elements of this sorted sequence is calculated and the values being read are made consistent. Oxygen percentage of air given to patient is calculated with the command of O2 = Ham_Sum * 100/1024. Being calculated, the amount of O2 is again feedback to the main program. The main program of microcontroller sends the resultant value to the embedded computer system via USB port.
Digital air flow sensor
Air flow sensor was used to measure the volume of the air given to patient. A total of 3 counts of these sensors were used; one for the outlet of oxygen valve, the other for the outlet of medical air valve and another one for that of the expiration valve. The fuzzy-logic-based controller adjusts the oxygen rate in the air being delivered to the patient. It firstly processes the data conveyed from the AirFlow sensors and then computes at what rate the SCVP valves needs to be turned on or off. No change is done in the SCVP valves if the value read in the AirFlow sensor is a target value. AirFlow sensors used in this study can measure the flow of air and oxygen up to 200 l per minute. This sensor converts the measured values into a 2 bytes digital outcome.
Digital pressure sensor
A pressure sensor was used to measure the pressure of air given to patient. When the air reaches the value adjusted from the ventilator, the inspiration is terminated. The pressure sensors used in this study can measure the gas pressure up to 15PSI = 1054.60cmH2O. This sensor also measures the temperature of air that is given to patient. This sensor converts the measured values into a 4 bytes digital outcome. 2 bytes data is for pressure and the other 2 bytes is for temperature.
Pressure regulator
Before it is given to the ventilator, high pressure gas that comes from the oxygen and air tanks is reduced by the manometer to a pressure between 4.5 and 6 bar in the hospitals. In order to obtain more sensitive results, the pressure of gases that came from the tanks was lowered to 2 bar by the pressure regulator used in the ventilator. Thus, the pressure applied to the inlet of the ventilator was made fixed and more sensitive results were observed in the outlet of proportional valves.