microcontroller-based digital peak flow meter system
Post on 01-Jun-2018
227 Views
Preview:
TRANSCRIPT
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 1/98
Microcontroller-Based Digital Peak Flow Meter System
-------------------------
A Thesis Topic Proposal
Presented to the Faculty of the
Department of Electronics & Communication Engineering
College of Engineering, De La Salle University
-------------------------
In Partial Fulfillment of
The Requirements for the Degree of
Bachelor of Science in Electronics & Communication Engineering
--------------------------
CO, Jan Christian H.
GACUSAN, Bryan Gabriel D.
HONG, Bible T.
JUANSON, Joseph Anthony C.
October, 2010
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 2/98
CHAPTER 1
Introduction
1.1 Background of the Study
Changes brought about by the modern world are undeniable. Together with the
advancement of technology come new diseases that continue to challenge human
existence. There is an increase in the number of respiratory-related illnesses brought
about by the world’s continuous growth. There are developments in the field of
electronics that aims to provide sensors and components that could lead to portable, user-
friendly and improved lung capacity measuring devices [1]
. Spirometry is a physiological
test that measures how an individual inhales or exhales volumes of air as a function of
time. The primary signal measured in spirometry may be volume or flow. There are
numerous parameters obtained during a spirometry test. It varies depending on the nature
of the procedure, may it be for diagnosis or monitoring. One of particular parameter used
in monitoring lung capacity is called Peak Expiratory Flow (PEF). It is the highest flow
achieved from a maximum forced expiratory test from a maximum lung inflation[9]
It is
used to monitor lung conditions, one of which is asthma. Chronic Obstructive Pulmonary
Diseases (COPD) is a type of disease commonly associated with the lungs[2]
. The most
common types of this respiratory ailment are emphysema, chronic bronchitis, and asthma.
According to a study done by the World Health Organization (World Health Statistics
2008), they estimated that 210 million people have COPD, 23 million died from it over
the past year [8]
. They also predicted that at this rate, it would be the 3rd
leading cause of
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 3/98
death worldwide. The study focuses on developing a microcontroller based digital peak
flow meter system. It provides an alternative to lung capacity testing and monitoring that
are currently done in local hospitals. The system also provides features that are
convenient with regards to monitoring a patient’s lung condition since the device can be
interfaced to a computer to view the results. The data can be viewed by the doctor
through a website obtained from its database.
1.2 Statement of the Problem
In an era when heart disease and cancer are declining, COPD is on the rise in
developing countries such as the Philippines[8]
. Spirometry is the most common test that
is used to measure the lung capacity and the volume of a person’s lung through inhalation
and exhalation of air. It includes different types of tests that doctors use either to diagnose
or to monitor the patient’s lung condition. Since asthma is one of the main causes of
absences during school. It can be caused by a lot of factors that are not yet fully
understood by researchers. It is one of the important chronic respiratory diseases
requiring daily monitoring at home[10]
.
For monitoring the lung condition of a patient, a peak flow meter is used. Peak
expiratory flow (PEF) meter is a portable device widely used by asthmatic patients,
providing the peak expiratory flow (PEF) by a simple self-test[10]
. A peak flow meter is
used to help monitor the medical situation of a patient, asthma being one of this. The
most common type of peak flow meters available in the market is the spring type peak
flow meter. It is an analog device commonly used in local hospitals today to determine
the lung capacity of the patient. An indicator will provide a gauge of how well the
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 4/98
patient's lung functions. This is being determined by reading graduations on the device.
The acceptability of the result is subject to the proper interpretation of the user. Thus, the
data is subject to human error. The data is manually plotted, afterwards presented to a
doctor for assessment. The prototype aims to provide an alternative to this method by
providing a digital output in the evaluation process and remote monitoring of the patient.
The group’s prototype aims to provide assistance to the doctor by allowing the
results of the test to be sent to a computer with use of the Bluetooth technology as its
medium. The information can be then sent to a database that can be viewed by the doctor.
This functionality will allow the doctors to monitor the data through a website that
contains the patient’s information from the server and will allow them to have a better
way of gathering data from the patients.
1.3 Significance of the Study
In numerous occasions, chronic pulmonary medical conditions are often
misinterpreted as minor lung ailments. Disregarding COPD ailments can lead to major
complications in the lung passageways. This study aims to integrate the field of
electronics to the medical world in monitoring pulmonary medical condition by providing
patients with a device that can assess lung air capacity and send them to the computer to
be further viewed and analyzed. Lung obstructions and restrictions can be easily
monitored by the electronic peak flow meter by acquiring the accurate peak expiratory
flow measurements.
The group’s prototype is a digital peak flow meter that would assess the lung
functionality of a patient. The prototype would determine the flow rate. Peak flow meters
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 5/98
available in hospitals and clinics are not digital and is prone to parallax error since the
results depends on proper human interpretation. The device is also portable, allowing
ease of use whenever the patient has to perform the tests required for a day. The LCD
screen would display the results obtained from the test. The push buttons will be used for
the operation of the device. It can be interfaced to a computer through Bluetooth
technology allowing wireless capability. The prototype that the group is proposing can
also provide remote data access through web based feature. The doctors can view the
results remotely; make their recommendations as soon as they get the results from the
database.
1.4 Objectives
1.4.1 General Objective
1.4.1.1 Develop a microcontroller-based digital peak flow meter that would
measure lung capacity and send the obtained data to a computer wirelessly.
1.4.2 Specific Objectives
1.4.2.1 To use a flow sensing circuit to determine lung air flow
1.4.2.2 To program the microcontroller to output flow rate and send the data to a
computer by adapting Bluetooth technology.
1.4.2.3 To display the test result through the LCD.
1.4.2.4 To build the device with an accuracy of 90% as compared to a Mechanical
Peak Flow Meter
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 6/98
1.4.2.5 To use a Graphic User Interface (GUI) that would display the data sent to
the computer.
1.4.2.6 To view the data in a Website that can be accessed by the doctor to view
the data obtained by the system.
1.5 Scope and Delimitation
The patient should be able to understand the procedure therefore he/she cannot
be; unconscious, heavily sedated, incapable of understanding the instructions and/or
incapable of forcibly exhaling through the tube. The group would consult a medical
physician regarding the data gathering method to be used and results obtained. The
consultation would also provide us knowledge, guiding us suppose an error occurs. The
system shall focus only on obtaining the peak expiratory flow (PEF) that is used to
monitor asthmatic condition through lung response. The system will not diagnose the
type of lung illness. Data shall be sent to the computer through the Bluetooth interface
and the results shall be listed and compiled as well as its graph for data gathering
purposes. The computer will be the master, the device which initiates the connection, and
the hand-held device will be the slave with regards to the use of the Bluetooth interface.
The patient should have a Bluetooth-enabled personal computer together with the
software that would display the output of the device. The computer used by the doctor
should contain the graphical user interface (GUI) that would be used to access the
database. The patient should also have the GUI in order to input his or her data and
perform the test. With accordance to the pulmonologist, a test per day should be
sufficient to follow the monitoring of the patient’s lung condition. The device is intended
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 7/98
for home use. The system, specifically the website for the doctor, is only accessible
through local area network using a router since the proponents will be using DLSU-M’s
internet connection for the development of the system. The setup with the router is for
demo purposes only.
1.6 Description of the Project
The block diagram of the prototype is shown below:
Figure 1.1:Block Diagram of the System
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 8/98
1.6.1 Sensor Block
The sensor block will be used to gather the data from the patient’s lungs as
he breathes into the tube. The output obtained from the sensor will be sent to the
microcontroller for processing.
1.6.2 Push Button and LCD Block
The Push buttons and LCD would serve as the input/output (I/O) devices
of the prototype. The LCD will be used to display the test results. On the other
hand, the push buttons will enable the user to operate the device. The push buttons
will serve as the reset button for the MCU and Bluetooth, while switches will be
used to turn the MCU and Bluetooth on and off
1.6.3 Microcontroller Unit
The microcontroller will process and utilize the data obtained from the
sensor. It would perform the operations needed to determine the flow rate of air
from the patient’s lungs. Using these data, it would output the lung capacity
parameters for monitoring purposes. The data gathered can be then sent to the
computer through the Bluetooth feature. A graphical representation of the test can
be viewed and further analyzed by the user.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 9/98
1.6.4 GUI (client and server)
Two key GUI’s will be used for the system; one will be used for the
client’s computer , another will be used for the server which contains the patient’s
information.
1.6.5 Website
The website will provide the means by which the doctor can view the
results. It contains the patient’s information, allowing the doctor to view the
results over a network
1.7 Methodology
In this thesis, the group shall be responsible in performing tests on the hardware.
The group shall perform 20 tests per patient (see Appendix A for calculation). The data
that would be used as reference for the operation of the device will be the spring type
PEF available in the local market. The group would consult a specialist in lung
functionality in order to gain more knowledge about Peak Expiratory Flow. In
constructing the prototype, the group would also be responsible in studying the
specifications of the microcontroller and Bluetooth technology through the use of their
respective datasheets. Also, the group would study the algorithm of programming the
microcontroller so that it would follow the algorithm of the thesis project. The group
would also study the software necessary to gather data from the microcontroller unit and
transfer it to the computer. The group would create a database for the doctor’s reference
on each patient. In building the peak flow meter, the group shall search for resources to
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 10/98
aid them in constructing the hardware of the system which includes the flow tube,
calculating system for the flow rate which is determined through the use of sensors, and
the LCD to display results.
1.8 Gantt Chart
Activity May June July Aug Sept Oct Nov Dec Jan Feb March April
Brainstorming of Proposal
Preparation of Proposal
Preparation of Materials
Purchasing of MaterialsBuilding of Project Prototype
Programming of Microcontroller
Integration of Prototype
Testing
Evaluation of Results
Recommendation of Adviser
2009 2010
1.9 Estimated Budget
Mouthpiece and tubing P100
Bluetooth P1500
LCD Display P300
Flow sensing Circuit P5000
Miscellaneous P7000
Total: P13,900
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 11/98
CHAPTER2
Review of Related Literature
2.1 A Differential Pressure Approach to Spirometry
(Flow Rate Measurement)
In developing the prototype, it is imperative that we understand the flow
measurement part of the design. In order to meet the requirements of the PEF test, we
must choose carefully the sensors to be used to obtain the best results. In our work, we
are to take into consideration the different aspects of flow measurement to determine the
flow rate needed. We are to obtain a, volumetric flow rate for our thesis so one of the
options that we could consider is the use of differential pressure sensing.
In this particular article describes a possible implementation of the prototype. This
follows the theory set forth by Bernoulli in his equation. The main principle which
underlies differential pressure flow measurements is the mathematical expression of
Bernoulli’s theorem which states that introducing a constriction within a tube would
generate a difference in pressure. The equation shown below can describe the relationship
between the parameters needed.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 12/98
In this equation Cd is described as the coefficient of dispersion, typically 0.97. A2 and
A1 are the area of the inner and outer parts of the tube, while (p1-p2) is the pressure
difference across the tube. Rho is the fluid density of air expressed in kg/m^3. The choice
of the sensor is crucial for the performance. The device has to cope with flow rates up to
14 L/s with an accuracy of 0.2 L/s. Due to the non linear relation between pressure and
flux, the very large range of 3500 Pa with an accuracy of 0.12 Pa must be achieved. To
match these specifications, they used sensors: a large dynamic range sensor and a low
dynamic range sensor, but with high accuracy, were coupled. The first one (Honeywell
24PCEFA6D) is able to measure up to 3449 Pa whereas the second sensor (AllSensor
1mbar D-4V 6M67) has a maximum range of 100 Pa and an accuracy of 0.1 Pa suitable
for the requirements.
In our groups design, however, we are concerned only on the PEF reading so we
don’t have to couple a low range sensor since it may not be able to read the maximum
expiration of the patient since it will saturate at a lower level.
2.2 Peak expiratory flow meter capable of Spirometric
test for asthma monitoring
Asthma is one of the important chronic respiratory diseases requiring daily
monitoring at home. Peak expiratory flow meter (PEFM) is a portable device widely used
by asthmatic patients, providing the peak expiratory flow (PEF) by a simple self-test.
Commercial PEFM produces displacement of a spring connected plate by the force
generated on the plate by patient's expiratory flow. The patient reads the maximum
displacement position on scale of the marker moving with the plate during increased flow
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 13/98
period In developing the prototype, we should be able to understand the principles behind
PEF measurement as well as the electronic components used in the design. There are
various ways on achieving a flow measurement with regards to the flow sensor to be
used. In this particular article, the proponents used a differential pressure sensing device.
Air chamber pressure signal was sensed by 3 differential pressure transducer (MPX2010,
Motorola, U.S.A.), amplified and filtered appropriately. A digital circuit was followed for
ADC conversion and data output with the RS232C serial communication protocol.
2.3 Spirometry (Peak Expiratory Flow or PEF Test
Guidelines and Equipment Specifications)
Spirometry is a test in which lung ailments and diseases such as Chronic
Obstructive Pulmonary Disease can be easily diagnosed. Spirometry is a physiological
test that measures how an individual inhales or exhales volumes of air as a function of
time. The primary signal measured in spirometry may be volume or flow. It is invaluable
as a screening test of general respiratory health in the same way that blood pressure
provides important information about general cardiovascular health. However, on its
own, spirometry does not lead clinicians directly to an aetiological diagnosis.
Spirometry can be undertaken with many different types of equipment, and
requires cooperation between the subject and the examiner, and the results obtained will
depend on the factors varying with each patient. Test performed are either used to
diagnose a certain ailment, or monitor a patients lung condition over a certain time
period. It can be performed at home as instructed by the physician.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 14/98
In monitoring a patient’s lung condition, for example an asthma patient, he or she
can perform a Peak Expiratory Flow test. PEF is the highest flow achieved from a
maximum forced expiratory maneuver started without hesitation from a position of
maximal lung inflation. When it is obtained from flow – volume curve data, it is expressed
at BTPS in liters/sec. The defining characteristics of the flow – time curve, in relation to
PEF, are the time taken for flow to rise from 10% of PEF to 90% of PEF, i.e. the rise time
(RT), and the duration that flow is .90% of PEF, called the dwell time (DT). When PEF is
obtained with portable monitoring instruments, it is expressed in liters/min.
Ideally, PEF should be recorded by an instrument that primarily records flow.
Measuring PEF requires an instrument that has a flat frequency response (5%) up to 15
Hz.Although there is evidence of significant frequency content in PEF up to 20 Hz, it is
recommended, at this stage, that manufacturers achieve a goal of recording fidelity up to
15 Hz.The PEF must be measured with an accuracy of 10% or 0.3 liters/sec (20 L/min),
whichever is the greater.
PEF is dependent on effort and lung volume, with subject cooperation being
essential. PEF must be achieved as rapidly as possible and at as high a lung volume as
possible, in order to obtain the maximum value. The subject must be encouraged to blow
as vigorously as possible. The neck should be in a neutral position, not flexed or
extended, and the subject must not cough. A nose clip is not necessary. After the point of
full lung inflation, the subject must deliver the blow without any delay. Hesitating for as
little as 2 s or flexing the neck allows the tracheal visco-elastic properties to relax and
PEF to drop by as much as 10%. Tonguing,spitting or coughing at the start of the blow
may falsely raise the recorded PEF in some devices.In the laboratory, the subject must
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 15/98
perform a minimum of three PEF manoeuvres. When PEF is a self-administered
recording, it is important that the subject has been adequately taught how to perform the
test, when to perform it and what action to take depending on the resting value obtained.
Regular checks of the patient’s PEF technique and meter are an important part of the
follow-up.
2.4 Development of a Prototype Digital Spirometer
(Sensors)
The growing world comes at a price. We have become more exposed to hazardous
elements that prove to be a challenge to the human body. There are developments in the
field of electronics that can provide user friendly, portable and improved spiromety
systems. In the work of Chin-Wann Lin, Di-Ho Wang, and Hao-Chien Wang entitled
“Prototype development of a digital Spirometer”, they studied the development of a
prototype digital spirometer. Specifically, their work discussed design principles,
including sensors that could be used in the development of a portable model. They've
stated that the basic spirometer design falls down into two categories, flow-sensing and
volume-sensing. Yet, for most modern designs, flow-sensing would prove to be practical
not only from developments brought about by advancements in modern electronics, but
because of its compact size compared to volume-sensing models. It is a suitable
component to use in designing portable spirometers. They gave four examples of
transducers that the developer can use in their model: 1. a pneumotachometer for pressure
difference, 2. a hot wire anemometer for any temperature difference across the valve, 3.
turbinometer for revolutions per unit time of a certain propeller of a turbine, 4. ultrasound
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 16/98
for transient time across the lumen. In the design of their prototype, they used a used a
hotwire sensor with an end connected to a Whetstone bridge and then excited with a
constant voltage level without a negative feedback. Their thermal bridge is then
connected to an analog to digital converter (ADC) and a microprocessor to process the
data. Their prototype also included the use of a keyboard, LCD, audio components, 32K
EPROM for the algorithm, 32K SRAM that is used to process the data, and a UART for
serial communication. From the flow-time curve, volume-time curve and the flow-
volume curve gathered, and then the pulmonary parameters that are used in spirometry
(FEV1, FVC, FEV1/FVC) are computed and compared accordingly from the these
curves.
2.5. Bluetooth in Wireless Communication
In 1994, L. M. Ericsson of Sweden just invented the future of wireless
communication. Named after the king of Denmark in 940 A.D., Bluetooth technology
was introduced. Competing with IrDA and HomeRF, Bluetooth took wireless
communication to much greater heights. Improving IrDA’s 1 meter separation for
transmission and its line-of-sight propagation requirements, Bluetooth has 10 meters of
range and can be further increased depending on the strength of the receiver. It does not
require line-of-sight propagation which will be suitable for our thesis, a portable
spirometer. It is clearly a better tool for PC-to-peripheral connection compared to IrDA
for our thesis because the thesis aims to be portable, thus it can and must be located
slightly away from the PC and must not use line-of-sight propagation to give the doctors
and patients flexibility while testing.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 17/98
With the help of the journal, we will be able to further understand Bluetooth
technology as we aim to implement our thesis using the technology. The journal includes
details about Bluetooth such as the basic configurations, frame formats, hardware and
software implementation and protocols together with the architecture and network
topology of Bluetooth, which is very helpful for our thesis. With the increase of
companies taking part in the Bluetooth Special Interest Group (SIG), the implementation
of our thesis using Bluetooth only makes sense in order to keep in pace with today’s
technology.
The journal also talks about essential components in order to establish a Bluetooth
connection such as devices that will serve as the master and slave, host controller
interface, the establishment of connection of each layer, link manager and how to
disconnect or end the connection. With this information the group will able to have a
grasp of the technology. This part of the thesis is essential as it will be the one to transfer
the data from the spirometer to the computer, which is monitored by the doctor, so proper
knowledge of Bluetooth will be imperative. This journal will be a great help to the group
as they try to learn and understand the different components that comprises their thesis to
be able to properly integrate them.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 18/98
CHAPTER 3
Theoretical Considerations
3.1 Flow Measurement
3.1.1 Differential Pressure Sensor
Figure 3.1 Inside a differential pressure sensor (MP3V5004DP Datasheet)
Figure 3.2 Differential pressure sensor (MP3V5004DP Datasheet)
A silicon chip acts as the pressure-sensitive element on micromechanical
piezoresistive pressure sensor which is etched on the chip which forms a cavity.
At the high stress points on the membrane atoms that are locally implanted in the
silicon crystal, zones with an altered conductivity are formed which electrically
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 19/98
function as a resistor. In the moment an external pressure is applied, the molecular
structure of the silicon crystal will be deformed when the silicon membrane dents.
In the resistor areas the piezo effect is observed. When the mechanicl crystal
shifts it creates a measurable change in their electric value and if the said resistors
are connected up as a Wheatstone Bridge, when there is an impressed current or
voltage, a differential signal in volts will be generated.
Differential pressure can be defined as the pressure difference between
two distinct points and so, when measuring differential pressure, two pressures
are compared. With most pressure sensors, it is often the case that only one
pressure ratio, namely P1/P2 ≥1 or P1/P2 ≤ 1, can be evaluated and the
measurement of pressure under the said condition is referred to as "differential
pressure measurement".
Differential Pressure sensors can only determine a specific range of
pressure and is only suitable in the pressure range they are relevant. It applies to
most that P1-P2 ≤ Pmax or P2-P1 ≤ Pmax, where Pmax is determined by the
technical conditions and is specified. Two conditions can be observed about
pressure sensors when it reaches a certain pressure, the proof and burst pressure.
The proof pressure is the maximum pressure which may be applied without
causing durable shifts of the electrical parameters of the sensing element while the
burst pressure is the maximum pressure which may be applied without causing
damage to the sensing element or leaks from the housing. These conditions must
be taken into account when the user connects up the pressure to the sensing
element. Overall, pressure can be measured due to the amount of dent the
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 20/98
membrane exerts on the silicon crystal. When there is no dent, there is no pressure
exerted and when the dent gradually increases, the pressure measured also
increases.
3.1.2 Bernoulli’s Equation
In measuring the volumetric flow rate of fluids, one of the most commonly
used methods is differential pressure measurement. By having a constriction
across, a tube would have a change in pressure. This change in pressure can be
translated into flow rate by computation. There are different flow tubes that are
used for different differential pressure measurement systems but they all follow
the Bernoulli equation. Bernoulli’s equation, named after Daniel Bernoulli, states
that an increase in flow speed of a fluid denotes a corresponding decrease in
pressure.
Equation 3.1. Bernoulli’s Equation
Where: h h h
h
h h h h
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 21/98
Since flow rate is constant all throughout the tube, furthermore, the volumetric
flow rate is expressed as, , and , at initial and throat point
respectively, we have
Equation 3.2. Relationship between volumetric flow rate at initial and throat sections
Where is the cross sectional area of the initial section and is the
cross sectional area of the throat section. In order to solve for the constant that is
to be used for the programming of the microcontroller to output the corresponding
volumetric flow rate from the sensor reading, we must first determine Q1 which is
the volumetric flow rate. Simplifying Bernoulli’s equation to get Q1 we must first
solve for V1 from Equation 3.1.
Assuming that the altitude is constant in the equation, we can use
equation 3.2 to equation 3.1, we can now isolate to get,
Equation 3.3
By isolating and , we can simplify the equation since .
denotes the fluid density of the fluid in.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 22/98
Equation 3.4
Equation 3.5
Where the diameter of the initial is section and is the diameter of the throat. With
cancellation of similar terms we get,
Equation 3.6
We now have a value for V1 given the venturi tube diameter at the opening and at
the throat. In determining the volumetric flow rate Q, we can multiply V1 and the
cross sectional area of the corresponding section of the tube.
From this equation, we can now determine the volumetric flow rate needed.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 23/98
3.1.3 Flow Tubes
The following are the different types of flow tubes that follow
Bernoulli’s Equation. They are described below.
3.1.3.1 Orifice Plate
Figure 3.3 Orifice Plate Diagram
An orifice tube is a type of flow tube that introduces a constriction
to the inner section of the pipe through an element known as an orifice
plate. An orifice plate is a circular plate inserted in the flow tube that has a
hole in the middle. This hole introduces a constriction in the middle which
pushes the fluid flowing to converge. This in turn, increases the fluid
velocity of the fluid with a corresponding decrease in pressure. The
pressure difference is measured before and after the orifice plate.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 24/98
3.1.3.2 Pitot Tube
Figure 3.4 Pitot Tube Diagram
A Pitot tube is another type of flow tube used for flow rate
measurement. In this flow tube however, instead of an orifice
plate, an impact probe is inserted in the tube. This impact probe is
faced directly to the flow. A pressure difference can be measured
as fluid flows through the probe.
3.1.3.3 Venturi Tube
Figure 3.5 Venturi Tube Diagram
The venturi tube is a flow tube that has a larger pipe
diameter at the ends then gradually constricts in the middle. The
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 25/98
constriction in the middle is known as the throat. As the fluid flows
through the tube and into the converging section, it increases its
velocity as the cross sectional area decreases. This corresponds
also to a drop in pressure from the wider section. A difference in
pressure is obtained across the pressure taps located at the throat
and the initial section. This can be measured by a u-tube or by a
differential pressure sensor.
3.2 Microcontroller Unit
A microcontroller unit (MCU) is a circuitry that involves the use of a
microcontroller that serves as the brain of a system. It has a single chip that contains the
central processor (CPU), non-volatile memory for the program, read-only memory
(ROM) as an example, and volatile memory for the input and output, like random access
memory (RAM). Microcontrollers come in different sizes and architectures that choosing
the right type of microcontroller greatly depends on the application.
Figure 3.6 Basic Microcontroller
Microcontrollers are designed for embedded applications, which is why the group
decide to consider using it for the project. Microcontrollers are commonly used in
automated systems to control the system with respect to all the inputs and outputs. The
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 26/98
MCU is a very critical part of the system because it will send out the necessary
information to the whole system so that it will work the way it should be.
3.2.1 Microcontroller SpecificationsA critical part of selection of microcontrollers is the specification
and computing power that the microcontroller can provide.
Microcontrollers are usually classified according to their arithmetic
registers and index registers. This groups are more commonly known as 8-
, 16-, 18-, 32- bit groups. The cost of each group is also proportional to its
features, capabilities and limitations.
3.2.1.1 Microcontroller Resources
Microcontroller units have an on-chip resource that allows
it to attain higher level of integration and reliability. An on-chip
resource is defined as a block built inside the MCU so that it can
perform different functions that can be used by the microcontroller.
Since these resources are built-in, it increases the overall reliability
of the MCU because external circuitry will be unnecessary to be
able to use the said functions. Popular on-chip resources that are
commonly used are memory devices, which include random access
memory (RAM), read only memory (ROM), erasable
programmable read only memory (EPROM), Electrically Erasable
Programmable Read-Only Memory (EEPROM), and flash
memory, timers, system clock, oscillator, and I/O.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 27/98
3.3 Bluetooth
Bluetooth is one of the newest networking technology that use a low transmission
power setting, typically 1 milliwatt. Bluetooth technology is ideal for mobile battery
operated devices and systems. Bluetooth can also instantly connect, detect and
communicate to other Bluetooth devices without relying on a user input. Bluetooth
technology primarily relies on two important things; a radio frequency technology that
will allow the communication between two devices, and software with a set of protocols
that will enable and control traffic between two devices in transmitting and receiving data
to each other.
3.3.1 Radio Frequency Properties
The principal transmission system used in Bluetooth technology is low
energy radio waves. The frequency of operation of Bluetooth devices are typically
2.40 GHz to 2.48 GHz, which is a radio frequency reserved for medical, industrial
and scientific devices.
3.3.2 Bluetooth Connection
Bluetooth devices can interact with one or more Bluetooth devices. When
there are only two devices connected with each other, wherein one acts as the
master and the other the slave, the connection made is called point to point. But
when Bluetooth devices connected together where in one acts as a master and the
others act as the slaves, this ad-hoc network is usually called as a Bluetooth
piconet. There can be a maximum of 7 active slaves in a piconet. Bluetooth
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 28/98
devices in a piconet integrate and synchronize their frequency-hopping to keep in
touch with each other. Finally, a scatternet is a group of Bluetooth piconets
interconnected together.
Figure 3.7 Bluetooth Connections: (a)Point to Point (b) Piconet (c) Scatternet
Since every device in a Bluetooth piconet is synchronized in frequency-
hopping there is minimal risk of two Bluetooth piconets interfering with each
other. Piconets also change frequencies 1600 times per second making a collision
between two piconets to last only a fraction of a second.
3.3.3 Bluetooth Power Classes
There are 3 types of power classification when using Bluetooth
technology.
These are the following:
Type Power Level Operating Range
Class 3 Devices 100mW Up to 100 meters
Class 2 Devices 10mW Up to 10 meters
Class 1 Devices 1mW 0.1-10 metersTable 3.1 Bluetooth Power Classes
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 29/98
3.3.4 Bluetooth Interfacing
There are a lot of ways to implement Bluetooth technology in a system.
For our thesis, the group has decided to make use of a Bluetooth module that will
connect with the universal asynchronous receiver/transmitter (UART) pin of the
microcontroller unit. This type of interface will make use of the Bluetooth module
as the bridge to connect the MCU to the computer for data interpretation. The
Bluetooth will incorporate the serial port profile (SPP) that will emulate a serial
cable connection so that it could be interfaced with the UART of the
microcontroller unit.
3.3.4.1 Bluetooth Serial Port Profile
The EGBT 9830 incorporate a Bluetooth Serial Port Profile (SPP)
that allows it to communicate to the PIC16F877a’s serial port module. The
SPP defines how to set-up virtual serial ports on two devices and
connecting them with Bluetooth technology. When the two devices
connect, the Bluetooth units emulate a serial cable using Recommended
Standard 232 (RS-232) control signaling. RS-232 is a common interface
standard for data communications equipment; primarily used on the serial
port of a personal computer. The profile ensures that data transmission can
speed up to 128 kbit/sec. The profile defines the roles of the two devices;
who will take the initiative to connect (Master) and another who will wait
for a connection to be requested (Slave) The whole profile emulates serial
port communication and the figure below will show how it is being
emulated.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 30/98
Figure 3.8 Figure showing serial port emulation
From the figure, the baseband, Link Management Protocol (LMP)
and Logical Link Control Adaptation Protocol (L2CAP) are the Open
Systems Interconnection (OSI) layer 1 and 2 Bluetooth protocols. Radio
Frequency Communication (RFCOMM) is a Bluetooth adaptation that
provides a transport protocol for serial port.
3.4 TCP/IP
3.4.1 TCP/IP Model
Prior to the development of the 7 OSI Layer, there existed an earlier model
called the Transmission Control Protocol/Internet Protocol (TCP/IP). It is the
basic communication language or protocol of the Internet. The TCP/IP model
involves a set of general design guidelines and implementations of specific
networking protocols to allow communication of computers over a network.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 31/98
TCP/IP provides an end-to-end connection which specifies the matter at which
data should be formatted, addressed, transmitted, routed and received at the
destination. When setting up a direct access to the Internet, every computer is
provided with a copy of the TCP/IP program. TCP/IP is a two-layer program. The
higher layer, Transmission Control Protocol, handles the encoding or assembling
of a message or file into smaller packets that is sent over the Internet. A receiving
unit, which also has a copy of the TCP/IP program, decodes or disassembles the
message or file to its original form. The lower layer called the Internet Protocol
handles the address of each packet to ensure that the message arrive at its rightful
destination.
TCP/IP uses a client/server model of communication in which a user
(client) requests and is provided a service by another computer (server) in the
network. TCP/IP communication is point-to-point. TCP/IP and the higher-level
applications that use it are collectively said to be "stateless" because each client
request is considered a new request unrelated to any previous one and by stateless
it means that it frees the network paths so that anyone can use it continuously.
Taking note however that the TCP layer is not stateless until all the packets in a
message are received by the requesting client.
TCP/IP is sometimes referred to as the Internet model. It has
four abstraction layers as defined in RFC 1122. Shown below is the TCP/IP’s
corresponding layers used at each hop.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 32/98
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 33/98
3.4.2 The Link Layer
The Link Layer is practically the scope in networking of the local
connection in which a host is attached. The Link Layer is used to move
packets of two different hosts on the same link between each of their
Internet Layer. It is under this layer that the process of transmitting and
receiving packets can be controlled in the software device driver for the
network card, firmware or specialized chipsets. These perform data link
functions such as adding a frame header to prepare it for transmission over
a physical medium. It is also under this layer that the process of sending
can be chosen whether it would be over a virtual private network or
networking tunnel.
3.4.3 The Internet Layer
The Internet Layer answers the problem about sending packets
across one or more networks. Internetworking requires sending data from
a source network to a specific destination. This process is called routing.
The Internet Protocol has two basic functions. First is the Host Addressing
and Identification and this is accomplished through the use of IP address.
The second function is the Packet Routing which is the basic task of
getting packets of data (datagrams) from a source to a destination by
sending the packets to the next network node (routing) closest to the
destination.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 34/98
3.4.4 The Transport Layer
The Transport Layer is the one responsible for the end-to-end
message transfer capabilities regardless of underlying network along with
error control, flow control, congestion control, and application addressing
(port numbers). End-to-end messaging or connecting application at the
transport layer can be categorized as either connection-oriented, such as in
Transmission Control Protocol (TCP), or connectionless, such as in User
Datagram Protocol (UDP).
In layman’s term, the transport layer can be thought of as a
transport mechanism such as a vehicle responsible to ensure the safe
arrival of its goods/passengers to the destination. It is practically safe to
say that the Transport Layer is the first stack of the TCP/IP to offer
reliability. Protocols above transport also offer reliability.
3.4.5 The Application Layer
The Application Layer is the higher-level protocol that is
commonly used by most applications for networking communication.
Some examples of the application layer protocols are the File Transfer
Protocol (FTP) and the Simple Mail Transfer Protocol
(SMTP).Application Layer generally treat the transport layer and lower
protocols as “black boxes” which provide a stable network connection
across the device to which it communicates. Transport and lower level
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 35/98
layers are largely unconcerned with the specifics of application layer
protocols.
3.5 Programming Software and Languages
3.5.1 C# Language
Microsoft C# is a new programming language designed for wide range
applications that run on the .NET framework. It is considered as an evolved
version of the Microsoft C and Microsoft C++. It is mostly simple, modern, type
safe, and object oriented. C# codes are compiled as managed codes which benefits
from the services offered by common language runtime. It is designed to work as
an integration of the capabilities of both Microsoft C++ and the Visual Basic
along with Java programs. The services available include language operability,
garbage collection, enhanced security, and improved versioning support. The
library for Visual C# programming is the .NET Framework.
3.5.2 Microsoft SQL 2008
Figure 3.11 Microsoft SQL server 2008
Structured Query Language (SQL) is a computer language used as
database management for relational database management system (RDBMS). Its
scope comprises of data insert, query, update and delete, schema creation and
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 36/98
modification and data access control. It is practically used to manipulate database
information with the help of programming languages such as Visual C# by
establishing connection strings to the SQL Manager.
3.5.3 ASP.NET Programming
Figure 3.12 ASP.Net
ASP.NET is a web application tool developed by Microsoft to allow users
to develop dynamic web sites, web applications, and web services. ASP.NET is
the next generation of ASP. However, it is a misnomer to say that ASP.NET is the
upgraded version of ASP. ASP.NET is a completely new technology for server-
side scripting. ASP.NET is a part of the Microsoft .NET Framework and it is a
powerful scripting tool for creating dynamic and interactive pages. It is built on
the Common Language Runtime (CLR) which allows programmers to write
ASP.NET code using any supported .NET Language.
3.5.4 Internet Information Services (IIS)
IIS, formerly called Internet Information Server, is a web server
application created by Microsoft to support web publishing. IIS is a group of
Internet servers (including a Web or Hypertext Transfer Protocol server and File
Transfer Protocol server) with additional capabilities for Microsoft's Windows
NT and Windows 2000 Server operating systems. It is a Windows component that
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 37/98
comes along with Windows Operating System. IIS allows web pages developed to
be published either on local area network, wide area network or internet based
network. This web application is accomplished by creating virtual directories
wherein requested pages by users are directed to that virtual directory.
3.5.5 Browser
A browser is a web application used for retrieving, presenting and
traversing information resources on the World Wide Web. A protocol is used to
establish an understanding between the requesting party and the browser. This
protocol is called the Hyper Text Transfer Protocol (HTTP).
A browser understands HyperText Markup Language (HTML) codes only.
Usually, upon typing the URL in the browser, we easily see the webpage that we
wish to view. However, behind that, a lot of processes occur before we are able
to view the page. When a URL, also called a domain name, is typed in the
browser, the domain name is analyzed in the Domain Name System. The Domain
Name System (DNS) handles all the public IP addresses and the corresponding
domain names of each and every website available in the web. When the DNS
finds the corresponding IP address, it returns the value to the browser and the
browser directs a request to the web server with the IP address. The web server
processes the request then sends the requested page back to the browser in HTML
format. Finally, the received page is then displayed to the user.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 38/98
3.6 Human Lungs
Figure 3.13 Anatomy of the human lungs
The lungs are responsible for breathing. It is a machine in our body that supplies
oxygen to the blood that transports it to all of the cells of the body for sustaining the
processes each of them are performing. It moves out CO2 out of the lungs, which is the
byproduct of the metabolic process performed by the cells. The lungs under normal
conditions of rest normally breathe in 500ml of air per inhalation. On the average, a
person takes 12 breathes per minute. This translates to 6L/min during one breathing
cycle.
3.7 Peak Expiratory Flow
Peak Expiratory Flow or PEF is defined as the maximum forced expiration made
after maximal lung inhalation. It should be performed without hesitation to achieve the
best possible maneuver. The patient should be at rest. The test is usually performed
sitting upright or standing up straight. Either way the patient should be as relaxed as
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 39/98
possible to be able to perform his best exhalation through the PEF device. It is expressed
in terms of volumetric flow rate (Liters/min). PEF is ideally recorded by a device that
determines flow rate. It is a lung function exam usually taken at home to monitor the
patient’s response to medication and lung condition.
3.7.1 Test Procedure
The accuracy of the test is entirely dependent on the patient’s
understanding of the procedure. After full lung inhalation, the subject must
be able to blow out without any delay or obstruction to the PEF device.
Variables such as improper lip fitting, incorrect posture, and hesitation can
render the test null and therefore should be repeated again. Hesitating for a
moment, even for as little as 2 seconds, or flexing the neck may affect the
results. Tonguing, spitting or coughing at the start of expiration can falsely
raise the value of the PEF. It is important that the subject is briefed
accordingly as to the conditions of peak flow measurements. Before home
use, the doctor shall instruct and patient regarding the proper measures
taken before the test. Commonly, the PEF test is repeated 3 times during a
trial. The acceptable values are noted during tests and the highest value is
recorded on the PEF monitoring sheet provided by the doctor. The patient
writes down the time and day that they took the test. They chart also
contains zones. These zones are namely green, yellow and red. These
zones indicate the performance of the patient’s tests, usually based on the
best reading. Green is 100%-80% of the best reading. Yellow is 80%-50%
of the best reading. And lastly, red is 50% or below of the best reading.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 40/98
3.7.2 Peak Flow Meter Device
Figure 3.14 Mechanical Peak Flow Meter Device
The typical peak flow meter device is a mechanical device that has
a spring or a thin metal plate that pushes the cursor as it receives the air
coming from the patient’s lungs. This cursor moves along the graduations.
On the average, these devices measure from 50 to 700 L/min. PEF devices
can be used at the doctor’s office or at home depending on the treatment
plan prescribed by the doctor. In most cases, is device is used at home for
lung condition monitoring. It comes with a PEF test chart that is used to
record the value, time and date of each PEF test. This chart is then brought
back to the doctor to be reviewed.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 41/98
Chapter 4
Design Considerations
4.1 General System Block Diagram
The figure below is the general system block diagram:
Figure 4.1 General Block Diagram of the System
This figure gives a description of the whole system, including the different
components it contains. The Peak Flow Meter System includes a flow sensing circuit that
is responsible for obtaining the Peak Expiratory Flow. The data is processed to the MCU
and it performs the necessary operations that translate the signal coming from the sensor
into a digital output that can be displayed to the LCD. The Bluetooth module is
responsible for sending the data to the computer. In the computer, a GUI handles the data
coming from the Bluetooth module. Two key GUIs would be needed for the whole
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 42/98
system; one would be the GUI for the computer receiving the data directly from the
device and the other for the computer handling the server. The third part would be the
Website. The website allows the doctor to view the test results obtained by the device
remotely. The website obtains the data from the server.
4.2 Flow Measurement
Here is the block diagram of the Flow Sensing Block:
Figure 4.2 Block Diagram of the Flow Measurement Block
4.2.1Differential Pressure Sensor
Pressure Sensor Schematic Diagram and Board Design:
Figure 4.3 Sensor Circuit for MP3V5004DP
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 43/98
For our pressure sensor, the group used the MP3V5004DP Differential
pressure sensor. It has a pressure rating of 3.9KPa and has an output of 0.6 to 3V.
The output voltage of the sensor responds to variations in pressure difference
introduced in it. It has a wide range of applications, moslty revolving around
microcontroller and microprocessor based systems since its output pin can be
directly coupled to the ADC input of the MCU. The sensor also has compensation
for temperature variations within it operating temperature (0 to 85 degrees
celsius) . This is important since changes in temperature is directly proportional to
the pressure introduced to the sensor. For minimizing the effects of noise in the
silicon pressure sensor, an effective general approach would be a low pass filter.
The low pass filter with a cutoff frequency of 650 Hz is recommended for the
system. A 470 pF ceramic capacitor have been determined to give the best results
since it provides a decent output to the ADC of the microcontroller. From the
noise point of view, adequate decoupling is also important. A 1.0 mF ceramic
capacitor in parallel with a 0.01 mF ceramic capacitor works well for this
purpose. Also, with respect to noise, it is preferable to use a linear regulator rather
than a relatively noisier dc regulated power supply 5 volt output.
Figure 4.4 Differential Pressure Sensor PCB (MP3V5004DP)
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 44/98
4.2.2 Venturi Tube
In the group’s thesis, the concept of differential pressure measurement was
used. This was chosen since it provides higher accuracy as compared to other
flow measurement techniques. This is done by measuring the pressure difference
across a tube that in which fluids flow in. This method employs different types of
tubes as discussed in the previous chapter.
Considering the application however, the proponents used Venturi Tube.
This device is a hollow tube that is wider at the ends then gradually constricts in
the middle. As the fluid flows inside the tube, it would gain velocity as the cross
sectional area of the tube decreases as it reaches the middle. An increase in the
velocity is accompanied by a change in pressure. This pressure difference
translates into volumetric flow rate through the use of Bernoulli’s equation. The
group used a Venturi Tube since it has has no mechanical or movable parts inside.
This would make the cleaning of the device to be easier as compared to the other
flow tubes. It also offers minimum head loss, as compared to other flow tubes
using differential pressure flow measurement. Also, they can be very accurate. A
well calibrated tube can measure with high accuracy, having readings within
5%.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 45/98
Figure 4.5 Venturi Tube of the Prototype
The dimensions of the device are given below:
D1 (initial Diameter) = 27mm
D2 (throat Diameter) = 13.5mm
The opening of the tube was chosen to conform to standard peak flow
meter mouth pieces. The throat diameter of the device, which is 13.5mm, was
used to follow the specifications of a Venturi Tube. The common ratio of the
throat diameter and Inner diameter is given below:
The converging and diverging angles of the device are 21º and 15 º
respectively. These are optimal values for the said sections since they make the
device less expensive by making the tube generally shorter. Solving for the
constant to be used in the programming of the Microcontroller, we have to use the
equation in the previous chapter regarding volumetric flow rate and substitute the
dimensions of the device.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 46/98
Recall that,
And,
We now substitute the values which are 27mm and 13.5mm, representing the D1,
and D2 respectively. In order to get the constant for the program of the MCU,
assume a pressure difference of 1PA (P1-P2 = 1) and substitute:
Equation. 4.1
To solve for Q1 (Volumetric Flow Rate) (Eq.3. 3)
Converting to L/min
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 47/98
x 0.97 (Cd)
A dispersion coefficient Cd is assumed to be .97 for smaller tubes as
provided for Venturi tube specifications.
Finally we get,
For a pressure difference of 1Pa, the group obtained a value
of .
Equation 4.2
By relating the constant derived from equation 4.2, which is 10.77592772,
to the voltage level per pressure difference of the sensor, we can now output the
value of the volumetric flow rate. Using the equation from the sensor’s datasheet,
we can determine the corresponding pressure difference per voltage output. Let P
be the pressure difference,
Equation 4.3
But
Equation 4.4
Simplifying 4.3 we get
Equation 4.5
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 48/98
Isolating P we get,
Equation 4.6
Equation 4.7
Dividing both sides by 0.2 to isolate P we get,
Equation 4.8
By using the value of P, solved from determining the flow sensing
circuit’s Vout and Vs, the value of Q can now be outputted.
4.3 Microcontroller Unit
The microcontroller unit (MCU) serves as the intelligence of the whole system. It
processes all inputs and produce corresponding outputs according to the specification
made by the user, which is the program burned to the microcontroller. Selection of proper
microcontroller is imperative for the success of the system. Several factors must be
considered such price, availability, manufacturer support, development tools and
specifications. It is a must to be able to determine the needs of the system before
selecting a microcontroller. For the system, the group selected to PIC16F877a
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 49/98
Microcontroller because its features fits the system. The pin diagram of PIC16F877a is
show in the figure below.
Figure 4.6 Microcontroller Pin Diagram from Datasheet
4.3.1 PIC16F877a Specifications
It is important to understand the specifications of PIC16F877a to be able
to see if it fits perfectly to the system. Coming from the datasheet, PIC16F877a
has the following specifications that can be used for the system: 8K x 14 words of
Flash Program memory, 368 x 8 bytes of Data Memory (RAM), Synchronous
Serial Port (SSP) with SPI™ (Master Mode) and I2C™ (Master/Slave), Universal
Synchronous Asynchronous Receiver Transmitter with 9-bit address detection,
and up to 8-bit Analog to Digital converter (ADC).
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 50/98
4.3.1.1 Universal Synchronous Asynchronous
Receiver Transmitter
PIC16F877a has two serial I/O modules, one of which is the
USART module. The USART module of PIC16F877a can be configured
as a full-duplex asynchronous system or as a half-duplex synchronous
system that can communicate with peripheral devices such as a personal
computer.
4.3.1.2 Analog to Digital Converter
PIC16F877a analog to digital conversion results in a corresponding
10-bit digital number and has the ability to be able to operate even when
the device is in sleep mode. The A/D converter is very critical as it will
convert the pressure reading, in terms of analog voltage, of the sensor and
then it will proceed to different arithmetic process in order to compute for
the correct value.
4.3.2 Microcontroller Algorithm
For the system to run properly, a proper algorithm must be implemented.
The flowchart below summarizes the algorithm that can be implemented to the
microcontroller in order process and compute for the parameters needed by the
system. One of the advantages of using PIC16F877a, which is manufactured by
Microchip Technology Inc., is the abundance of compilers and different
programming languages available that can be used in order to program it. For the
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 51/98
system, the group incorporated the program in the C language and used MikroC
as the compiler. Below is a summary of different commands that can be used for
the system that can be found in the help of MikroC.
Command Name Type Description
Lcd_Init Void
Initializes LCD to a specific port with default
pin settings
Lcd_Cmd Void
Sends command to LCD. Predefined LCD
commands can be found in the MikroC Help.
Usart_Init Void
Initializes USART module with the desired
baud rate.
Usart_Write Void Sends a data byte via USART module
Usart_Data_Ready Unsigned short
A function used to test if data in the receive
buffer is ready for reading.
Adc_Read Unsigned
Initializes PIC’s internal Analog to Digital
Converter module to work with RC clock.
Table 4.1 Key commands for the MCU algorithm
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 52/98
Figure 4.7 Microcontroller Flow Process Chart
YES
NO
START
Blow in the tube
Compute for the flow
rate and initialize
variables
NO
YES
Is the flowrate greater
than
previous
Display result in LCD
and initialize Bluetooth
Is
Bluetooth
module
ready?
Send Data to PC via
Bluetooth
END
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 53/98
4.3.3 Microcontroller Interfacing
4.3.3.1 LCD
The device used a 2x16 SC162A3 LCD. Since the group is using
PIC16F877A, the group has adapted the schematic diagram for LCD
configuration as provided by MikroC, which serves as the compiler of the
MCU. The LCD will be used to display the results, informing the user of
his Peak Expiratory Flow. From the schematic diagram we made a board
design.
Figure 4.8 MikroC LCD interfacing configuration,
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 54/98
Figure 4.9 LCD Schematic diagram
Figure 4.10 Microcontroller PCB with LCD
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 55/98
4.3.3.2 Bluetooth
The system involves the transmission of data wirelessly through
Bluetooth technology. The group decided to use the EGBT 9830
Bluetooth module due to its availability. The Bluetooth module allows the
microcontroller unit to send the data obtained from the test wirelessly
using the Bluetooth Serial Port Profile (SPP) and be connected directly to
the Universal Synchronous/Asynchronous Receiver/Transmitter (USART)
port of a microcontroller. The product manual provided by the supplier has
given the group the basic design and pin configuration to interface the
module to the MCU. The interfacing of the EGBT 9830 module to the
microcontroller unit is shown below:
Figure 4.11 EGBT
9830
Figure 4.12 Bluetooth Module PCB
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 56/98
4.3.3.2.1 Bluetooth Initialization
The module is initialized by default at baud rate of 9600, 8
data bit, 1 stop bit and no parity. In order to use the Bluetooth
module, the device must be initialized with correct Bluetooth
address by sending 13 bytes to the module before it becomes
operational. The sequence of the bytes is as follows:
02 52 27 06 00 7F XX XX XX XX XX XX 03
The six “XX” bytes represent the address that you will
assign to the module. After initializing a valid Bluetooth address,
the Bluetooth core of the module needs to be activated to be able
for the module be operational. The following 7 bytes must be sent:
02 52 66 00 00 B8 03
All the bytes are sent by the microcontroller after it has
been physically connected and powered up. The flowchart below
summarizes the whole design in order to use the module.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 57/98
Figure 4.13 Bluetooth Flow Process Chart
NO
YES
NO
YES
START
Initialize
Bluetooth
Address: Send
13 bytes
Is the
address
valid?
Start Bluetooth
Core: Send 7
bytes
Is the
core
ready?
END
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 58/98
4.4 Graphic User Interface
The Graphical User Interface (GUI) shall be constructed using Microsoft Visual
Studio C# Language. C# Language was used in this thesis to take advantage of its
networking capabilities along with its ability to use both Microsoft C++ programming
and Visual Basic. The data from the device is sent to the GUI (called the Chat Client) and
the GUI shall act as a path in which data could be sent to the server over Internet through
TCP/IP. The server computer is another GUI (called the Chat Server) that monitors for
connections and online users. The server acts as a storage for the database of all the
patients and doctor. The layout and design of the 2 GUIs are shown below:
Figure 4.14 Patient Login Interface
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 59/98
Figure 4.15 Patient Sample Data Interface
Figure 4.16 Chat Server Interface
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 60/98
Figure 4.17 Chat Server Interface detects a client to be online
Figure 4.18 Chat Server Interface detects a client has logout.
4.4.1 Chat Client
Field Name/Method Name Type Description
InitializeConnection VoidInitialize parameters to enable the user to
connect to the server
CloseConnection Void
Disconnects the thread connection of the
user from the server.
ReceiveMessages Void
Called for every time a new message is
received from the thread.
SetsUpdate Void
Updates the set number if changes occur
in the database.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 61/98
FillData VoidFills a table with PEF values that serves
as the data source for plotting.
Registration VoidA method called to inform user that
registration was unsuccessful.
Complete Void
A method called to inform user that
registration was successful.
UpdateLog Void
Called when the status textbox needs to
be updated with new message.
PatientData VoidCalled to enable user interface when
login is successful.
RegistrationDetails Void
Called to fill the combo box with
registered doctors’ names in the database.
Append Void
Called to append username and password
to be sent to the server for checking.
AppendRegister Void
Called to append registration details to be
added to the server database
InitializeLog VoidInitializes sending of username and
password to the server to check validity.
CloseLog Void
Disconnects the user from the server and
disables patient interface.
WrongData Void
Called when the input username or
password is not valid.
PEFData VoidSets the value of the label box equal to
the obtained PEF value.
Table 4.2 Variables and methods used in the lines of codes of the Chat Client
4.4.2 Chat Server
Field Name/Method Name Type Description
StatusChangedEventArgs ClassHandles the method that updates the server
text box when changes occur.
ChatServer Class
Class that handles the methods for database
manipulation.
AddUser Void
Adds a user to the database when
registration requirements are met.
AddUsertoDoctorsComment VoidAdds the username of the user to the Doctors
Comments database.
AddUsertoPEFData Void
Adds the username of the user to the
PEFData database.
RetrievedataUser String
Retrieves the data of the user when login is
successful.
RetrieveComment StringRetrieves the comments of the doctor for the
specific user.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 62/98
RetrievePEF StringRetrieves the PEF values of the user for the
specific set number.
RetrieveDoctors StringRetrieves the names of the doctors registered
in the database.
RetrieveSets String
Retrieves the number of set as listed in the
database for the specific user
UpdatePEF String
Updates the PEF data of the patient when
new value is received by the server
OnStatusChanged VoidMethod that changes the status text box of
the server when changes occur.
StartListening Void
Method that opens a thread to listen for
connection requests.
KeepListening Void
Method that continuously allows the server
to listen for connection.
Connection Class
Class which handles the method that
receives the requests
Connection VoidMethod which opens a thread for each
requesting user
CloseConnection Void
Closes the thread, stream sender and stream
receiver when the user disconnects.
AcceptClient Void
Method which handles all received messages
from the user.
Table 4.3 Variables and methods used in the lines of codes of the Chat Server
4.4.3 Database
Database Description
PatientData
Database which stores the
personal information of each
patient registered.
PEFDataDatabase which stores the
PEF values of each specific
patient.
DoctorsComments
Database which stores
comments made by the
doctor over the website.
Table 4.4 Database used in the Chat Server code
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 63/98
Figure 4.19 Flow Process Chart of the GUI
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 64/98
4.5 Website
Figure 4.20 General Process Flow of the Website
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 65/98
The website is constructed using ASP.NET programming. Unlike the previous
generation called ASP, ASP.NET allows call functions which lessens the usual tedious
programming. Moreover, ASP.NET supports dynamic and interactive communication
with the server. Since the thesis has login functions and data retrieval, it needs to be
constructed dynamically. SQL statements are again used to retrieve the data from the
database. The server used for the website’s server is the same server used by the patients
to allow consistency with the data. This website shall only be accessible within a Local
Area Network. Shown below is the simplified structure of the system.
Figure 4.21 Structure of the System
Field Name/Method Name Type Description
DoctorsName String Retrieves the doctor’s information in theDoctorsData database.
Login Void
Retrieves the information of those patients
registered to the user
User StringRetrieves the username of the patients
registered to the doctor
View Void
Retrieves the information of the selected
patient and displays the plot menu.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 66/98
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 67/98
Figure 4.22 Voltage Regulator PCB
Figure 4.23 Voltage Regulator
Board Schematic Diagram
4.6.2 Battery
The device is supplied by an 8.6V 2100mAh battery. It is to supply the
Microcontroller, Differential Pressure Sensor, and Bluetooth Module that requires
5V, 3.3V and another 3.3V respectively. When these components are connected
together, they draw 210mA of current. With the current rating of the battery, it
can power up the prototype sufficiently.
Figure 4.24 8.6V 2100mAh Battery
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 68/98
Chapter 5
Data and Results
5.1 System Testing
In the testing setup, the device was tested both in patients and in controlled
air. There are 4 patients with 20 tests each. In testing the device using controlled air,
the group used 4 different pressure readings. The transmission accuracy was likewise
tested by sending 90 varying data points in the Chat Client. Lastly, the theoretical
Bluetooth range for class 2 radios was likewise tested in order to find out the
maximum range at which the device is capable of transmitting data to the computer.
The following tests were done to meet the objectives of this thesis.
Figure 5.1 Mechanical Peak Flow Meter Figure 5.2 Digital Peak Flow Meter
5.1.1 Peak Flow Meter Device (Patient Testing)
5.1.1.1 Objectives
5.1.1.1.1 To use a flow sensing circuit to determine lung air flow.
5.1.1.1.2 To display the test result through the LCD.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 69/98
5.1.1.1.3 To build the device with an accuracy of 90% as compared
to a Mechanical Peak Flow Meter.
5.1.1.2 Materials
5.1.1.2.1 Digital Peak Flow Meter Device
5.1.1.2.2 Mechanical Peak Flow Meter
5.1.1.3 Procedures
1. Turn on the power supply for the Digital Peak Flow Meter Device.
2. Latch the first push button to turn on the microcontroller.
3. Have the patient hold the Venturi Tube at a horizontal position
perpendicular to him/her.
4. Have the patient stand firm or sit upright and inhale at his/her
maximum breathing capacity.
5. Have the patient empty out the air in his/her lungs in the Venturi
Tube.
6. Record the resulting flow rate as seen in the LCD.
7. Repeat steps 3-6 using the Mechanical Peak Flow Meter.
8. Repeat the procedures to 4 patients.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 70/98
5.1.1.4 Data and Results
Figure 5.3 LCD with PEF Result
Figure 5.4 Flow Sensing Circuit
5.1.1.4.1 Patient 1
Trial Flow Rate
(Mechanical) L/min
Flow Rate
(Digital) L/min
%difference Accuracy
1 600 608 1.33333333 98.66667
2 370 358 3.243243243 96.75676
3 690 717 3.913043478 96.08696
4640 677 5.78125
94.218755 670 621 7.313432836 92.68657
6 680 694 2.058823529 97.94118
7 660 656 0.606060606 99.39394
8 690 748 8.405797101 91.5942
9 550 578 5.0909090901 94.90909
10 690 694 0.579710145 99.42029
11 630 662 5.079365079 94.92063
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 71/98
12 650 652 0.307692308 99.69231
13 630 623 1.111111111 98.88889
14 670 728 8.656716418 91.34328
15 690 753 9.130434783 90.86957
16 620 675.8 9 91
17 660 720 9.090909091 90.9090918 650 703 8.153846154 91.84615
19 690 755 9.420289855 90.57971
20 670 690 2.985074627 97.01493
Table 5.1 PEF Results for Patient 1
5.1.1.4.2 Patient 2
Trial Flow Rate
(Mechanical) L/min
Flow Rate
(Digital) L/min
%difference Accuracy
1 550 588 6.909090909 93.090912 650 612.19 5.816923077 94.18308
3 570 563 1.228070175 98.77193
4 510 503 1.37254902 98.62745
5 520 524.45 0.855769231 99.14423
6 450 485 7.777777778 92.22222
7 640 605 5.46875 94.53125
8 610 605 0.819672131 99.18033
9 430 402 6.511627907 93.48837
10 610 671 10 90
11 620 653 5.322580645 94.67742
12 690 727 5.362318841 94.63768
13 490 523.9 6.918367347 93.08163
14 510 469.7 7.901960784 92.09804
15 550 580 5.454545455 94.54545
16 530 554 4.528301887 95.4717
17 520 497 4.423076923 95.57692
18 570 601 5.438596491 94.5614
19 690 755 1.951219512 98.04878
20 540 563 4.259259259 95.74074
Table 5.2 PEF Results for Patient 2
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 72/98
5.1.1.4.3 Patient 3
Trial Flow Rate
(Mechanical) L/min
Flow Rate
(Digital) L/min
%difference Accuracy
1 400 396.23 0.9425 99.0575
2 370 403 8.918918919 91.081083 370 341 7.837837838 92.16216
4 490 537 9.591836735 90.40816
5 410 433 5.609756098 94.39024
6 370 402 8.648648649 91.35135
7 390 394 1.025641026 98.97436
8 386 370 4.14507772 95.85492
9 440 400 9.090909091 90.90909
10 440 423 3.863636364 96.13636
11 360 380 5.555555556 94.44444
12 380 412 8.421052632 91.57895
13 360 328 8.888888889 91.11111
14 460 502 9.130434783 90.86957
15 440 423 3.863636364 96.13636
16 410 444 8.292682927 91.70732
17 390 417 6.923076923 93.07692
18 360 385 6.944444444 93.05556
19 370 383 3.513513514 96.48646
20 390 424 8.7179 91.28205
Table 5.3 PEF Results for Patient 3
5.1.1.4.4 Patient 4
Trial Flow Rate
(Mechanical) L/min
Flow Rate
(Digital) L/min
%difference Accuracy
1 650 607 6.615384615 93.38462
2 700 768 9.714285714 90.28571
3 650 633 2.615384615 97.38462
4 670 676 0.895522388 99.10448
5 640 601 6.09375 93.90625
6 630 626 0.634920635 99.36508
7 650 682 4.923076923 95.076928 660 689 4.393939394 95.60606
9 690 758 9.855072464 90.14493
10 680 702 3.235294118 96.76471
11 680 721 6.029411765 93.97059
12 670 657 1.940298507 98.0597
13 690 667 3.333333333 96.66667
14 690 754 9.275362319 90.72464
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 73/98
15 680 644 5.294117646 94.70588
16 670 697 4.029850746 95.97015
17 690 747 8.260869565 91.73913
18 660 644 2.424242424 97.57576
19 670 720 7.462686567 92.53731
20 660 636 3.636363636 96.36364Table 5.4 PEF Results for Patient 4
5.1.2 Peak Flow Meter Device (Controlled Air Testing)
5.1.2.1 Objectives
5.1.2.1.1 To test the Peak Flow Meter Device using controlled air.
5.1.2.1.2 To determine the accuracy of the device under controlled air
condition.
5.1.2.2 Materials
5.1.2.2.1 Digital Peak Flow Meter
5.1.2.2.2 Mechanical Peak Flow Meter
5.1.2.3 Procedures
1. Turn on the power supply for the Digital Peak Flow Meter Device.
2. Latch the first push button to turn on the microcontroller.
3. Set the value of the pressurize container to an initial value.
4. Place the nozzle at the center of the Venturi Tube’s entrance.
5. Record the flow rate as shown in the LCD.
6. Repeat steps 3-5 using the Mechanical Peak Flow Meter.
7. Repeat the procedures to 4 different pressures.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 74/98
5.1.2.4 Data and Results
5.1.2.4.1 Pressure of 10 psi
Trial Flow Rate (Mechanical) L/min Flow Rate (Digital) L/min
1 185 1862 200 195
3 190 201.92
4 195 157.706
5 190 186.16
6 185 172.52
7 190 192.62
8 190 165.27
9 185 168.94
10 190 157
11 190 182.85
12 185 172.52
13 200 172.52
14 185 172.52
15 200 157.7
16 200 198.87
17 200 176.03
18 190 179.47
19 200 168.94
20 200 186.16
Average 192.5 177.5358
Table 5.5 PEF Results for Pressure of 10 psi
%22639.92%7736104.7%100%%100
%7736104.71005.192
5358.1775.192100%
difference Accuracy
l Theoretica
al Experiment l Theoreticadifference
5.1.2.4.2 Pressure of 20 psi
Trial Flow Rate (Mechanical) L/min Flow Rate (Digital) L/min1 350 343
2 340 375
3 350 343
4 340 408
5 330 377
6 345 383
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 75/98
7 345 383
8 340 388
9 330 323
10 340 360
11 360 336
12 320 37713 350 326
14 350 358
15 350 365
16 350 367
17 340 323
18 355 382
19 345 350
20 335 365
Average 343.25 361.6
Table 5.6 PEF Results for Pressure of 20 psi.
%65404.94%345957757.5%100%%100
%345957757.510035.343
6.36135.343100%
difference Accuracy
l Theoretica
al Experiment l Theoreticadifference
5.1.2.4.3 Pressure of 30 psi
Trial Flow Rate (Mechanical) L/min Flow Rate (Digital) L/min1 400 415
2 450 397
3 430 365
4 460 373
5 430 396
6 430 367
7 410 455
8 450 417
9 440 430
10 400 415
11 440 40012 400 425
13 460 385
14 440 445
15 470 408
16 450 440
17 440 380
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 76/98
18 460 412
19 500 425
20 470 409
Average 441.5 407.95
Table 5.7 PEF Results for Pressure of 30 psi
%04784.98%952161.1%100%%100
%952161.1100509
0635.499509100%
difference Accuracy
l Theoretica
al Experiment l Theoreticadifference
5.1.2.4.4 Pressure of 40 psi
Trial Flow Rate (Mechanical) L/min Flow Rate (Digital) L/min
1 500 461.82
2 550 457.833 530 464.46
4 530 513.26
5 540 522.71
6 500 485.08
7 550 513.26
8 450 504.85
9 460 512.07
10 540 492.59
11 550 445.64
12 520 502.4213 500 474.88
14 440 503.64
15 500 492.59
16 570 530.84
17 450 569.75
18 460 481.28
19 490 534.29
20 550 518.01
Average 509 499.0635
Table 5.8 PEF Results for Pressure of 40 psi.
%40091.92%599093998.7%100%%100
%599093998.71005.441
95.4075.441100%
difference Accuracy
l Theoretica
al Experiment l Theoreticadifference
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 77/98
5.1.3 GUI and Website
5.1.3.1 Objectives
5.1.3.1.1 To program the microcontroller to output flow rate and send
the data to a computer by adapting Bluetooth technology.
5.1.3.1.2 To use a Graphical User Interface (GUI) that would display the
data sent to the computer.
5.1.3.1.3 To develop a website that can be accessed by a doctor to view
the data obtained by the system.
5.1.3.2 Materials
5.1.3.2.1 Laptop
5.1.3.2.2 Bluetooth
5.1.3.2.3 Chat Client
5.1.3.2.4 Chat Server
5.1.3.2.5 Router
5.1.3.3 Procedures
5.1.3.3.1 Graphical User Interface (GUI)
1. Input the IP Address of the web server to connect to.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 78/98
Figure5.5 GUI: Inputting Server IP
2. Input the registered username and password of the user.
Figure 5.6 GUI: Inputting Username Password
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 79/98
3. If the user is not yet registered, he/she could register by clicking
the register button.
Figure 5.7. GUI: Register Interface
4. Use the control buttons to view the desired operation of the
interface.
Figure 5.8 GUI: Control Buttons
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 80/98
5. Follow the following procedures for reading of data.
a. Establish the connection with the Bluetooth.
Figure 5.9 Icon to connect to Bluetooth Serial Port Function
Figure 5.10 Bluetooth Establishing Serial Port Connection
b. Click the Read Value Details and set it the same as the
value of the Bluetooth’s COM Port.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 81/98
Figure 5.11 GUI: Setting Bluetooth COM Port
c. Make sure that the patient has already taken the test
before clicking the Read button.
d. Wait for at least 5 seconds after the test before clicking
the Read button.
e. Click the Update button to add the data in the user’s
database.
6. Logout the account after use to avoid wrong data from being
stored in the user’s database.
5.1.3.3.2 Website
1. Join the network of the web server.
2. Access the web server by typing http://(webserverIP) or
http://(webserverName) in the browser.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 82/98
Figure 5.12 Website: Inputting Web Server Name
3. Input the registered username and password of the doctor.
Figure 5.13 Website: Inputting Username and Password
4. Choose the name of the desired patient information to view.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 83/98
Figure 5.14 Website: Choosing which Patient Information to view
5. Choose the desired points to plot.
Figure 5.15 Website: Plotting of Data
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 84/98
6. Leaving of comment is optional.
Figure 5.16 Website: Leaving of Doctor’s Comment
7. The Zones are only available for plots with 90 data points.
Figure 5.17 Website: Viewing Zones
8. Logout the account to ensure security.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 85/98
5.1.3.4 Data and Results
Figure 5.18. Digital Peak Flow Meter Bluetooth System
Figure 5.19. Intelligence Board of the System.
5.1.3.4.1 Graphical User Interface (Accuracy of Reading)
Trial Device
Reading
Login
Successful
Received
Data
Data
Plotted
Data
Updated
1 364.052 Yes 364.05 Yes Yes
2 383.6865 Yes 383.6865 Yes Yes
3 295.408 Yes 295.40 Yes Yes
4 276.4126 Yes 276.1426 Yes Yes
5 448.3833 Yes 448.3833 Yes Yes6 533.1442 Yes 533.1442 Yes Yes
7 528.5347 Yes 528.53 Yes Yes
8 471.0057 Yes 471.0057 Yes Yes
9 493.8306 Yes 493.8306 Yes Yes
10 332.4328 Yes 332.4328 Yes Yes
11 508.4783 Yes 508.4783 Yes Yes
12 514.4583 Yes 514.4583 Yes Yes
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 86/98
13 543.3727 Yes 543.3727 Yes Yes
14 295.408 Yes 295.408 Yes Yes
15 442.8924 Yes 442.8924 Yes Yes
16 291.237 Yes 291.237 Yes Yes
17 332.4328 Yes 332.4328 Yes Yes
18 427.429 Yes 427.429 Yes Yes19 324.9888 Yes 324.9888 Yes Yes
20 451.1036 Yes 451.1036 Yes Yes
21 375.6302 Yes 375.6302 Yes Yes
22 313.4196 Yes 313.4 Yes Yes
23 539.9847 Yes 539.9847 Yes Yes
24 264.8348 Yes 264.8348 Yes Yes
25 291.237 Yes 291.237 Yes Yes
26 269.4149 Yes 269.4149 Yes Yes
27 490.1002 Yes 490.1002 Yes Yes
28 403.8815 Yes 403.8815 Yes Yes29 562.1856 Yes 562.18 Yes Yes
30 295.408 Yes 295.408 Yes Yes
31 440.1213 Yes 440.1 Yes Yes
32 337.9082 Yes 337.9082 Yes Yes
33 417.2906 Yes 417.2906 Yes Yes
34 317.3703 Yes 317.3103 Yes Yes
35 402.364 Yes 402.3 Yes Yes
36 440.1213 Yes 440.1213 Yes Yes
37 415.822 Yes 415.822 Yes Yes
38 435.9316 Yes 435.9316 Yes Yes
39 343.2963 Yes 343.2963 Yes Yes40 391.5772 Yes 391.5 Yes Yes
41 408.4001 Yes 408.4 Yes Yes
42 405.3934 Yes 405.3934 Yes Yes
43 373.9981 Yes 373.9981 Yes Yes
44 409.8953 Yes 409.89 Yes Yes
45 467.0931 Yes 467.09 Yes Yes
46 482.5531 Yes 482.55 Yes Yes
47 369.0586 Yes 369.0 Yes Yes
48 276.1426 Yes 276.1426 Yes Yes
49 255.4283 Yes 255 Yes Yes50 299.5209 Yes 299.5209 Yes Yes
51 350.3515 Yes 350.3515 Yes Yes
52 428.8579 Yes 428.8579 Yes Yes
53 502.427 Yes 502.427 Yes Yes
54 352.0932 Yes 352.0932 Yes Yes
55 370.7124 Yes 370.7 Yes Yes
56 474.886 Yes 474.886 Yes Yes
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 87/98
57 492.592 Yes 492.5 Yes Yes
58 544.4978 Yes 544.4 Yes Yes
59 350.3515 Yes 350.35 Yes Yes
60 456.4956 Yes 456.495 Yes Yes
61 449.74 Yes 449.74 Yes Yes
62 456.4956 Yes 456.4956 Yes Yes63 527.376 Yes 527.376 Yes Yes
64 552.3057 Yes 552.3057 Yes Yes
65 481.2837 Yes 481.2837 Yes Yes
66 552.3057 Yes 552.3057 Yes Yes
67 386.8621 Yes 386.8621 Yes Yes
68 418.754 Yes 418.754 Yes Yes
69 438.7292 Yes 438.7292 Yes Yes
70 460.4983 Yes 460.498 Yes Yes
71 764.9926 Yes 764.992 Yes Yes
72 346.841 Yes 346.841 Yes Yes73 409.8953 Yes 409.8953 Yes Yes
74 415.822 Yes 415.822 Yes Yes
75 534.2904 Yes 534.2904 Yes Yes
76 601.0995 Yes 601.099 Yes Yes
77 534.2904 Yes 534.290 Yes Yes
78 468.401 Yes 468.401 Yes Yes
79 529.6908 Yes 529.6908 Yes Yes
80 468.401 Yes 468.401 Yes Yes
81 607.1749 Yes 607.1749 Yes Yes
82 305.5866 Yes 305.5866 Yes Yes
83 452.4576 Yes 452.45 Yes Yes84 522.7157 Yes 522.715 Yes Yes
85 341.5097 Yes 341.5097 Yes Yes
86 478.7349 Yes 478.7349 Yes Yes
87 543.3727 Yes 543.37 Yes Yes
88 341.5097 Yes 341.5097 Yes Yes
89 390.0118 Yes 390.0118 Yes Yes
90 447.0169 Yes 447.016 Yes Yes
Table 5.9 GUI: Accuracy of Reading
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 88/98
Figure 5.20. Website resulting graph after 25 tests
Figure 5.21 GUI resulting Graph after 25 tests
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 89/98
Figure 5.22 Website resulting graph after 50 tests.
Figure 5.23. GUI resulting graph after 50 tests
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 90/98
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 91/98
Figure 5.26. Website resulting Zones after 90 tests
Figure 5.27. GUI resulting Zones after 90 tests
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 92/98
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 93/98
5.1.4.3 Procedures
1. Using the footsteps method, count how many steps are covered for a
certain distance (e.g. 6 steps/ 3 meters). Perform the method for at
least 3 times then take the average. Use this as a reference to measure
distance when performing the test.
2. Power up the Peak Flow Meter Device.
3. Run the Bluetooth application in the Laptop.
4. See if the Bluetooth icon for the Peak Flow Meter Device is shown in
the screen as devices available within the area.
Figure 5.28 Digital Peak Flow Meter Bluetooth Icon
5. If the device is visible, check whether transmission is possible then
increase the distance between the Laptop and the device by a meter
and reset the Bluetooth. Otherwise, stop the test.
6. Repeat Steps 2-5.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 94/98
5.1.4.4 Data and Results
5.1.4.4.1 Footstep Method
Trial Number of Steps
1 62 7
3 6
Average 6.33333 ≈ 6
Table 5.11 Average number of steps for every 3 meters
5.1.4.4.1.1 Length of the measuring tape = 3 meters
5.1.4.4.1.2 Steps covered within the length of the measuring tape = 6
5.1.4.4.1.3 meter stepsmeters
stepsmeter Steps /2
3
6/
5.1.4.4.2 Bluetooth Visibility
5.1.4.4.2.1 Theoretical Bluetooth Range for Class 2 radios = 10 meters
Table 5.12. Bluetooth Visibility and Transmission Range
Distance (m) Bluetooth Visibility Transmission Successful
1 Yes Yes
2 Yes Yes3 Yes Yes
4 Yes Yes
5 Yes Yes
6 Yes Yes
7 Yes Yes
8 Yes Yes
9 Yes Yes
10 Yes Yes
11 Yes No
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 95/98
CHAPTER 6
Conclusion and Recommendation
6.1 Conclusion
In reference to the data and results obtained from the testing done on the device
and under the given time frame, the system’s performance met the objectives made
during the early stages of the study. The group was able to use a flow sensing circuit that
measures Peak Expiratory Flow or PEF through the use of differential pressure
measurement. The flow measurements made with the venturi tube, together with the
differential pressure sensor, was able to match the mechanical peak flow meter used
commercially with an accuracy of 90%. The device was able to display the results done
during the tests through the LCD. It was also able to transmit the data wirelessly from the
device to the computer by adapting Bluetooth technology.
A critical part with the development of the thesis was the consultations made to
health care professionals regarding the lung function testing procedures and parameters.
Note that the testing of the PEF values was consulted with a doctor to get the results that
would satisfy the objectives of the study. This gave light to the areas of the system that
needed medical expertise, such as the GUI and Website Layout. For the venturi tube,
consultations made to a mechanical engineer proved to be vital since they gave the
proponents knowledge on the theories regarding flow measurement, specifically
differential pressure flow measurement.
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 96/98
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 97/98
References:
[1] Chii-Wann Lin, Di-Ho Wang, Hao-Chien Wang, Huey-Dong W. PROTOTYPE
DEVELOPMENT OF DIGITAL SPIROMETER
[2] K.A.Nagaraja, Nanda.S. Electronic Spirometer for the Assessment of Lung’s
Functionality
[3] Moonie SA, Sterling DA, Figgs L, Castro M.Retrieved in June 17, 2009 from
website: http://www.ncbi.nlm.nih.gov/pubmed/16457681
[4] Martinez FD. Genes, environments, development and asthma: a reappraisal.Retrieved
in June 18, 2009 from website: http://www.ncbi.nlm.nih.gov/pubmed/17197483
[5] Spirometry.Retrieved in June 18, 2009 from website:
http://www.patient.co.uk/showdoc/27000436/
[6] Become an expert in Spirometry. Retrieved in June 18, 2009 from website:
http://www.spirxpert.com/usefulness.htm
[7] College of Physicians and Surgeons in Alberta. Spirometry and Flow Volume
Measurements: Standards and Guidelines
[8] World Health Statistics. World Health Organization
Retrieved in August 26, 2009 from website:
http://library.asti.dost.gov.ph/gsdl/collect/actamedi/index/assoc/HASH01ea.dir/do
c.pdf
8/9/2019 Microcontroller-Based Digital Peak Flow Meter System
http://slidepdf.com/reader/full/microcontroller-based-digital-peak-flow-meter-system 98/98
Retrieved in August 26, 2009 from website:
http://my.clevelandclinic.org/services/surgery/hic_how_to_use_an_incentive_spir
ometer.aspx
[9] M.R. Miller, J. Hankinson, V. Brusasco, F. Burgos, R. Casaburi, A. Coates, R.
Crapo, P. Enright, C.P.M. van der Grinten, P. Gustafsson, R. Jensen, D.C. Johnson,
N. Maclntyre, R. McKay, D. Navajas, O.F. Pedersen, R. Pellegrino, J, Wanger and
G.Viegi. 2005. Standardization of spirometry. April 5, 2005.
[10] K.A. Kim', J.H. Lee', T.S. Lee', E.J. Cha''CKlntemational Co., Ltd.'Dept. of
Biomedical Engineering, Chungbuk National University, Cheongju361-763, Korea
Peak expiratory flow meter capable of spirometric test for asthma monitoring,
[11] R. Carta1, D. Turgis, B. Hermans, P. Jourand, R. Onclin and R. Puers
1K.U.Leuven, ESAT-MICAS Department, Kasteelpark Arenberg 10, B-3001 Leuven,
Belgium A differential Pressure Approach to Spirometry
[12] R. L. Daugherty, J. B. Franzini, E. J. FInnemore. Fluid Mechanics with
Engineering Applications. McGraw-Hill Book Company 1985
[13] (Cooney, Biomedical Engineering Principles, 1976)
WEBSITES:
top related