CHAPTER 1 INTRODUCTION...MPX5010 Chemical sensor CO sensor NO sensor O2 sensor PIC micro...
Transcript of CHAPTER 1 INTRODUCTION...MPX5010 Chemical sensor CO sensor NO sensor O2 sensor PIC micro...
-
1
CHAPTER 1
INTRODUCTION:
ASTHMA is a chronic pulmonary inflammatory disease. Over 300 million
people in a worldwide were affiliated with asthma. Asthma affects the airways,
and is characterized by an increased sensitivity to various stimuli. Subsequent
stimulation may prompt the airways to narrow and induce production of mucus
causing less air to flow into the lungs. Common symptoms of asthma include
wheezing, shortness of breath, and chest tightness. The intensity of an acute
asthma exacerbation, also known as an asthma attack, is unpredictable and has
the potential to be life threatening. While there are medical treatments available
to alleviate asthma symptoms, there is no cure. In 2010, 25.7 million individuals
were estimated to have asthma in the United States. More than 5 million
children have asthma and the prevalence of asthma is greater than 15% for
children living in low-income families in the United States.
The severity of symptoms, triggers, and responsiveness to treatment
medication are often unique to each individual. Thus, a comprehensive
guideline for an asthma action plan recommends focusing on monitoring asthma
symptoms as a goal for asthma therapy. Spirometry, peak expiratory flow
measurement, and a non-invasive marker of airway inflammation known as
fractional exhaled nitric oxide are now used by health care professionals for
diagnosis and monitoring.
A spirometry test is a physiological test normally performed under the
supervision of trained professionals. It measures the volume and flow rate of air
that can be inhaled and exhaled, and is useful in describing the disease state in
the lungs, assessing therapeutic intervention, and/or monitoring for adverse
reactions to medication. At present spirometry is the best way to capture a
complete picture of airflow obstruction and lung function, the machines are
-
2
bulky and generally require supervision to measure our lung parameters by
using this integrated device we can portably measure our lung paramaters.
Using pressure and chemical sensors we are measuring our lung parameters.
The parameters measured in this system are pressure value that is PEF (Peak
expiratory flow), FEV1 (Forced expiratory volume) and NO, CO, O2 rates are
measured using chemical sensors. The output of the sensors are analog. Its
given to PIC 16F877A which has in-built ADC (Analog to Digital Converter)
by software coding. The two outputs are taken from PIC. One of the output is
given to caretaker and doctor via GSM (SIM900A). Another output is displayed
to the patient via LCD. Telemetric capabilities help physicians to track asthma
symptoms and lung function over time, which allow physicians the opportunity
to make appropriate changes in a patient’s medication regimen more quickly.
Figure 1.1.0: Normal and Inflamed air flow obstruction
-
3
CHAPTER 2
PROPOSED WORK:
Figure:2.1.0 Block diagram
2.1 BLOCK DIAGRAM DESCRIPTION:
The asthma patient exhales through the flow chamber. Using the sensoring
circuits placed in the flow chamber, we measure the Peak expiratory flow
rate(PEFR), Forced expiratory volume (FEV1), O2, CO, NO rate from the
exhaled breath of the asthma patient. The sensor outputs are analog which are
digitized using PIC16F877A. The PIC output are send to the doctor and care
taker via GSM(SIM900A) and another output is displayed to the patient via
LCD.
FEEDBACK TO
DOCTOR &
CARETAKER
GSM
LCD DISPLAY
PIC MICRO
CONTROLLER
16F877A
PRESSURE SENSORS,
CHEMICAL SENSORS AND
SENSOR CIRCUITS
FLOW
CHAMBER
ASTHMA
PATIENT
-
4
CHAPTER 3
COMPONENTS:
Pressure sensor
MPX5010
Chemical sensor
CO sensor
NO sensor
O2 sensor
PIC micro controller(16F877A)
GSM
LCD display
Power supply
Step down transformer
-
5
CHAPTER 4
CIRCUIT DIAGRAM:
Figure: 4.1.0 Circuit diagram
-
6
CHAPTER 5
HARDWARE DESCRIPTION:
5.1 POWER SUPPLY UNIT:
Regulated DC 5V is used for Harvard architecture based microcontroller,
warning indication (i.e. LED indication), audio able alarm unit and Safety
monitoring unit i.e. LCD Display unit. Unregulated DC voltage is used for relay
circuit which is used to controlling and triggering the various output devices
which is to be in the car that which has been adopted with driver circuit.
Since all electronic circuits work only with low D.C. voltage we need a
power supply unit to provide the appropriate voltage supply. This unit consists
of transformer, rectifier, filter and regulator. A.C. voltage typically 230V rms is
connected to a transformer which steps that AC voltage down to the level to the
desired AC voltage. A diode rectifier then provides a full-wave rectified voltage
that is initially filtered by a simple capacitor filter to produce a DC voltage. This
resulting DC voltage usually has some ripple or AC voltage variations. regulator
circuit can use this DC input to provide DC voltage that not only has much less
ripple voltage but also remains the same DC value even the DC voltage varies
some what, or the load connected to the output DC voltage changes. The power
supply unit is a source of constant DC supply voltage. The required DC supply
is obtained from the available AC supply after rectification, filtration and
regulation.
5.1.1 CIRCUIT DIAGRAM:
The main components used in the power supply unit shown in Fig 2.3 are
Transformer, Rectifier, Filter, and Regulator. The 230V ac supply is converted
into 12V ac supply through the transformer.
-
7
The output of the transformer has the same frequency as in the input ac
power. This ac power is converted into dc power through the diodes. Here the
bridge diode is used to convert the ac supply to the dc power supply.
Figure 5.1.1: Power supply circuit diagram
This converted dc power supply has the ripple content and for the normal
operation of the circuit, the ripple content of the dc power supply should be as
low as possible. Because the ripple content of the power supply will reduce the
life of circuit. So to reduce the ripple content of the dc power supply, the filter is
used. The filter is nothing but the large value capacitance. The output waveform
of the filter capacitance will almost be the straight line. This filtered output will
not be the regulated voltage. For the normal operation of the circuit it should
have the regulated output. Specifically for the microcontroller IC regulated
constant 5V output voltage should be given. For this purpose 78xx regulator
should be used in the circuit.
In that number of IC, the 8 represents the positive voltage and if it is 9, it
will represent the negative voltage. The xx represents the voltage. If it is 7805,
-
8
it represent 5V regulator, and if it is 7812, it represent 12V regulator. Thus the
regulated constant output can be obtained. The brief description of the blocks
above is as follows.
5.1.2 TRANSFORMER:
Transformer is a device used either for stepping-up or stepping-down of
the AC supply voltage with a corresponding decreases or increases in the
current. Here, a center-tapped transformer is used for stepping-down the voltage
so as to get a voltage that can be regulated to get a constant 12V. In this project,
to satisfy these requirements, we make use of 1.0A, 12V-0-12V transformer.
Figure 5.1.2: Step down transformer
5.1.3 RECTIFIER:
A rectifier is a device such as a semiconductor capable of converting
sinusoidal input waveform units into a unidirectional waveform, with a non-
zero average component.
5.1.4 FILTERS:
Capacitors are used as filters in the power supply unit. Shunting the load
with the capacitor, effects filtering. The action of the system depends upon the
fact the capacitor stores energy during the conduction period and delivers this
-
9
energy to the load during the inverse or non-conducting period. In this way,
ti4me during which the current passes through the load is prolonged and ripple
is considerably reduced.
5.1.5 FIXED VOLTAGE REGULATOR:
An IC7805 fixed voltage regulator is used in this circuit. The function of
this regulator is to provide a +5V constant DC supply, even if there are
fluctuations to the regulator input. This regulator helps to maintain a constant
voltage throughout the circuit operation.
5.2 PRESSURE SENSOR:
Figure 5.2.1 MPX5010 Pressure sensor
The MPX5010 series piezo resistive transducers are state-of-the-art
monolithic silicon pressure sensors designed for a wide range of applications.
This transducer combines advanced micromachining techniques, thin-film
metallization, and bipolar processing to provide an accurate, high level analog
output signal that is proportional to the applied pressure. This sensor is used to
monitor air flows of 50–900 L/min. The output of this sensor is PEF and FEV1.
Peak expiratory flow(PEF) is the maximal flow achieved during the
maximally forced expiration initiated at full inspiration measured in
L/min. Peak flow readings are higher when we are in normal condition,
and lower for asthma patient. PEF rate varies for men and women.
-
10
Forced expiratory volume(FEV1) is the volume of air that can forcibly be
blown out in one second after full inspiration. The normal values for
FEV1 in healthy people are 80% to 120%.
The values between 60%-79% are predicted for mild obstruction.
The values between 40%-59% are predicted for moderate obstruction.
The values less than 40% are predicted for severe obstruction.
HEIGHT
AGE 55’’ 60’’ 65’’ 70’’ 75’’
20 390 423 460 496 501
25 385 418 454 490 498
30 380 413 448 483 492
35 375 408 442 476 485
40 370 402 436 470 472
45 365 397 430 464 463
50 360 391 424 457 458
55 355 386 418 451 443
60 350 380 412 445 432
65 345 375 406 439 420
70 340 369 400 432 400
Table 1:PEFR for women
-
11
HEIGHT
AGE 60’’ 65’’ 70’’ 75’’ 80’’
20 454 502 620 643 650
25 443 490 601 629 625
30 432 477 522 534 610
35 421 465 509 521 595
40 409 452 496 518 580
45 398 440 483 503 565
50 386 427 469 500 549
55 375 415 456 493 534
60 363 402 442 478 518
65 452 390 429 464 503
70 440 377 415 450 487
Table 2:PEFR for men
5.3 CHEMICAL SENSORS:
The chemical sensors were selected to detect the lower end of the
biomarker concentration range found in exhaled breath in asthma patients.
These three sensors are electrochemical sensors. The range for each sensor to
monitor asthma patients are 0.02–0.13 ppm for NO, 2–7 ppm for CO and 14–20
pph for O2. The chemical sensors were selected to detect the lower end of the
biomarker concentration range found in exhaled breath in asthma patients.
These three sensors are electrochemical sensors.
-
12
The oxygen sensor(O2) has a slight humidity dependence while the NO
and CO sensors do not have a humidity dependence but have signal spikes from
rapid transient changes in humidity. For the NO and CO sensors, a potentiostatic
circuit was built to control the chemical sensor and a transimpedence amplifier
was used to convert the current generated from sensors to a measureable
voltage. The O2 sensor does not require a potentiostatic circuit and the signal
was obtained by using a transimpedence amplifier to convert the current
generated by the sensor into a measureable voltage. Quantification of chemical
biomarkers in exhaled breath must also occur before spirometry maneuvers
because spirometry often causes exhaled NO concentrations to artificially
decrease.
NO (ppm) CO (ppm) O2 (pph)
0.02 2 18
0.04 5.2 11.2
0.07 6.5 19.1
0.13 7 15.04
Table 3: NO, CO, O2 Rate for Asthma patients
NO (ppm) CO (ppm) O2 (pph)
0.005 1.5 12
0.011 2 14
0.015 2.2 19
0.018 2.4 20
Table 4: NO, CO, O2 Rate for normal patients
-
13
5.3.1 NO SENSOR:
Figure 5.3.1 NO-D4 Nitric oxide sensor
SPECIFICATON:
Temperature range from -20 to 50 °C.
Pressure range from 80 to 120 kPa.
Humidity range 15 to 90 % rh.
Load resistor 10 - 47 Ω .
5.3.2 CO SENSOR:
Figure 5.3.2 CO-D4 Carbon monoxide sensor
SPECIFICATIONS:
Temperature range -20 to 500 °C.
Pressure range 80 to 120 kPa.
Humidity range 15 to 90 % rh.
Load resistor 10 - 100 Ω .
-
14
5.3.3: O2 SENSOR:
Figure 5.3.3 O2-G2 Oxygen sensor
Unlike partial pressure oxygen sensors, they have good pressure and
temperature dependence, making them the best choice in safety applications.
Standard galvanic sensors use lead for greatest reliability but fixed lifetime. The
new LFO2-A4 lead free A-series sensor requires continuous biasing but offers
longer lifetime.
SPECIFICATION:
Temperature range from -30 to 55 °C
Pressure range from 80 to 120 kPa
Humidity range 5 to 95 % rh.
Load resistor 47 - 100 Ω.
5.4 PIC 16F877A:
Sensors output is given to the PIC micro controller. Normally sensor
output is analog information. This micro controller converts the analog
information into digital information. Pressure sensor output is send to pin 2(port
A) of PIC microcontroller and chemical sensor output is send to pin 3(port A) of
PIC microcontroller. The digitized sensor output from the pin 25 and 26(port C)
is given to GSM and the output from port D of PIC is displayed via LCD.
-
15
PIC is a family of modified harvard architecture microcontrollers made by
microchip technology. The name PIC initially referred to Peripheral Interface
Controller. Early models of PIC had read-only memory (ROM) or field-
programmable EPROM for program storage, some with provision for erasing
memory. All current models us Flash memory for program storage, and newer
models allow the PIC to reprogram itself. Program memory and data memory
are separated. Data memory is 8-bit, 16-bit and in latest models, 32-bit wide.
Program instructions vary in bit-count by family of PIC, and may be 12, 14, 16,
or 24 bits long. The instruction set also varies by model, with more powerful
chips adding instructions for digital signal processing functions.
Figure 5.4.0 pin diagram of PIC 16F877A
The hardware capabilities of PIC devices range from 8-pin DIP chips up
to 100-pin SMD chips, with discrete I/O pins, ADC and DAC modules, and
http://en.wikipedia.org/wiki/Dual_in-line_packagehttp://en.wikipedia.org/wiki/Surface-mount_technology
-
16
communications orts such as UART, I2C, CAN, and even USB. Low-power
and high-speed variations exist for many types.
The manufacturer supplies computer software for development known
as MPLAB, assemblers and C/C++ compilers, and programmer/debugger
hardware under the MPLAB and PIC kit series. Third party and some open-
source tools are also available. Some parts have in-circuit programming
capability; low-cost development programmers are available as well has high-
production programmers.
PIC devices are popular with both industrial developers and hobbyists
due to their low cost, wide availability, large user base, extensive collection of
application notes, availability of low cost or free development tools, serial
programming, and re-programmable Flash-memory capability.
5.4.1 Enhanced PIC Flash Microcontroller in 40-pin PDIP
The PIC16F877A CMOS FLASH-based 8-bit microcontroller is
upward compatible with the PIC16C5x, PIC12Cxxx and PIC16C7x devices. It
features 200 ns instruction execution, 256 bytes of EEPROM data memory, self
programming, an ICD, 2 Comparators, 8 channels of 10-bit Analog-to-Digital
(A/D) converter, 2 capture/compare/PWM functions, a synchronous serial port
that can be configured as either 3-wire SPI or 2-wire I2C bus, a USART, and a
Parallel Slave Port.
5.4.2 Data space (RAM)
PICs have a set of registers that function as general-purpose RAM.
Special-purpose control registers for on-chip hardware resources are also
mapped into the data space. The addressability of memory varies depending on
device series, and all PIC devices have some banking mechanism to extend
addressing to additional memory. Later series of devices feature move
http://en.wikipedia.org/wiki/UARThttp://en.wikipedia.org/wiki/I2Chttp://en.wikipedia.org/wiki/Universal_serial_bushttp://en.wikipedia.org/wiki/MPLABhttp://en.wikipedia.org/wiki/MPLAB_deviceshttp://en.wikipedia.org/wiki/Bank_switching
-
17
instructions, which can cover the whole addressable space, independent of the
selected bank. In earlier devices, any register move had to be achieved through
the accumulator.
To implement indirect addressing, a "file select register" (FSR) and
"indirect register" (INDF) are used. A register number is written to the FSR,
after which reads from or writes to INDF will actually be to or from the register
pointed to by FSR. Later devices extended this concept with post- and pre-
increment/decrement for greater efficiency in accessing sequentially stored data.
This also allows FSR to be treated almost like a stack pointer (SP).
External data memory is not directly addressable except in some
PIC18 devices with high pin count.
5.4.3 Stacks
PICs have a hardware call stack, which is used to save return
addresses. The hardware stack is not software-accessible on earlier devices, but
this changed with the 18 series devices. Hardware support for a general-purpose
parameter stack was lacking in early series, but this greatly improved in the 18
series, making the 18 series architecture more friendly to high-level language
compilers.
5.4.4 Instruction set
PIC's instructions vary from about 35 instructions for the low-end
PICs to over 80 instructions for the high-end PICs. The instruction set includes
instructions to perform a variety of operations on registers directly,
the accumulator and a literal constant or the accumulator and a register, as well
as for conditional execution, and program branching.
Some operations, such as bit setting and testing, can be performed on
any numbered register, but bi-operand arithmetic operations always involve W
http://en.wikipedia.org/wiki/Accumulator_(computing)http://en.wikipedia.org/wiki/Processor_register
-
18
(the accumulator), writing the result back to either W or the other operand
register. To load a constant, it is necessary to load it into W before it can be
moved into another register. On the older cores, all register moves needed to
pass through W, but this changed on the "high-end" cores.
PIC cores have skip instructions, which are used for conditional
execution and branching. The skip instructions are "skip if bit set" and "skip if
bit not set". Because cores before PIC18 had only unconditional branch
instructions, conditional jumps are implemented by a conditional skip (with the
opposite condition) followed by an unconditional branch. Skips are also of
utility for conditional execution of any immediate single following instruction.
It is possible to skip instructions. For example, the instruction sequence "skip if
A; skip if B; C" will execute C if A is true or if B is false. The 18 series
implemented shadow, registers which save several important registers during an
interrupt, providing hardware support for automatically saving processor state
when servicing interrupts.
5.4.5 Performance
The architectural decisions are directed at the maximization of speed-
to-cost ratio. The PIC architecture was among the first scalar CPU design and is
still among the simplest and cheapest. The Harvard architecture, in which
instructions and data come from separate sources, simplifies timing and
microcircuit design greatly, and this benefits clock speed, price, and power
consumption. The PIC instruction set is suited to implementation of fast lookup
tables in the program space. Such lookups take one instruction and two
instruction cycles. Many functions can be modelled in this way. Optimization is
facilitated by the relatively large program space of the PIC (e.g. 4096 × 14-bit
words on the 16F690) and by the design of the instruction set, which allows
embedded constants. For example, a branch instruction's target may be indexed
-
19
by W, and execute a "RETLW", which does as it is named – return with literal
in W.
Interrupt latency is constant at three instruction cycles. External
interrupts have to be synchronized with the four-clock instruction cycle,
otherwise there can be a one instruction cycle jitter. Internal interrupts are
already synchronized. The constant interrupt latency allows PICs to achieve
interrupt-driven low-jitter timing sequences. An example of this is a video sync
pulse generator. This is no longer true in the newest PIC models, because they
have a synchronous interrupt latency of three or four cycles.
5.4.6 PIC16F877A Features
Operating voltage: 4.0-5.5V.
Industrial temperature range (-40° to +85°C).
15 Interrupt Sources.
35 single-word instructions.
All single-cycle instructions except for program branches (two-cycle).
Special Features:
Flash Memory: 14.3 Kbytes (8192 words).
Data SRAM: 368 bytes.
Data EEPROM: 256 bytes.
Self-reprogrammable under software control.
In-Circuit Serial Programming via two pins (5V).
Watchdog Timer with on-chip RC oscillator.
-
20
Programmable code protection.
Power-saving Sleep mode.
Selectable oscillator options.
In-Circuit Debug via two pins.
Analog Features
10-bit, 8-channel A/D Converter.
Brown-Out Reset.
Analog Comparator module.
2 analog comparators.
Programmable on-chip voltage reference module.
Programmable input multiplexing from device inputs and internal Vref.
Comparator outputs are externally accessible.
5.4.7 Advantages of PIC
Small instruction set to learn.
RISC architecture.
Built-in oscillator with selectable speeds.
Easy entry level, in-circuit programming plus in-circuit debugging PIC
kit units available for less than $50.
Inexpensive microcontrollers.
Wide range of interfaces including I²C, SPI, USB, USART, A/D,
programmable comparators, PWM, LIN, CAN, PSP, and Ethernet.
http://en.wikipedia.org/wiki/Reduced_instruction_set_computerhttp://en.wikipedia.org/wiki/PICkithttp://en.wikipedia.org/wiki/PICkithttp://en.wikipedia.org/wiki/I%C2%B2Chttp://en.wikipedia.org/wiki/Serial_Peripheral_Interface_Bushttp://en.wikipedia.org/wiki/USBhttp://en.wikipedia.org/wiki/Universal_asynchronous_receiver/transmitterhttp://en.wikipedia.org/wiki/Analog-to-digital_converterhttp://en.wikipedia.org/wiki/Pulse-width_modulationhttp://en.wikipedia.org/wiki/Local_Interconnect_Networkhttp://en.wikipedia.org/wiki/Controller_area_networkhttp://en.wikipedia.org/wiki/Parallel_slave_port
-
21
Availability of processors in DIL package make them easy to handle for
hobby use.
5.4.8 Limitations
One accumulator.
Register-bank switching is required to access the entire RAM of many
devices.
Operations and registers are not orthogonal; some instructions can
address RAM and/or immediate constants, while others can use the
accumulator 2only.
The following stack limitations have been addressed in the PIC18 series,
but still apply to earlier cores:
The hardware call stack is not addressable, so preemptive task
switching cannot be implemented.
Software-implemented stacks are not efficient, so it is difficult to
generate reentrant code.
5.5 GSM(SIM900A):
Global system for mobile communication (GSM) is a globally accepted
standard for digital cellular communication. This is a plug and play GSM
Modem with a simple to interface serial interface. Use it to send SMS, make
and receive calls, and do other GSM operations by controlling it through simple
AT commands from micro controllers and computers. It uses the highly popular
SIM900 module for all its operations. It comes with a standard RS232 interface
http://en.wikipedia.org/wiki/Dual_in-line_packagehttp://en.wikipedia.org/wiki/Accumulator_(computing)http://en.wikipedia.org/wiki/Bank_switchinghttp://en.wikipedia.org/wiki/Orthogonal#Computer_sciencehttp://en.wikipedia.org/wiki/Constant_(computer_science)http://en.wikipedia.org/wiki/Computer_multitaskinghttp://en.wikipedia.org/wiki/Computer_multitaskinghttp://en.wikipedia.org/wiki/Stack_(data_structure)http://en.wikipedia.org/wiki/Reentrant_(subroutine)
-
22
which can be used to easily interface the modem to micro controllers and
computers. The modem consists of all the required external circuitry required to
start experimenting with the SIM900 module like the power regulation, external
antenna, SIM Holder, etc.
PIC microcontroller output is given to GSM module. The monitored
ranges are send as message to asthma patient via GSM. This GSM Modem can
accept any GSM network operator SIM card and act just like a mobile phone
with its own unique phone number.
Figure 5.5.0 SIM900 GSM module
5.5.1 FEATURES OF GSM:
SMS based Remote Control Systems.
Security Applications and Sensor Monitoring.
GPRS Mode Remote Data Logging.
-
23
This GSM modem is a highly flexible.
SIM900A GSM modem is used for direct and easy integration to RS232
applications.
Simple to Use & Low Cost.
On board switching type power supply regulator.
RS232 output.
5.6 LCD DISPLAY:
A liquid crystal display (LCD) is a flat panel display, electronic visual
display, or video display that uses the light modulating properties of liquid
crystals. Liquid crystals (Fig 3.5) do not emit light directly. LCDs are available
to display arbitrary images (as in a general-purpose computer display) or fixed
images which can be displayed or hidden, such as preset words, digits, and 7-
segment displays as in a digital clock. They use the same basic technology,
except that arbitrary images are made up of a large number of small pixels,
while other displays have larger elements. LCDs are used in a wide range of
applications including computer monitors, televisions, instrument panels,
aircraft cockpit displays, and signage. They are common in consumer devices
such as video players, gaming devices, clocks, watches, calculators, and
telephones, and have replaced cathode ray tube (CRT) displays in most
applications. They are available in a wider range of screen sizes than CRT and
plasma displays, and since they do not use phosphors, they do not suffer image
burn-in. LCDs are, however, susceptible to image persistence. The LCD is more
energy efficient and can be disposed of more safely than a CRT. Its low
electrical power consumption enables it to be used in battery-powered electronic
equipment. It is an electronically modulated optical device made up of any
number of segments filled with liquid crystals and arrayed in front of a light
-
24
source (backlight) or reflector to produce images in colour or monochrome.
Liquid crystals were first developed in 1888. By 2008, worldwide sales of
televisions with LCD screens exceeded annual sales of CRT units; the CRT
became obsolete for most purposes.
Figure 5.6.0 LCD display
5.6.1 LCD CONNECTION PIN DETAILS:
Table 5: INTERFACE OF LCD WITH PIC
5.6.1 CONNECTIONS:
Connection to the LCD is through a 14-pin interface, physically arranged
1x14. We only need to use six lines to write to the display. And since four of
-
25
these lines are tri-stated when not in use, they can be shared by other hardware.
The data bus is eight bits wide, but we’re only using four bits.
LCD INTERFACE:
Figure 5.6.1 Interface of LCD with PIC
As shown in Fig connect the pins RS ,RW ,E ,D0 - D7 to pins on the
micro controller Lets suppose I connect Data bus on port A and the RS, RW, E
on port B. (you can save pins by using LCD in Nibble Mode (4 data pins ) and
permanently grounding the RW line ( always in write mode ) .
5.6.2 DISPLAY BASICS:
Use of the LCD is pretty straightforward. After power-up, wait a half
second or so to let the LCD run its own initialization. Since the default mode is
eight bits, we’ll have to reinitialize it to accept our data via the four-bit bus.
When the four-bit initialization is complete, It can send our characters or
commands. The RS line is set high for characters, low for LCD commands.
The initialization code is required to allow the LCD to operate in four-bit
mode. After setting the four-bit interface, this section of code turns the display
on, turns off the underline cursor, and causes the cursor to increment after each
-
26
character is written. Just to ensure that there is no garbage left from any
previous operations, the Display Clear command is sent to the LCD.
Writing a character or command is done in these steps:
1. Set the RS line (HIGH for character, LOW for command).
2. Place the high nibble of the character/command byte on the bus.
3. Strobe the Enable line (cause a HIGH-to-LOW transition).
4. Place the low nibble on the bus.
5. Strobe the Enable line one more time.
-
27
CHAPTER 6
SOFTWARE DESCRIPTION:
6.1 MPLAB IDE:
MPLAB IDE is a software program that runs on a PC to develop
applications for Microchip microcontrollers. MPLAB Integrated Development
Environment (IDE) is a free, integrated toolset for the development of embedded
applications employing Microchip's PIC and PIC
microcontrollers. MPLAB IDE
runs as a 32-bit application on MS Windows, is easy to use and includes a host of
free software components for fast application development and super-charged
debugging. MPLAB IDE also serves as a single, unified graphical user interface
for additional Microchip and third party software and hardware development
tools. Moving between tools is a snap, and upgrading from the free software
simulator to hardware debug and programming tools is done in a flash because
MPLAB IDE has the same user interface for all tools.
6.1.1 CROSS-COMPILER:
Cross-compiler is a software program, which is used to convert high –level
language program like C to machine language of a specific Microcontroller,
using cross-compiler user can write programs in C language, which speeds up
the development process.
6.1.2 SIMULATOR:
Simulator is software, which implements the features of a specific
Microcontroller on PC. It helps in testing and debugging the programs and
interfaces that are to be actually implemented on a Microcontroller at a later
stage. Using simulator, the program can be executed and tested without using
the evaluation kit, usually the program is simulated under pc environment.
-
28
6.1.3 EMULATOR:
Emulator is an in-circuit Microcontroller emulation probe, which provides
the user with substantial control over all of the Microcontroller functions and
responsibilities. It provides hardware assistance for debugging the most difficult
real time problems. Emulators offer visibility into system initialization, before
software based debuggers can function, Emulators can identify the code
corrupting a data structure, it can also be used to determine how often a
particular function is invoked.
6.1.4 DEBUGGER:
It is a software tool used to debug the programs. A debugger detects the
non-workability of the program by detecting the errors online (i.e. while the
program is running in the target it has the capability to detect proper functioning
of the application program.)
6.2 EMBEDDED SOFTWARE:
Software in the embedded system is implanted with either assembly
language or any high level language. Now-a-days C and C++ has been the
choice but language for the embedded software for the following reasons.
C and C++ are machine independent language, so the programmer can
concentrate only on the algorithms.
C has the ability for direct hardware control and it can be interfaced to
run any mechanical machine.
Any source code written in C and C++ or assembly must be converted into
an executable image that can be loaded onto an EEPROM chip. The process of
converting the source code representation of embedded software into an
-
29
executable image involves three distinct steps and the system or computer on
which these processes are executed is called host computer.
There are some differences between conventional programming and
embedded programming. Even if the processor architecture is the same, the I/O
interfaces or sensors or activators may differ. Second, there is a difference in the
development and debugging of applications.
The basic tool chain for the Embedded Software is given below. The
project manager organizes the files to be edited and other associated files so
they can be sent to the language tools for assembly or compilation, and
ultimately to a linker. The linker has the task of placing the object code
fragments from the assembler, compiler and libraries into the proper memory
areas of the embedded controller, and ensure that the modules function with
each other (or are “linked”).
This entire operation from assembly and compilation through the link
process is called a project “build”. From the MPLAB project manager,
properties of the language tools can be invoked differently for each file, if
desired, and a build process integrates all of the language tools operations.
The source files are text files that are written conforming to the rules of the
assembler or compiler. The assembler and compiler convert them into
intermediate modules machine code and placeholders for references to functions
and data storage. The linker resolves these placeholders and combines all the
modules into a file of executable machine code.
The linker also produces a debug file which allows MPLAB IDE to relate
the executing machine codes back to the source files. A text editor is used to
write the code. It is not a normal text editor, but an editor specifically designed
for writing code for Microchip MCUs. It recognizes the constructs in the text
-
30
and uses color coding to identify various elements, such as instruction
mnemonics, C language constructs and comments.
The editor supports operations commonly used in writing source code,
such as finding matching braces in C, commenting and un-commenting out
blocks of code, finding text in multiple files and adding special bookmarks.
After the code is written, the editor works with the other tools to display code
execution in the debugger.
Breakpoints can be set in the editor, and the values of variables can be
inspected by hovering the mouse pointer over the variable name. Names of
variables can be dragged from source text windows and then dropped into a
watch window.
-
31
CHAPTER 7
ADVANTAGES:
The device is highly portable and can therefore be used by the patient
anywhere at anytime.
Complications for asthma patients are encountered using this monitoring
system.
Allowing the patients to self monitor lung function biometrics.
Telemetry capabilities help physicians to track asthma symptoms and
lung function over time.
-
32
CHAPTER 8
FUTURE SCOPE:
This duration might be difficult for severely asthmatic patients and future
design improvements should incorporate chemical sensors with a shorter
response time and better sensitivity to the target to analyze various lung
parameters using wireless sensors. By using our android mobile we can trace
the environmental conditions which may affect the asthma patients so this
climatic conditions are also send to the doctor and care taker.
-
33
CHAPTER 9
CONCLUSION:
A personalized lung function monitoring device that utilize phone
technology to create a convenient, reliable, and user-friendly system was
designed. Initial validation testing has proved that measurements taken with this
device are comparable to that of a clinical spirometer and satisfy the minimum
requirements related to spirometry test. Advancements towards personalized
medicine provide more opportunities to perform longitudinal studies with
asthma patients remotely and enable patients to become more aware of their
lung health. The ability to gather the necessary data quickly and efficiently and
then instantly communicate that data with a health care professional means that
such devices have the potential to significantly improve the speed of respiratory
health care and asthma management in the future.
-
34
CHAPTER 10
MODEL OF THE PROJECT:
Figure 10.1.0 Project model
Figure 10.2.0 Output screenshot
-
35
CHAPTER 11
REFERENCES:
[1] Akinbami.L.J et al. 2001-2010, “Trends in asthma prevalence, health care
use, and mortality in the United States,” National Center for Health
StatisticsHyattsville, MD, USA, NCHS data brief, no. 94.
[2] Alice M. Kwan, Alexander G. Fung, Peter A. Jansen , APRIL 2015
“Personal Lung Function Monitoring Devices for Asthma Patients” IEEE
sensor journal, VOL. 15 , NO .4.
[3] Allergy Clin.J. Nov. 2007,National Asthma Education and Prevention
Program, “Expert panel report 3 (EPR-3): Guidelines for the diagnosis and
management of asthma-summary report 2007,” vol. 120, pp. S94–S138.
[4] Bateman.E.D,2008 et al., “Global strategy for asthma management and
prevention: GINA executive summary,” Eur. Respirat. J., vol. 31, no. 21, pp.
143–178.
[5] Freeman.G, Dec. 2011, “Summary health statistics for U.S. children:
National health interview survey, 2010,” Nat. Center Health Statist. Vital Health
Statist., vol 10, no. 250, pp. 1–80.
[6] Great Notley, U.K., Jan. 2012, CO-D4 Carbon Monoxide Sensor,
Alphasense Ltd.,
[7] Great Notley, U.K., May 2013,O2-G2 Oxygen Sensor, Alphasense Ltd.,.
[8] Great Notley, U.K., Oct. 2013, NO-D4 Nitric Oxide Sensor, Alphasense
Ltd.,
[9] https://ieeexplore.ieee.org/
[10] https://www.digikey.com/
[11] Masoli.M, Fabian.D,May 2004 and Global Initiative for Asthma (GINA)
Program, “The global burden of asthma: Executive summary of the GINA
dissemination committee report,” Allergy, vol. 59, no. 5, pp. 469–478.
[12] Miller.M.R ,Aug. 2005et al., “Standardisation of spirometry,” Eur.
Respirat. J., vol. 26, no. 2, pp. 319–338.
[13] Overview of GSM https://www.tutorialspoints/gsm/gsm_overview.com.
https://ieeexplore.ieee.org/https://www.digikey.com/
-
36
[14] Pitts.S.R., Niska.R.W,Aug. 2008, “National hospital ambulatory medical
care survey: 2006 emergency department sum- mary,” National Health
Statistics, Hyattsville, MD, USA, Tech. Rep. 7, , pp. 1–38.
[15] The overview of micro controller https://www.best-microcontroller-
projects.com.
[16] What is Asthma? [Online]. Available: http://www.nhlbi.nih.
gov/health/health-topics/topics/asthma/