Document Type : Technical Note


1 Biomedical engineering group, Department of Electrical & Information Technology, Iranian Research Organization for Science and Technology, Tehran, Iran

2 Food and Drug Administration, Ministry of Health and Medical Education, Tehran, Iran



Daily calibration of spirometry devices plays an important role in promoting the accuracy of pulmonary diagnostic results. It is needed to have more precise and adequate instruments for calibrating spirometry during the clinical use. In this work, a device was designed and developed based on a calibrated-volume syringe and an electrical circuit was also built to measure the air flux. Some colored tapes with specific size and order covered the syringe piston. When the piston moved in front of the color sensor, the input air flow was calculated according to the width of the strips and transferred to the computer. A Radial Basis Function (RBF) neural network estimator used new data to modify the previous estimation function for increasing the accuracy and the reliability. The simulation showed that the root mean square of the error improved from 13.7±0.37% to 4.2±0.22%, i.e. the calibration curve has improved about 70%.



Spirometry is considered as a primary diagnostic measure to evaluate respiratory diseases, and it has been also known as an excellent objective marker of respiratory morbidity. It has been emphasized that spirometers is used on a daily basis and at home, especially for Chronic Obstructive Pulmonary Disease (COPD) patients [ 1 ]. In this method, the spirometer is used to measure pulmonary volumes and capacities such as tidal volume, vital capacity. The measured volumes are usually displayed graphically in terms of time (volume-time) or flow (volume-flow). A failure in the lung function is detected based on comparing the spirometer data with measured values in a normal healthy person. Therefore, the accuracy of the output data of the spirometer plays an important role in the disease diagnosis. However, studies are conducted on a number of spirometer that there is systematic difference between the results of measuring various device models [ 2 , 3 ]. For this reason, in a comprehensive study in France, it has been emphasized that the existence of a qualitative control process can be effective on the accuracy of the results and the absence of distortion in collected data [ 4 ]. For this reason, in England, quality control guidelines for spirometer have been proposed [ 5 ]. According to the international guidelines for spirometers, calibration testing of the device should be done daily or before each use by the 1-L or 3-L syringe [ 6 , 7 ]. The accuracy and the linearity of the flow/volume of respiration can be examined. The content of the syringe is completely discharged at least three times (at different speeds) into the spirometer mouthpiece. If the measured volumes are the same, but there are some deviation compared to the calibration volume, the spirometer device can be readjusted. However, if still the flow measurement is nonlinear, the spirometer must be transferred back to the manufacturer for recalibration. This may create few problems, particularly when the spirometers are used in remote areas. A study in Nepal showed that the lack of easy access to calibrating centers could lead to excessive errors in the spirometry measurement results [ 8 ]. In this study, we designed and developed a device to perform spirometer calibration on-site during clinical activity, eliminating the need to send the device back to the manufacturer.

Technical Presentation

Design Requirements

It should be noted that most new spirometry devices are based on flowmeters. Therefore, more accurate measurements of instantaneous volumes were the basis of our design work. With regard to the above, the device was designed for measuring the total volume of air entering the spirometers in addition to the air flow, and the whole data was transferred to the spirometer. The spirometer was set to calibrate itself by comparing the received quantities with the output of its sensing circuit.

Other considered important items for designing a calibration device were the minimum and maximum flow that the device expects to measure. The maximum flow that a person can exhale is around 14 l/s [ 7 ]. Thus, designed device should be able to create, measure and save this flow.

Device Components

To reach a precise and accurate volume, a calibrated syringe was used. The syringe consists of a 1 liter cylinder (with an accuracy better than ±0.5%) and a piston. By moving the cylinder piston in both directions, the inhalation and exhalation are simulated.

The time variation of volume was measured while the piston marked with some colored tapes was placed at specific locations. For this purpose, the syringe piston was divided into 10 equal units, and each unit was covered with a colored tape (Figure 1). The color sensor detects the tapes while the operator pushes/pulls the piston. Therefore, by displacing each of the strips from the front of the color sensing sensor, 0.1 liter was displaced to the spirometer. The displacement time of each stripe was measured and stored by using a microcontroller. Since each tape width was attributed to a specific cylinder volume, the instantaneous flow was calculated using equation (1):

Q=∂V∂t (1)

Figure 1. Block diagram of the device

Where V is the related volume to a tape, t is the passage time of the tape and Q is inlet air flow into the spirometer. Some factors may lead to the uncertainty in the volume and flow measurements, as follows:

1- When the position of the syringe was not at the appropriate starting point, and all flow measurements may be unreliable. To overcome this issue, we developed an approach where the start and end tapes were identified by a unique color. Now if we started the calibration process with strips except the first one, we would have appropriate alarm.

2- When the direction of the piston changed during movement, the flow calculation would be erroneous. The order of the colors was selected in a way to determine the motion direction of the flow. If the color of the certain strip was not observed during the piston movement, the direction of the piston was changed.

Each color tape was identified by using TCS230 (TAOS company) color sensor [ 9 ]. The TCS230 sensor, a light-to-frequency color converter, consists of 16 photodiodes for blue filter, 16 photodiode for green filter, 16 photodiodes for red filter and 16 photodiodes without filter (Figure 2). All 16 photodiodes with the same color are connected in parallel and selected by two pins of the sensor (S2 and S3). The output of the sensor is a square pulse with 50% duty cycle and the frequency is proportional to the intensity of received light. The maximum output frequency is determined by two pins of the sensor (S0, S1).

Figure 2. Block diagram of color sensor

When a specific color tape was placed in front of the sensor, the reflection was received by the light sensors. The color of the tape can be determined according to the ratio of these three main colors.

We selected four colors, including white, black, green, and red for tapes. After implementing the system and marking the piston based on selected colored tapes, the output frequency of the sensors was measured for various color strips and ambient light at different daily times. Finally, to identify the color of each strip, the intervals were considered in accordance with Table 1. As shown in Table 1, the frequency intervals for the red and green stripes overlapped with each other and for preventing misinterpretation of these two colors, authors added another criterion:

If (frequency for green photodiode > Frequency for red photodiode) → green tape

If (frequency for green photodiode < Frequency for red photodiode) → red tape

Tape Black Red Green White
Red 29-37 43-55 37-45 50-75
Green 29-36 30-37 38-45 50-75
Blue 29-36 30- 38 30-38 50-75
Table 1.Frequency range for selected color tape detection (in kHz).

Finally, in order to increase the accuracy of color tape detection with an assumption of the constant ambient light, the measurement is performed with the Light Emitting Diode (LED) off and on. Then two frequencies are subtracted to reduce ambient light effect.

Data logger (Figure 1) contained an Atmel’s ATmega32 microcontroller to control sensor modes, calculate sensor output pulse frequency and send data to the spirometer. The sensor’s output was connected to the microcontroller timer pin and the microcontroller counted the incoming signal edges. As mentioned before, the syringe volume was 1-L and the maximum flow rate was 14 l/s. Therefore, maximum required time for processing should be 71 milliseconds (ms). Since the piston was marked with 10 strips and it was required to set the sensor photodiodes in red, green and blue, the data logger must be logged each 2.36 ms. To have an improvement of accuracy, the activation time was tuned at 1 ms for changing the sensor mode and reading the sensor output.

Neural Network Estimator

In the previous study [ 10 ], we used A Radial Basis Function (RBF) neural network to estimate the calibration curve of a hot-wire spirometer. Based on RBF neural network, one of the features of the estimator is the capability to retrain and change its internal weights, i.e. after the initial formation of the weight vector based on the existing data, it is possible to remove a number of primary data over time or add new data to the network and easily reset the weight matrix [ 11 ]. We assume the initial weight vector is obtained from equation (2) to estimate the mapping function between inputs and outputs:

w-=Ap-1Hpyp- (2)

Where wm-=[w1,w2,...,wm] is the weight vector, yp-=[y1,y2,...,yp] is the desired output vector of the network (here, air flow/velocity) and AP and HP are given in (3) and (4):

Hp=[h1(x1)] (3)

Ap=HPT.Hp (4)

Where xp-=[x1,x2,...,xp] is the input vector (here, the voltage level of the electronic circuit of the hot-wire sensor) and hi(x) is obtained from equation (5):

hi(x)=exp((x-ci)2ri2) (5)

Which ci and ri are two tuning parameters of the network.

Now, is the data (xp+1, yp+1) were added to this matrix, in equation (2), the following parameters are replaced:

Hp+1=[hphp+1T] (6)

Ap+1=Ap+hp+1hp+1T (7)

Where hp+1 is obtained from equation (8):

hp+1=[h1(xp+1),h2(xp+1),...,hm(xp+1)] (8)

For deletion of a number of old training data, there are similar relationships. Therefore, when an estimator of RBF neural network is designed based on calibration data, it will be possible to insert new data into this network (and/or delete old data) for the improvement of the estimator, and estimation of new data in addition to the old data.

Figure 3 shows the air flow when the calibration syringe piston was moved from start to end at different speeds. Previous experience shows that the highest measurement errors occur in a low fluid velocity range of less than 3 m/s [ 10 ]. According to the mouthpiece size (diameter of about 1.5 cm), the measured flows in Figure 3 are within the same speed range.

Figure 3. Measured flow by the calibration device

Each measurement in Figure 3 represents an yp+1 in yp+1-=[y1,y2,...,yp,yp+1] These data were sent to the spirometer and then the original weight vector was updated based on the hot-wire sensor output, i.e., xp+1 (in according to equations 6 and 7).


According to the importance of the lung diseases, mobile phone-linked spirometry technology has been designed specifically to evaluate the lung function at primary care level, and some of them have been accepted in the world for the screening of the patients with chronic respiratory diseases [ 12 , 13 ]. On the other hand, American Thoracic Society (ATS) and European Respiratory Society (ERS) recommended that the calibration of spirometers must be verified daily with a calibrated syringe. Therefore, proper calibration is important for ensuring accuracy and can be also performed with a precision syringe. This procedure, however, becomes complex for nonlinear flow sensors (such as hot-wire sensor), commonly used. Biselli et al. developed an algorithm for the calibration of nonlinear flow sensors using an accurate syringe [ 14 ]. Some researchers showed that use of different types of spirometers may result in the significant systematic difference in lung function values. Epidemiological researches must consider these potential systematic differences and correct them in analysis using methods such as regression calibration [ 15 ]. In a study, a self-adjusting structure radial basis function neural network (SAS-RBFNN) was developed to predict the outlet ferrous ion concentration on-line and the results demonstrated that this network can provide a more accurate prediction than the mathematical model [ 16 ].

In the present project, a device for the online calibration of spirometers was designed and developed. The calibration curve of a hot-wire spirometer is nonlinear and cannot be easily extrapolated to the low and high speed zones. A novel approach, based on the RBF neural network method, has been used for adjustment purpose.

The output of the present device is the instantaneous volume and flow that can be used as reference voltages to adjust calibration coefficients of spirometers using the RBF neural network. As stated in the previous sections, due to the trainability of neural network estimator, it is possible to re-train and update the neural network with new data (collected during the spirometer use) without the need for re-estimation of the entire calibration curve. On the other hand, for other estimating methods such as polynomial and power law, it is not possible to use this important characteristic. Therefore, it is needed to measure and use all data over the complete range of velocity for the re-estimation of the calibration curve.

The fluid speed range was divided into three zones, including low (0.7 to 3 m/s), medium (3 to 15 m/s) and high (15 to 30 m/s) velocity zone. Table 2 shows the standard deviation (or equally accuracy) for before and after applying the adjustment method, in three simulations conducted in the entire velocity range (0.7–30 m/s). Equation (9) has been used for the determination of standard deviation:

eN=1Ni=1N|1-Uc(i)Um(i)| (9)

Where Uc and Um are the calculated and real velocities, respectively.

Test No. Velocity range (m/s) Before After
Present approach
1 0.7-3 13.43 3.54
3-15 0.17 0.22
15-30 0.63 0.68
2 0.7-3 14.54 4.5
3-15 0.13 0.19
15-30 0.73 0.75
3 0.7-3 13.13 4.55
3-15 0.25 0.2
15-30 0.74 0.9
Average 0.7-3 13.7 4.2
3-15 0.18 0.2
15-30 0.72 0.78
Table 2.Accuracy before and after applying present approach (%).

As a consequence, the error in the low velocity region has decreased significantly (improvement percent is about 70%) using the mentioned method.

Finally, it is worth mentioning that the effect of ambient light on sensor performance is another significant issue, which must be considered. The light reflected from the surface of the strips and detected by light sensor is unidentifiable once was combined with environment light, and the measured values are thus unreliable. To avoid the environmental light, the sensor is surrounded by small dark circle. The sensor does not receive any light when the light source is off, and the sensor output is approximately zero in the enclosure.


Spirometry plays an important role in the diagnosis and management of obstructive and restrictive lung disease. Therefore, the accuracy of the output data of the spirometer plays an important role in the diagnosis of diseases. In this study, a device was designed and developed, leading to perform the spirometer calibration at site while the clinical activity is occurring, and there is no need to send back the device to the manufacturer.

Authors’ Contribution

VR. Nafisi and M. Eghbal designed the concept and principles of the study. VR. Nafisi and N. Torbati designed and implemented the hardware and software and gathered the data. VR. Nafisi developed the concept of using neural network, and VR. Nafisi drafted the whole paper. All the authors read and approved the final version of the manuscript.

Conflict of Interest



  1. Rodriguez-Roisin R, Tetzlaff K, Watz H, et al. Daily home-based spirometry during withdrawal of inhaled corticosteroid in severe to very severe chronic obstructive pulmonary disease. Int J Chron Obstruct Pulmon Dis. 2016; 22(11):1973-81. Publisher Full Text | DOI | PubMed
  2. Aardal ME, Svendsen LL, Lehmann S, et al. A pilot study of hot-wire, ultrasonic and wedge-bellows spirometer inter- and intra-variability. MC Res Notes. 2017; 10(1):497. Publisher Full Text | DOI | PubMed
  3. Gerbase MW, Dupuis-Lozeron E, Schindler C, et al. Agreement between spirometers: a challenge in the follow-up of patients and populations?. Respiration. 2013; 85(6):505-14. DOI | PubMed
  4. Ruiz F, Goldberg M, Lemonnier S, et al. High quality standards for a large-scale prospective population-based observational cohort: Constances. BMC Public Health. 2016; 16(1):877. Publisher Full Text | DOI | PubMed
  5. College of Physicians and Surgeons of British Columbia. Dap Spirometry Quality Control Plan. 2012. Available from:
  6. Wanger J, Clausen JL, Coates A, et al. Standardisation of the measurement of lung volumes. Eur Respir J. 2005; 26:511-22. DOI | PubMed
  7. Miller MR, Hankinson J, Brusasco V, et al. Standardization of spirometry. Eur Respir J. 2005; 26:319-38. DOI | PubMed
  8. Baldwin MR, Checkley W, Wise RA, et al. A Cleaning and Calibration Method for the SpiroPro Portable Spirometer’s Pneumotachometer Tube in a Remote Field Study. Respir Care. 2010; 55(4):443-52. PubMed
  9. TAOS. TCS230 Programmable Color Light-to-Frequency Converter. 2008. Available from:
  10. Ardekani MA, Nafisi VR, Farhani F. Extrapolation of calibration curve of hot wire spirometer using a novel neural network based approach. J Med Sign Sens. 2012; 2(4):185-1. Publisher Full Text | PubMed
  11. Orr MJL. Introduction to radial basis function network. University of Edinburg: Scotland, Center of cognitive science; 1996.
  12. Du Plessis E, Swart F, Maree D, Heydenreich J, Van Heerden J, et al. The utility of hand-held mobile spirometer technology in a resource-constrained setting. S Afr Med J. 2019; 109(4):219-22. DOI | PubMed
  13. Ramos Hernández C, Núñez Fernández M, Pallares Sanmartín A, et al. Validation of the portable Air-Smart Spirometer. PLoS One. 2018; 13(2):e0192789. Publisher Full Text | DOI | PubMed
  14. Biselli PJC, Nóbrega RS, Soriano FG. Nonlinear Flow Sensor Calibration with an Accurate Syringe. Sensors (Basel).. 2018; 18(7):2163. Publisher Full Text | DOI | PubMed
  15. Milanzi EB, Koppelman GH, Oldenwening M, et al. Considerations in the use of different spirometers in epidemiological studies. Environ Health. 2019; 18(1):39. Publisher Full Text | DOI | PubMed
  16. Xie Y, Yu J, Xie S, Huang T, Gui W. On-line prediction of ferrous ion concentration in goethite process based on self-adjusting structure RBF neural network. Neural Netw. 2019; 116:1-10. DOI | PubMed