An automatic system configured to control SpO 2 in the blood of a patient placed on respiratory support, the system comprising: a. an adaptive microcontroller; b. a device configured to control the variable adjustment of FiO 2 delivered to the patient by adjusting a blend valve; c. a monitoring device; and d. a device configured to stimulate the patient, wherein the adaptive microcontroller is configured to receive signals from the monitoring device pertaining to clinical measurements of the patient regarding FiO 2 and SpO 2 measurements and vital signs such as heart rate, blood pressure and respiratory rate, to process the signals with dynamic adaptability through an algorithm to provide estimates of parameters of a dynamic system model that describe the response of the patient to inputs and of unknown disturbances that occur in the control of SpO 2, wherein the estimates change as the condition of the patient changes and in response to external inputs and disturbances, and to send corresponding signals to the device configured to control the variable adjustment of FiO 2 delivered to the patient depending on the signals received by the microcontroller from the monitoring device, wherein the microcontroller is in direct communication with the monitoring device through an inbound/outbound electronic communication means, and wherein the algorithm comprises an estimation system consisting of a discrete parameter-estimating extended Kalman filter and extended state observer, wherein the extended Kalman filter is used to estimate the parameters of the dynamic system model, and the extended state observer estimates the unknown disturbances, wherein the microcontroller is in direct communication with the device configured to stimulate the patient through an inbound/outbound electronic communication means, and wherein the microcontroller is configured to automatically control the device configured to stimulate the patient. a. an adaptive microcontroller; b. a device configured to control the variable adjustment of FiO 2 delivered to the patient by adjusting a blend valve; c. a monitoring device; and d. a device configured to stimulate the patient, wherein the adaptive microcontroller is configured to receive signals from the monitoring device pertaining to clinical measurements of the patient regarding FiO 2 and SpO 2 measurements and vital signs such as heart rate, blood pressure and respiratory rate, to process the signals with dynamic adaptability through an algorithm to provide estimates of parameters of a dynamic system model that describe the response of the patient to inputs and of unknown disturbances that occur in the control of SpO 2, wherein the estimates change as the condition of the patient changes and in response to external inputs and disturbances, and to send corresponding signals to the device configured to control the variable adjustment of FiO 2 delivered to the patient depending on the signals received by the microcontroller from the monitoring device, wherein the microcontroller is in direct communication with the monitoring device through an inbound/outbound electronic communication means, and wherein the algorithm comprises an estimation system consisting of a discrete parameter-estimating extended Kalman filter and extended state observer, wherein the extended Kalman filter is used to estimate the parameters of the dynamic system model, and the extended state observer estimates the unknown disturbances, wherein the microcontroller is in direct communication with the device configured to stimulate the patient through an inbound/outbound electronic communication means, and wherein the microcontroller is configured to automatically control the device configured to stimulate the patient.