EMBEDDED HAND HELD SPIROMETER
A Project Report submitted to Devi Ahilya Vishwavidyalaya, Indore towards the partial fulfillment of the degree of Master of Technology In Embedded Systems
Guided By
Submitted By
Dr. Sumant Katiyal Head, SOEX DAVV, Indore
Shafi Patel 06MTES17
School of Electronics, Devi Ahilya Vishwavidyalaya, Indore (M.P) June, 2008
School of Electronics, Devi Ahilya Vishwavidyalaya, Indore (M. P.)
Statement of Originality In accordance with the requirements for the degree of Master of Technology in Embedded Systems, in School of Electronics, I present this report entitled “Embedded Handheld Spirometer”. This report is completed under the Supervision of “Dr. Sumant Katiyal”. I declare that the work presented in the report is my/our own work except as acknowledged in the text and footnotes, and that to my knowledge this material has not been submitted either in whole or in part, for a degree at this University or at any other such Institution.
Shafi Patel Date: / /
2
SCHOOL OF ELECTRONICS
DEVI AHILYA VISHWAVIDYALAYA INDORE ( M. P. )
RECOMMENDATION This dissertation entitled “Embedded Handheld Spirometer” submitted by Shafi Patel towards the partial fulfillment of Degree of Master of Technology in Embedded System of Devi Ahilya Vishwavidyalaya, Indore is a satisfactory account of his/her project work and is recommended for the award of degree.
---------------------
----------------------------
Project Guide
Head School of Electronics, DAVV, Indore
3
SCHOOL OF ELECTRONICS
DEVI AHILYA VISHWAVIDYALAYA INDORE (M.P.)
CERTIFICATE
This is to certify that the dissertation entitled “Embedded Handheld Spirometer” submitted by Shafi Patel is approved for the award of Degree of Master of Technology in Embedded Systems.
INTERNAL EXAMINER DATE:
EXTERNAL EXAMINER DATE:
4
ACKNOWLEDGEMENT
Preparing a project of this kind is an arduous work. I am fortunate enough to get support from a large number of people to whom I shall always remain grateful. Now when I am going to present the work the done in the first phase of the project,. I take this opportunity to express my gratitude and venerable regard for their helpful comments, suggestions and guidance during the development of project to Prof. Dr. Sumant Katiyal (H.O.D), Mr. Parag Parandkar, Mr. Rinkesh Tiwari and Mr. Satyendra Rathore, without their cooperation this project would not be completed successfully. Last but not the least; we would like to thank all the responders for giving us their precious time and relevant information and experience throughout the project.
Shafi Patel
5
CONTENTS
Chapter 1
Page 8
1.1 1.2 1.3
Page 9 Page 9 Page 11
Objective Background Existing Products/Technologies
Chapter 2
Page 13
2.1 2.2 2.3 2.4
Page 14 Page 18 Page 19 Page 20
Design Specification Block Diagram and Description Circuit Diagram Component Description
Chapter 3
Page 22
3.1
Page 23
Operation
Chapter 5
Page 25
4.1
Page 26
Future enhancements
References Appendix A Appendix B
Page 27 Program Code Datasheets
6
ABSTRACT Pulmonary function testing is one of the basic tools for evaluating a patient's respiratory status. Spirometers are used for an objective assessment of pulmonary function. They can measure the mechanical function of lungs, chest wall and respiratory muscles by recording volume, flow and pressure changes during expiratory or inspiratory manoeuvres. Many of these devices are commonly used for monitoring and evaluating patients in anaesthesia and intensive care environments. Some of these instruments are used more commonly for investigation and research whereas others are used in routine clinical practice. The aim of the project is to develop a handheld microcontroller based spirometry system capable of measuring and displaying Flow and Volume parameters during expiration and inspiration. The device is going to be low cost, lightweight and portable giving the freedom to the user to use and handle it easily. The device is aimed for home usage only. The components used are low cost and easily thus making it cost-effective, affordable and easily maintainable.
7
Chapter 1
8
1.1 Objective A great deal can be learned about the mechanical properties of the lungs from measurements of forced maximal expiration and inspiration. Since Hutchinson first developed the spirometer in 1846, measurements of the so-called dynamic lung volumes and of maximal flow rates have been used in the detection and quantification of diseases affecting the respiratory system. Over the years it has become obvious that the spirometer and peak flow meter used to measure ventilatory function are as deserving of a place in the family practitioner's surgery as the sphygmomanometer. It is important to appreciate that the clinical value of spirometric measurements is critically dependent on the correct operation and accuracy of the spirometer, performance of the correct breathing manoeuvre and use of relevant predicted normal values. Objective of the project are: 1. Developing a low cost handheld device to measure the flow and volume during expiration and inspiration. 2. It has to be a low cost product suiting the affordability of a common person. 3. It has to lightweight. 4. Accuracy and reproduction of the readings is critical. 5. Power consumption of the components and overall device has to be optimized as it will be running on batteries.
1.2 Background Conventionally, a spirometer is a device used to measure timed expired and inspired volumes, and from these we can calculate how effectively and how quickly the lungs can be emptied and filled. A spirogram is thus a volume-time curve and Figure 2.1 shows a typical curve. Alternatively, measures of flow can be made either absolutely (e.g. peak expiratory flow) or as a function of volume, thus generating a flow-volume curve Figure 2.2, the shape of which is reproducible for any individual but varies considerably between different lung diseases. A poorly performed manoeuvre is usually characterised by poor reproducibility. The measurements which are usually made are as follows: 1. VC (vital capacity) is the maximum volume of air which can be exhaled or inspired during either a forced (FVC) or a slow (VC) manoeuvre.
9
2. FEV1 (forced expired volume in one second) is the volume expired in the first second of maximal expiration after a maximal inspiration and is a useful measure of how quickly full lungs can be emptied. 3. FEV1/VC is the FEV1 expressed as a percentage of the VC or FVC (whichever volume is larger) and gives a clinically useful index of airflow limitation. 4. FEF25-75% is the average expired flow over the middle half of the FVC manoeuvre and is regarded as a more sensitive measure of small airways narrowing than FEV 1. Unfortunately FEF25-75% has a wide range of normality, is less reproducible than FEV1, and is difficult to interpret if the VC (or FVC) is reduced or increased. 5. PEF (peak expiratory flow) is the maximal expiratory flow rate achieved and this occurs very early in the forced expiratory manoeuvre. 6. FEF50% and FEF75% (forced expiratory flow at 50% or 75% FVC) is the maximal expiratory flow measured at the point where 50% of the FVC has been expired (FEF50%) and after 75% has been expired (FEF75%). Both indices have a wide range of normality but are usually reproducible in a given subject provided the FVC is reproducible. All indices of ventilatory function should be reported at body temperature and pressure saturated with water vapour (BTPS). If this is not done the results will be underestimated, because when the patient blows into a ‘cold’ spirometer, the volume recorded by the spirometer is less than that displaced by the lungs.
Figure 2.1: Normal spirogram showing the measurements of forced vital capacity (FVC), forced expired volume in one second (FEV1) and forced expiratory flow over the middle half of the FVC (FEF25-75%).
10
The left panel is a typical recording from a water-sealed (or rolling seal) spirometer with inspired volume upward; the right panel is a spirogram from a dry wedge-bellows spirometer with expired volume upward.
Figure 2.2:
Normal maximal expiratory and inspiratory flow-volume curve.
1.3 Existing Products/Technologies The full featured spirometer that fits in your hand. Weighs just over a pound. Disposable mouthpieces insert into the side of the unit and patient blows directly into it. No cables or wires. Takes both expiratory and inspiratory measurements, and can do flow volume loops. Cordless just point and click the SP-2 at an infrared printer adapter, or an infrared printer to download and print data. Provides 3 different reports – Flow/Volume, Volume/Time and/or measurement value. Stores up to 300 maneuvers in its flash memory. When batteries are changes (2 AA) the data is not lost and can still be downloaded for printing. Price: $1,695.00
11
Wireless Hand-held Spirometer The Pocket-Spiro BT100 spirometer can perform a number of different analyses, including classical forced spirometry and classical slow spirometry, enabling determination of the expiratory flow limitation and also dynamic hyperinflation. The latter method eliminates the need for multiple FEV1 measurements when monitoring broncho-dilation therapy. The special flow sensor incorporates a variable orifice membrane designed to ensure very low flow resistance and dead space. This membrane is unaffected by humidity and achieves very good linearity, even at very low flow rates. Since the breathing tube is independent of the spirometer, it can be removed for cleaning and sterilisation. Results are presented as flow-volume curves with the associated timevolume curves. The software can compare these values to normal results for adults, children and different ethnic groups or to broncho-provocation challenge test results, which are frequently performed to aid the diagnosis of certain respiratory disorders. Each test result is stored with the time and date in the patient’s individual record card, which can be viewed and restored upon request. The physician can work with four open patient cards at the same time. It is also possible to transfer data to a PDA or PC using Bluetooth technology. This spirometer features the new MEC report Designed Program, which offers many helpful tools for report formatting. These allow the user to configure reports to suit their individual needs and to integrate headings and hospital/practice logos. Each report can be viewed and evaluated on-screen prior to printing or transferred by e-mail for archiving. Price: $ 1,800.00
12
Chapter 2
13
2.1 Design Specifications Flow measurement: The determination of the quantity of a fluid, either a liquid, vapor, or gas, that passes through a pipe, duct, or open channel. Flow may be expressed as a rate of volumetric flow (such as liters per second, gallons per minute, cubic meters per second, cubic feet per minute), mass rate of flow (such as kilograms per second, pounds per hour), or in terms of a total volume or mass flow (integrated rate of flow for a given period of time). Measurement is accomplished by a variety of means, depending upon the quantities, flow rates, and types of fluids involved. Flow measurements consist of a combination of two devices: a primary device that is placed in intimate contact with the fluid and generates a signal, and a secondary device that translates this signal into a motion or a secondary signal for indicating, recording, controlling, or totalizing the flow. Other devices indicate or totalize the flow directly through the interaction of the flowing fluid and the measuring device that is placed directly or indirectly in contact with the fluid stream. Physical principles of gas flow and volume: The relationship between volume, flow and velocity is central to understanding gas flow and volume measurements. Flow rate is defined as the volume passing a fixed point in unit time. Velocity is the distance moved by a gas molecule in unit time. With laminar flow, the velocity of particles in the central part of the stream is higher than that of particles situated more peripherally. This creates a parabolic profile of velocities within the moving gas stream. This is usually expressed by the Hagen–Poiseuille equation: Q = Pr4π / 8ηl where Q is the flow rate, P is the pressure difference across l the length of a tube of radius r, and η is the viscosity. Turbulent flow is associated with multiple eddy currents and is related to the square root of the pressure drop and the density of the gas. Measurement of volume To measure volume by direct means, it is necessary to have a leak-free connection between the patient and the instrument. A change in breathing pattern results in changes in measurement of volume and flow. Thus, a representative picture of volume and flow needs to measure these parameters over a period of time. Measurement of unsteady gas flow rate Unsteady flow rate is associated with rapid changes in flow rate. To measure such flow, sophisticated instruments that vary rapidly with time are needed. 14
Fixed orifice (variable pressure drop) flow meters Pneumotachographs are used extensively for continuous measurement of flow and volume. The pneumotachograph is a variable pressure drop and fixed orifice flow meter. It is based on the Hagen–Poiseuille relationship, which states that the decrease in pressure along a straight rigid tube is proportional to the flow rate under laminar flow condition. Thus, the volumetric flow rate through a pneumotachograph is linearly related to the pressure drop generated across the resistive element. Tidal volumes are calculated by integrating flow signals over the duration of inspiration or expiration. A differential manometer or a pressure transducer is used to sense the true lateral pressure exerted by gas on each side of the resistance. The pressure difference across the resistance is kept minimal (10 mm H2O) so that the flow of gas is minimally affected by the resistance. Two types of pneumotachograph head are commonly used. The resistance in the Fleisch head (Figure 3.1) consists of a bundle of parallel-sided tubes having a diameter of 0.8–2 mm and a length of 32 mm. The pressure drop and critical velocity are increased by reducing the diameter of the tube. This arrangement provides the highest possible pressure drop while maintaining laminar flow. When the velocity of the air current does not exceed a certain limit, the air particles move under capillary conditions, thus ensuring a strict proportion between the velocity and the deflection of the transducer. Small turbulences appear when the limit has been crossed, evidenced by the slight oscillations of the recording. The number of tubes is matched to the desired range of flow rates. Condensation, due to moist gases, is prevented by heating the coil around the apparatus. The heating element also helps to maintain constant gas temperature. The pressure tappings consist of a series of holes in the casing at each end of the resistance unit. These lead into two annular chambers that are connected to the differential manometer by flexible tubes. The pressure transducer produces a small electrical signal for conditioning, analysis and display. The Silverman–Lilly head (Figure 3.2) contains a layer of metallic gauze which can be heated to avoid condensation. The trumpet-like configuration of the head is designed to achieve laminar flow over a wide range of flow (0–12 litres/s). Other types of head that contain plastic mesh are less liable to condensation if used for a shorter period of time. A resistance unit incorporating a diaphragm with V-shaped incision has been used to avoid condensation. The resulting flap opens progressively as flow is increased and so maintains a linear relationship between pressure and flow. Gas flow must be spread evenly across the resistance unit of the pneumotachograph. The velocity of the expired air varies accord ing to the rate of respiration. A single resistance system could not cope with such a wide range of velocities. The size of the head unit should be adjusted to the expected flow rates because turbulence causes nonlinearity if the expected flow rate is exceeded. A head that is too big can cause a very small pressure signal and too large a dead space. The size of the pressure drop depends on the characteristics of the resistance and the viscosity of the gas, which is mainly dependent on temperature and to a smaller extent on pressure. The composition of the gas, temperature, humidity and atmospheric pressure affect the output signal. Therefore, this instrument must be calibrated for the exact mixture of gas and temperature to be measured. A patient breathing in and out of a pneumotachograph causes difficulties because the composition of these gases is different and expired air is warmer than inspired air. These problems can be resolved by real-time gas analysis and temperature
15
measurement with dynamic correction. Thus, inspired and expired volume can be measured independently. Alternatively, the pneumotachograph can be placed in the inspiratory pathway of a non-return breathing system. To record a small pressure drop, a very sensitive manometer or transducer is needed. The geometry of the gas path from each side of the transducer must be similar to avoid pressure artefacts (e.g. following intermittent positive-pressure ventilation). Pneumotachographs are sensitive, accurate and fast and can be used to measure flow and volume. In addition to the differential pressure across the chamber, the absolute pressure in the airway can also be measured. When linked to the recorded tidal volume, compliance can be calculated and displayed in real time. The total resistance added by the pneumotachograph is very small (maximum 15 mm H2O) and it can be used in spontaneously breathing patients.
Figure 2.1
16
Figure 2.2
17
2.2 Block Diagram & Description
Dual Port Pressure Sensor
ADC
Display
Microcontroller AT89S8252
Input Control Power Supply
RS232C Interface to PC
18
2.3 Circuit Diagram
2.4 Component Description 19
Microcontroller (AT89S8252): The AT89S8252 is a low-power, high-performance CMOS 8-bit microcontroller with 8K bytes of downloadable Flash programmable and erasable read-only memory and 2K bytes of EEPROM. The device is manufactured using Atmel’s high-density nonvolatile memory technology and is compatible with the industry-standard 80C51 instruction set and pinout. The on-chip downloadable Flash allows the program memory to be reprogrammed In-System through an SPI serial interface or by a conventional nonvolatile memory programmer. By combining a versatile 8-bit CPU with downloadable Flash on a monolithic chip, the Atmel AT89S8252 is a powerful microcontroller, which provides a highly-flexible and cost-effective solution to many embedded control applications. The AT89S8252 provides the following standard features: 8K bytes of downloadable Flash, 2K bytes of EEPROM, 256 bytes of RAM, 32 I/O lines, programmable watchdog timer, two data pointers, three 16-bit timer/counters, a six-vector two-level interrupt architecture, a full duplex serial port, on-chip oscillator, and clock circuitry. In addition, the AT89S8252 is designed with static logic for operation down to zero frequency and supports two software selectable power saving modes. The Idle Mode stops the CPU while allowing the RAM, timer/counters, serial port, and interrupt system to continue functioning. The Power-down mode saves the RAM contents but freezes the oscillator, disabling all other chip functions until the next external interrupt or hardware reset. The downloadable Flash can be changed a single byte at a time and is accessible through the SPI serial interface. Holding RESET active forces the SPI bus into a serial programming interface and allows the program memory to be written to or read from unless lock bits have been activated. LCD (16X2 Lines) The 2 line x 16 character LCD modules are available from a wide range of manufacturers. LCDs have become very popular over recent years for information display in many ‘smart’ appliances. They are usually controlled by Microcontrollers. They make complicated equipment easier to operate. LCDs come in many shapes and sizes but the most common is the 16 characters x 2 line display with no back light. It requires only 11 connections – eight bits for data (which can be reduced to four if necessary) and three control lines (we have only used two here). It runs off a 5V DC supply and only needs about 1mA of current. The display contrast can be varied by changing the voltage into pin 3 of the display, usually with a trim-pot. Max232C The MAX220–MAX249 family of line drivers/receivers is intended for all EIA/TIA232E and V.28/V.24 communications interfaces, particularly applications where ±12V is not available. These parts are especially useful in battery-powered systems, since their low-power shutdown mode reduces power dissipation to less than 5μW. The MAX225, MAX233, MAX235, and MAX245/MAX246/MAX247 use no external components and are recommended for applications where printed circuit board space is critical. 20
ADC0804 8 bit Analog to Digital Converter The ADC0802 family are CMOS 8-Bit, successive-approximation A/D converters which use a modified potentiometric ladder and are designed to operate with the 8080A control bus via three-state outputs. These converters appear to the processor as memory locations or I/O ports, and hence no interfacing logic is required. The differential analog voltage input has good commonmode- rejection and permits offsetting the analog zero-input voltage value. In addition, the voltage reference input can be adjusted to allow encoding any smaller analog voltage span to the full 8 bits of resolution. MX2100 Dual Port Differential Pressure Sensor The MPX2100 series device is a silicon piezoresistive pressure sensor providing a highly accurate and linear voltage output — directly proportional to the applied pressure. The sensor is a single, monolithic silicon diaphragm with the strain gauge and a thin–film resistor network integrated on–chip. The chip is laser trimmed for precise span and offset calibration and temperature compensation. JHD12864E Graphical LCD •Display construction……………128*64 DOTS •Display mode ………………………STN / Yellow Green •Display type ………………………Positive Tranflective •Viewing direction…………………6 o’clock •Operating temperature……………Indoor •Driving voltage……………………Single power •Driving method………………………1/64 duty, 1/9 bias •Type……………………………………COB (Chip On Board) •Number of data line………………8-bit parallel •Connector……………………………20 Pin
21
Chapter 3
22
3.1 Operation
Power Up The System
Display Date and Time on LCD
Displays “Calibration” on LCD System Pauses for 5 Sec for Sensor warm-up
Takes Readings every 10ms for 2 sec
Compute Average of Data taken as the Zero point
Compute Variance of each reading from the Zero point if Variance is greater than a prescribed value repeat the procedure.
Display “Blow Now” on LCD
Takes Readings every 1 ms for 10 Sec.
23
Find out the maximum Value (Peak Flow) and Display it
Integrate Flow data to find out FEV
Take Temperature Reading and Adjust the PEF and FEV
Display the results (PEF and FEV) on LCD
24
Chapter 4
4.1 Future enhancements
25
1. It is planned to use a graphical LCD instead of alphanumeric LCD to display numerical parameter with the graphs of flow/volume and volume/time. 2. Adding the feature of maintaining a patient record of minimum 5 patients. 3. Replacing the 8-bit ADC with 12-Bit ADC for better resolution.
References
26
1. Respirometers including spirometer, pneumotachograph and peak flow meter. Anaesthesia & intensive care medicine, Volume 7, Issue 1, Pages 1-5 N. Mandal http://www.mdtmag.com 2. Prediction equations for maximal respiratory pressures in Indian adults. Devasahayam J. Christopher, BSc DNB DT*, Nazia Tabassum, RTT and Visalakshi Jeyaseelan, MSc, Christian Medical College, Vellore, India
27