Final-2017-5-1-Zhuo LI-Thesis
Final-2017-5-1-Zhuo LI-Thesis
Final-2017-5-1-Zhuo LI-Thesis
MONITORING SYSTEM
By
ZHUO LI
August, 2017
CASE WESTERN RESERVE UNIVERSITY
(Zhuo Li)
Committee Chair
(Christos Papachristou)
Committee Member
(Christos Papachristou)
Committee Member
(Hongping Zhao)
Committee Member
(Ming-Chun Huang)
Date of Defense
(May 1st)
I
Table of Contents
List of Tables ............................................................................................................................III
List of Figures ......................................................................................................................... IV
Abstract ................................................................................................................................... VI
1. Introduction ...................................................................................................................................1
1.1 Motivation ...........................................................................................................................1
1.2 Project overview..................................................................................................................2
1.3 Outline of thesis ..................................................................................................................3
2. Background ...................................................................................................................................5
2.1 Air environmental parameters .............................................................................................5
2.2 Embedded design and Arduino platform ...........................................................................10
2.3 Sensor techniques ..............................................................................................................12
3. Design methods ...........................................................................................................................15
3.1 System key requirements ..................................................................................................15
3.2 System design overview ....................................................................................................15
3.2.1 Working principle ...................................................................................................15
3.2.2 Architecture design .................................................................................................17
3.3 System controller unit .......................................................................................................18
3.4 Sensors methodology ........................................................................................................20
3.4.1 PM2.5 sensor module .............................................................................................20
3.4.2 Temperature and humidity sensor module..............................................................23
3.4.3 Rain sensor module ................................................................................................24
3.4.4 Electrochemical gas sensor module........................................................................26
3.5 Hardware schematic design ...............................................................................................31
3.5.1 Power circuits .........................................................................................................32
3.5.2 Clock circuit ...........................................................................................................38
3.5.3 Analog to digital converter circuit ..........................................................................41
3.6 Software implementation ..................................................................................................43
3.7 System output and end device ...........................................................................................48
4. Experiment and results ................................................................................................................52
4.1 Twelve hours experiments .................................................................................................52
4.2 PM2.5 sensor experiment ..................................................................................................56
4.3 Rain sensor experiment .....................................................................................................58
5. Summary and future work ...........................................................................................................59
5.1 Summary ...........................................................................................................................59
5.2 Future work .......................................................................................................................60
Appendix .........................................................................................................................................62
A. Project schematic ................................................................................................................62
B. Print circuit board ...............................................................................................................63
C. Project budget .....................................................................................................................64
Bibliography....................................................................................................................................65
II
List of Tables
Table 2.1 PM2.5 pollutant level ................................................................................................6
Table 3.1 Arduino mega 2560 specification ..........................................................................18
Table 3.2 PMS1003 sensor specification.................................................................................22
Table 3.3 Electrochemical gas sensors ....................................................................................30
Table 3.4 Pin definition of the TPS73801 ...............................................................................35
Table 3.5 Pin definition of DS1302 .........................................................................................39
Table 3.6 ADS 1115 pin definition ..........................................................................................42
Table 3.7 Timer function code .................................................................................................47
Table C.1 Hardware cost .........................................................................................................64
III
List of Figures
Figure 2.1 Working principle of the NDIR sensor ..................................................................12
Figure 3.1 System block diagram ............................................................................................17
Figure 3.2 Arduino mega 2560 board .....................................................................................19
Figure 3.3 Block diagram showing all interfaces with the Arduino microcontroller ..............19
Figure 3.4 PMS1003 sensor ....................................................................................................21
Figure 3.5 Function block diagram of the sensor ....................................................................22
Figure 3.6 PM2.5 connection block diagram ..........................................................................23
Figure 3.7 AM2302 sensor ......................................................................................................24
Figure 3.8 TEMP/HUM connection block diagram ................................................................24
Figure 3.9 FC-37 sensor ..........................................................................................................25
Figure 3.10 Rain senor connection block diagram ..................................................................25
Figure 3.11 KE-50 sensor ........................................................................................................26
Figure 3.12 O2 sensitivity ........................................................................................................27
Figure 3.13 Oxygen electrochemical sensor structure.............................................................27
Figure 3.14 MG-811 sensor.....................................................................................................28
Figure 3.15 CO2 and O2 connection block diagram ................................................................29
Figure 3.16 System Schematic block diagram ........................................................................31
Figure 3.17 Power circuit ........................................................................................................32
Figure 3.18 7805 regulator ......................................................................................................33
Figure 3.19 TPS73801 circuits ................................................................................................34
Figure 3.20 TPS73801 simplified schematic...........................................................................36
Figure 3.21 Clock circuit .........................................................................................................38
Figure 3.22 Analog to digital signal block diagram ................................................................41
Figure 3.23 AD converter circuit .............................................................................................42
Figure 3.24 ADS1115 ..............................................................................................................42
Figure 3.25 Flow chart for monitoring air quality parameters ................................................44
Figure 3.26 Screen display ......................................................................................................49
Figure 3.27 Screen connection diagram ..................................................................................49
Figure 3.28 CP2102 USB to UART adaptor ...........................................................................50
Figure 3.29 DATA received on a host computer .....................................................................50
Figure 3.30 AC-DC Power adapter .........................................................................................51
Figure 3.31 Battery holder ......................................................................................................51
Figure 3.32 Final prototype .....................................................................................................51
Figure 4.1 Temperature measurement .....................................................................................53
Figure 4.2 humidity measurement ...........................................................................................53
Figure 4.3 CO2 measurement ..................................................................................................54
Figure 4.4 O2 measurement .....................................................................................................55
Figure 4.5 PM2.5 measurement ..............................................................................................56
Figure 4.6 Screenshot taken from Airnow...............................................................................56
Figure 4.7 PM2.5 sensor experiment.......................................................................................57
Figure 4.8 Rain sensor experiment ..........................................................................................58
IV
Figure 5.1 Solar module connection diagram..........................................................................61
Figure A.1 System schematic ..................................................................................................62
Figure B.1 Print circuit board layout .......................................................................................63
Figure B.2 Print circuit board ..................................................................................................63
Figure B.3 Completely assembled circuit board without attached external components ........64
V
Arduino Based Environmental Air Monitoring System
Abstract
by
ZHUO LI
Environmental air parameters directly affect our daily quality of life, and they can
change from day to day or even hour to hour. With rapid industrialization over the past
few decades, there is a dramatically increasing demand for people to monitor the local
air quality to know how they live and what they breathe. In this work, we proposed an
air monitoring system based on the Arduino platform. This environmental air
solution to monitor the air quality continuously and in real-time. It is a portable system
that integrates multiple sensors into a single unit and can be placed anywhere. The
acquired results are displayed on a screen and can also be saved on a host computer for
further analysis.
VI
1. Introduction
1.1 Motivation
The atmosphere is a chaotic system, air condition is influenced by many factors and
can change quickly. Air condition and quality directly affect people’s daily lives, such
as their commute to work and the safety of outdoor activities. With the awareness of
more and more serious air pollution in many countries growing, there is an increasing
demand for a more efficient way to observe, record and collect air quality data.
Usually, people will obtain atmospheric conditions from weather forecasts, but these
can only provide limited information in any given location, and are not very accurate.
Although there are some advanced systems that might be able to monitor more
very large area, for instance, monitoring real time parameters for a metropolitan area or
a large suburbs using a few observation points. Additionally, after reviewing many
articles, currently there is no device available on the market that could automatically
monitor multiple types of air quality parameters at the same time, specifically the
the whole picture in terms of harmful particles, gases, temperature and humidity very
difficult.
1
Therefore, it is useful to develop a single mobile device that is fully automated mobile
device that can capture measurements at any location for short-term and long-term
analysis. This proposed environmental monitoring system can give real time
measurements of 6 air parameters and record the results on a host computer for future
into one single unit and utilizes an Arduino Mega 2560 as the controller component.
The proposed system provides a user friendly, low cost, and portable solution to monitor
monitoring method that integrates multiple sensors into a single unit. This is a portable,
user-friendly, low power and low cost air monitoring device that can measure
environmental air parameters of interest in real-time. This device can be used anywhere
to monitor air quality, including outdoors for industrial air pollution near factories and
indoors for home, hospital or school use with sensitive populations. The data provided
from the device can be used to distinguish between high and low air quality areas.
Through this system, we can automatically collect the information about PM 2.5,
humidity, temperature, CO2, O2, and rain. The values read from the sensors are
processed by the Arduino microcontroller and the results are displayed on the OLED
2
(Organic Light Emitting Diodes) screen for quick viewing. The results can also be
stored as a text file on a host computer. These saved values can be used to produce
graphical representations of the air characteristics and further analyze the data to look
In addition, this device is designed with an additional connection port, which can be
used to connect another gas sensor. This provides more flexibility going forward for
both the product designer, who can easily add and or test new sensors, and the consumer,
who has the ability to tailor the device to their personal needs. This additional port is
connected to a separate power supply to reduce the power consumption and allow the
digitize the sensor’s analog signal and the result will display on the screen. With this
extra port, the device can measure any type of potential air pollutants, such as CO
(Carbon Monoxide), SO2 (Sulfur Dioxide), O3 (Ozone), etc. along with the 6 measures
already taken by the device. This customizability gives the product limitless potential.
The thesis is organized as follows. Chapter 1 lays out the motivation of the study, and
the research, including the different air environmental parameters. The embedded
system design and sensor technique are reviewed. Chapter 3 discusses all the hardware
components used in the project, and why the specific hardware and software designs
3
were made based on the Arduino platform. In Chapter 4, the experiment setup is
4
2. Background
With rapid industrialization and urbanization over the past decades, the world has
in which various substances are present at concentrations high enough, above their
materials. Air pollutants are dangerous to human health as well as environment [1].
In scientific research concerning air quality studies, scientists are able to determine the
significant short and long-term impacts that come from industrial activities and the
areas that may experience these effects. In people’s daily lives, environmental monitors
can indicate the safety of people’s in-door and out-door activities. For example, people
can stay informed of local real-time air pollution to decide if they can exercise outside,
if they need a breathing mask to be safe, or if staying indoors is their best option. In
extreme conditions, schools will be closed for the safety of the children, and it is best
for anyone who is sensitive to reduce their exposure to hazardous air pollution levels.
Deciding the air quality on any given day requires environmental analysis and
monitoring, which is a very challenging and dynamic field. In this part, we discussed
the several major air parameters that are related to the safety of people during their day-
5
to-day lives.
There has been an increasing awareness of the air quality issue all over the world, with
a special focus on PM 2.5. This parameter refers to microscopic solid or liquid matter
suspended in the air that has a diameter of 2.5µm or less. Particle pollution comes from
many different types of sources, including power plants, industrial processes, vehicle
penetrate deep into our lung tissues and can cause various health problems.
wheezing, reduced lung function, asthma attacks, heart attacks and strokes. It also is
linked to early death [2]. Therefor it is best for kids、older adults and other sensitive
activities and choosing less strenuous activities. The table 2.1 [3] shows the impacts of
Oxygen is another important air parameter, as it’s essential to life. The oxygen level in
the atmosphere varies from place to place. For instance, areas near a large number of
factories and big cities have lower Oxygen levels due to pollution. Other places such as
rural areas and forests have higher oxygen levels that promote good health because
below 19.5 percent is considered to be oxygen deficient; and above 22 percent is oxygen
7
enriched.
under the category of asphyxiate gases that have capability of interfering the availability
of oxygen for tissues [4]. The global average concentration of CO2 now in Earth's
atmosphere is about 400 ppm (parts per million by volume). Prior to the Industrial
Revolution, CO2 levels were at 280 ppm. The planet didn't reach the 400 ppm mark by
itself. There is abundant evidence showing that the atmospheric CO2 increase is caused
by humans. CO2 makes up less than 1 percent of our atmosphere. But this small
amount of CO2 has a big impact on the planet. Plants use CO2 for photosynthesis and
earth's temperature is controlled by CO2. For these reasons and more, CO2 is an
The unit of parts per million (ppm) is numerically equivalent to micromoles of CO2 per
mole of air. Outdoor CO2 levels are usually 350-450 ppm whereas the maximum indoor
CO2 level considered acceptable is 1000 ppm. When the concentration goes above
1000ppm, the air becomes stagnant and people begin to feel sleepy. Once the CO2
Rain can help to remove pollutant particles from the air, and it is a very efficient way
to decrease the PM2.5 level quickly. It is also linked to temperature and humidity levels
8
thus is an important factor in weather condition.
Temperature and humidity also affect the presence of pollutants in the air. For instance,
haze often occurs when dust, smoke and other pollutant particles accumulate in
relatively dry air. Winter is the most polluted time of year in China, as cold and dry air
prevents smoke and other pollutants from dispersing. This is because warm air sits near
the ground and the air can rise easily and carry away pollutants, but cold air is trapped
Temperature and humidity can also affect human comfort and many manufacturing
In addition to above parameters there are some other factors that determine the air
quality. These factors include toxic gases (NOx, O3, CO, SO2, NH3, H2S), volatile
(PAH), greenhouse gases (CO2, CH4, N2O), particulate matter PM2.5, PM10 (PM10
are particles less than 10 micrometers in diameter), aerosol and dust, heavy metals,
pollens in the environment. Humans inhaling pollutants for an extended period of time
9
2.2 Embedded design and Arduino platform
This system utilize the embedded design technique and the Arduino platform.
built into a larger system for the purposes of controlling and monitoring the system [6].
Arduino is a tiny embedded system that you can program to process between the device
and the external components you connect to it. Embedded systems can range from
having no user interface (UI) -- for example, on devices in which the embedded system
is designed to perform a single task -- to complex graphical user interfaces (GUI), such
as in mobile devices. User interfaces can include buttons, LEDs, touchscreen sensing
and more. Some systems use remote user interfaces as well. Embedded systems control
many devices in common use today. Embedded systems use operating systems or
environments must be served [7]. Several operating systems have been developed
specifically for embedded applications, the dominant operating systems are Linux,
variety of microprocessors and controllers. The hardware boards are equipped with sets
of digital and analog input/output (I/O) pins that may be interfaced to various expansion
boards (shields) and other circuits. The boards feature serial communications interfaces,
including Universal Serial Bus (USB) on some models, which are also used for loading
could run on Mac, Windows, and Linux. Compared with other systems, Arduino offers
microcontroller platforms.
Windows.
use for beginners, yet flexible enough for advanced users to take advantage of as
well.
Open source and extensible software - The Arduino software is published as open
can be expanded through C++ libraries, and people wanting to understand the
technical details can make the leap from Arduino to the AVR C programming
language on which it's based. Similarly, you can add AVR-C code directly into
Open source and extensible hardware - The plans of the Arduino boards are
make their own version of the module, extending it and improving it.
11
2.3 Sensor techniques
A sensor is a device that detects and responds to some type of input from the physical
environment. The specific input could be light, heat, motion, moisture, pressure, or any
electronically over a network for reading or further processing [9]. Sensor types include
In general, infrared sensors and electrochemical sensors are two common types in
detecting air gas content. The non-dispersive infrared (NDIR) absorption method is a
for gases with absorption lines in 3-5 and 8-12 µm ranges [10]. For instance, NDIR
sensor can use for CO2, CO, N2O, hydrocarbons and hydrogenated fluorocarbons.
An infrared (IR) lamp directs waves of light through a tube filled with air toward an IR
12
light detector, which measures the amount of IR light that hits it. As the light passes
through the tube, any gas molecules that are the same size as the wavelength of the IR
light absorb the IR light only, while letting other wavelengths of light pass through.
Next, the remaining light hits an optical filter that absorbs every wavelength of light
except the exact wavelength absorbed by the measured gas. Finally, an IR detector reads
the amount of light that was not absorbed by the measured gas molecules or the optical
filter. The difference between the amount of light radiated by the IR lamp and the
to the number of measured gas molecules in the air inside the tube [11].
The advantage of NDIR approach is the high sensitivity and wide heat energy dynamic
and frequency ranges [10]. However, This NDIR sensor is very large and has a slow
response time, and is cost prohibitive. Because of these limitation, electrochemical gas
sensors are more suitable for a portable device in terms of size and cost.
There are three types of PM2.5 detectors: infrared detector, beta attenuation mass
monitoring detector and laser diffraction detector. Infrared detector can only give a
good or bad assessment, without an exact value of PM2.5 particles. Beta attenuation
monitoring is a widely used air monitoring technique employing the absorption of beta
radiation by solid particles, as Beta radiation can pass through solid matter. The main
principle is based on a kind of Bouguer (Lambert–Beer) law: the amount by which the
13
dependent on its mass and not on any other feature (such as density, chemical
composition or some optical or electrical properties) of this matter. The air is drawn
from outside of the detector through an "infinite" (cycling) ribbon made from some
Beta attenuation measurements can get extremely accurate results of particles’ size and
density in the air, but they’re very big and cost thousands of dollars. This is the type of
measurement detector used only by big monitoring agencies, such as the US embassy
in Beijing. The last one, laser sensors, are a more common type on the market that
people can afford. Its performance is very excellent and can produce results very close
14
3. Design methods
The system provides a user friendly, straightforward and robust solution to monitor
The system is a portable device that can be located anywhere to monitor the indoor
The system has high measurement accuracy and low power consumption.
The system is compatible with multiple types of gas sensors so that it can be
gas contents and the amount of dust present in the air. The system has five fixed sensors
and an additional connection port for an extra gas sensor. The five fixed sensors monitor
six types of air parameters: PM 2.5, humidity, temperature, CO2, O2, and rain. The extra
sensor can be chosen from multiple types of gas sensors that are compatible with this
either analog data or digital data depending on the sensor type for further processing.
An analog to digital converter is utilized to convert analog data into a digital signal.
The Arduino microcontroller processes all the acquired digital signals and then displays
environmental parameters from the serial port and store the data in a text file on the
host computer. The Arduino micro-controller communicates with the host computer
through its serial port. These extracted data can be plotted on a graph, which offers a
way to visualize trends over a period of time for changing air environment parameters
16
3.2.2 Architecture design
This environmental air monitoring system is based on the block diagram shown in
Figure 3.1. There are two main parts. The dashed lines represent data acquisition
mechanisms. The right part represents the data processing and display components.
The left part is designed to acquire the air parameters, which includes measurement
circuits for CO2, PM2.5, temperature and humidity, O2, and rain, as well as an additional
air gas measurement circuit that can be customized for future use. The gathered analog
data from O2, CO2 and, potentially, the extra gas sensors are digitized by sharing a same
AD converter.
The right part includes the power supply module, clock circuit, and screen display
circuit. The Arduino microcontroller is the main component that is centrally connected
17
to all the other components. The clock circuit provides the function of time keeping and
synchronizes different parts of the circuit. This power supply module includes two types
consumes a lot of power, the system here uses a more efficient OLED display. The
save the measurements. The results can be read out through the Arduino’s serial port to
a host computer.
Through these two parts, the Arduino microcontroller processes the data detected by all
The system uses the Arduino Mega 2560 board which encompasses an ATmega2560
18
Figure 3.2 Arduino mega 2560 board Figure 3
There are analogue input and digital input/output pins available the board for the
attachment of other electronic devices for input or output. As shown in figure 3.2 [13],
Arduino Mega 2560 board has 54 digital I/O pins, 16 analog inputs, 4 hardware UARTs,
a 16 MHz crystal oscillator, a USB connection, a power jack, an ICSP header, and a
reset button. There are 14 of 54 digital I/O pins that can be used as PWM outputs, which
can modulate output voltage using different pulse widths. The 4 hardware UARTs are
used for serial communication. The board can be powered using the USB connector or
Figure 3.3 Block diagram showing all interfaces with the Arduino microcontroller Fig 4
Figure 3.3 is the block diagram that shows all interfaces with the microcontroller. The
gas sensors give out analog signals that are digitized by the 16 bits Analog to digital
19
converter. Temperature & Humidity, rain, clock module are connected with the
Arduino’s digital I/O pins. PM2.5 sensor module uses UART communication to
transmit data to the Arduino. The Arduino uses the I2C bus to communicate with the
Analog to digital converter and the OLED screen. I2C communication needs to use the
Arduino's SDA and SCL pin. SCL stands for 'serial clock' and is used to control when
data is sent. The SDA line is used to send over serial data.
The proposed device consists of 5 fixed sensors that are used to monitor air parameters.
These 5 sensors are PM 2.5, humidity and temperature, CO2, O2, and rain sensors. The
sensors are connected to an Arduino Mega 2560 board. When the device is powered on,
the sensors start to generate data in real time. In this section, each sensor will be
discussed in detail.
Fine particulate matter (PM2.5) are tiny particles in the air with a diameter of 2.5μm or
less. It is an air pollutant that is a concern for people's health and causes the air to appear
hazy. Therefore, the number of suspended particles in the air is a very important ambient
value. This proposed system uses a PMS1003 sensor to detect PM2.5 concentration in
the air. PMS1003 has excellent performance in detecting fine particulate matter, along
with being very stable and reliable. PMS1003 can directly provide real time responses
and digital output values. Its minimum distinguishable particle diameter is 0.3μm.
20
Figure 3.4 PMS1003 sensor Figure 5
The sensor works using the laser scattering theory and therefore has high accuracy. The
sensor produces scattering by using a laser to radiate suspending particles in the air,
then collects scattering light in a certain degree, and finally obtains the curve of
scattering light over time. In the end, equivalent particle diameter and the number of
particles with different diameters per unit volume can be calculated based on MIE
theory [14]. This theory suggests situations where the size of the scattering particles is
comparable to the scattered light pattern. MIE theory does not refer to an independent
physical theory or law, but instead to the collection of MIE solution and model. The
plane wave by a homogeneous sphere. The solution takes the form of an infinite series
21
Figure 6Figure 3.5 Function block diagram of the sensor [14]
As illustrated in figure 3.5, light scattering can be induced when particles go through
the detecting area. The scattered light is transformed into electrical signals and these
signals will be amplified and processed. The number and diameter of particles can be
obtained by analysis because the signal waveform has certain relationship with the
particles diameter. To have the system work accurately, the sensor needs to have the
This sensor module has eight pins: GND, VCC, SET, RX, TX, RESET, PIN7 and PIN
8. According to the manual, PIN7 and PIN8 should never be connected. VCC pin should
connect to the 5V power supply. Ground pin should connect to the ground. The sensor
22
is in the working status when SET pin pull high. When SET pin is in low level, the
sensor is set to sleeping mode. When RESET pin goes low, the sensor will reset the
signal, so writing this pin high to ensure the working state is maintained. RX and TX
pins are connected with the Arduino’ UART port to transmit the data.
The PM2.5 data packet has 32 bytes; the first two data bytes, 0x42 and 0x4D, are two
fixed communication starting indicators. The 13th and 14th data bytes specify the value
of PM2.5 (the 13th is high 8 bits and the 14th is low 8 bits). In order to improve the
accuracy, we set the sensor to take 10 consecutive readings, excluding the highest and
lowest readings, and then we take the mean of the remaining 8 measurements.
The temperature and humidity measurements sensor module used in this system is AM
2302, it uses a capacitive humidity sensor and a thermistor to measure the surrounding
air. It provides the current temperature and humidity readings and give out digital
readings. The sensor includes a capacitive sensor wet components and a high precision
humidity, it is based on capacitive coupling that can detect and measure anything that
temperature measurements.
AM2302 sensor module has several good characteristics such as low power
consumption, long term stability, fast response, strong anti-interference ability. The
sensor communicate with the Arduino using a DHT library. This sensor is operated at
3.3V-5.5V. The temperature range is﹣40 ~ 80ºC, and the accuracy is ± 1ºC, response
time <10s. The humidity Accuracy ±2 %RH, and range is Range 0-99.9 %RH, response
time <5s. Three pins are used in this sensor module: DAT, VCC, and GND. As
illustrated in Figure 3.8, connect the sensor’s DAT pin to Arduino’s digital I/O pin, and
The FC-37 rain sensor module is used for rain detection. It is made with high quality
24
RF-04 double sided material and has good anti-oxidation and anti-conductivity features.
The sensor’s dimensions are 5cm×4cm, and it is operated at 5V. As shown in figure
3.9,the FC-37 rain sensor consists of two pieces: the electronic board and the collector
board that collects the water drops. There is an indicator light on the electronic board
to 2M ohms when dry. When the sensor is wet, the resistance increases, and the output
voltage decreases. When dry, the resistance is lower, and the output voltage is higher.
The FC-37 rain sensor use three pins to work. The sensors’ DO pin is connected to the
Arduino board’s digital IO pin to communicate. When sensor board has no rain drop,
DO pin output will be high, and indicator light will turn on. When rain sensor detects a
droplet of water, DO pin output is low, the indictor light will turn off.
25
3.4.4 Electrochemical gas sensor module
Electrochemical gas sensor is an analog sensor and gives the output into form of analog
signal. This signal is fed to ADC which will convert it into digital form. Once converted
into digital form, the microcontroller can process the digital gas signal as per the
application [9]. There are many types of electrochemical gas sensors available on the
market and can be used on the Arduino board. In addition to the two gas sensors (O2,
CO2) configured on this device, an extra type of electrochemical gas sensor can be
3.4.4.1 O2 sensor
This system used the GS Oxygen Sensor KE-50 (Figure 3.11). It is a unique galvanic
cell type oxygen sensor which was developed by the Japanese company FIGARO. This
sensor has 10 years life expectancy, excellent chemical durability, and most importantly
it is not influenced by CO2, CO, H2S, NOx, H2. The measurement range is 0-100 %,
oxygen cathode made of gold, and a weak acid electrolyte. Oxygen molecules enter the
26
electrochemical cell through a non-porous fluorine resin membrane and are reduced at
the gold electrode with the acid electrolyte. The current which flows between the
measured. The terminal voltages across the thermistor (for temperature compensation)
and resistor are read as a signal, with the change in output voltages representing the
The following chemical reactions which take place in KE sensors are shown [17]:
27
3.4.4.2 CO2 sensor module
The CO2 sensor module has an MG-811 on board. It has very good sensitivity, and long
stability. The MG-811 is highly sensitive to CO2 and less sensitive to alcohol and CO.
The sensor use solid electrolyte cell Principle. The components of the solid electrolyte
A single vertical line ( | ) is drawn between two chemical species that are in different
phases but in physical contact with each other (e.g., solid electrode | liquid with
When the sensor is exposed to CO2, the following electrodes reactions occurs:
28
This sensor module is operated at DC 6V, its measurement range is 0-10000 ppm. The
heating consumption is very large, it’s about 1200mW. The dimension of sensor is
40mm×25mm×35mm. Figure 3.15 shows how CO2 and O2 sensor modules are
The table 3.3 lists the types of electrochemical gas sensors that are compatible with this
device. Potential additional sensors include O3, CO, CH4, and SO2 sensors; SO2 and O3
are air pollutants linked with industrial activities, and CO sensors can be used to
monitor gas leakage in homes. These sensors can provide the device with more
Since the sensors listed all have a large power consumption and require a preheating
process, the dual power supply design enable any sensor chosen in the future operates
periodically. The working principles for these sensors are similar, so they can be easily
5V DC power supply
The output is an analog signal and can be digitized by the system’s AD Converter.
29
Table 3.3 Electrochemical gas sensors Table
4
Sensor Application Power Consumption Picture
Name
MQ-2 CH4 (Methane ≤900mW
gas)
30
3.5 Hardware schematic design
This section explains circuit components and schematic design procedures, along with
The device uses a dual power supply design. Two types of voltage regulators are used:
LM7805 and TPS73801. The LM7805 voltage regulator outputs 5 volts for the Arduino
board and all other 5V components that have low power consumption.
The two TPS73801 LDO (low-dropout regulator) are used to power electrochemical
gas sensors. These kinds of sensors have a very high power consumption, and the
TPS73801 LDO regulators are able to supply periodic power to reduce the cost. In
Because the gas sensors produce analog output, they connect to the AD converter circuit
31
before being read and processed by the microcontroller. The clock circuit serves the
functions of time keeping, synchronizing different parts of the circuit, and coordinating
The measurement results are displayed on the screen and also can be viewed on a host
computer. J8 port connects with Arduino’s UART (TXD3 and RXD3) and is used for
debugging and sending the measurements. A host computer’s USB can be connected to
design, we will use it to convert 12V to 5V. A heatsink is attached to the chip for
The LM7805 is a three-pin IC as the figure 3.18 shows. The maximum input voltage is
36V. The regulator will eventually regulate down to 5V. The Ground pin establishes the
32
ground for the regulator. The Output pin is the regulated 5 volts DC.
In figure 3.17, D1 allows current to flow only if the correct polarity is applied, so it
diode. F1 fuse is used to protect the circuit if too large a current flows through it. R1
A clean and stable voltage is very important both for input and output of the regulator.
Capacitors placed on the input side are used to filter out any noise coming from the
voltage source. Capacitors placed at the output of the voltage regulator are used to avoid
any ripples or noise imposed on the DC voltage line. A clean DC signal is very
regulator will also work better when a clean DC signal is fed into it.
Large electrolytic capacitors have good ability to filter out low frequency ripple and to
respond to abrupt voltage spikes and drops. A typical 10μF capacitor is chosen here.
However, large electrolytic capacitor itself is not enough to do the whole job. It is not
good at filtering higher frequency noise because electrolytic tend to have large internal
series resistance (ESR). The small capacitors with low ESR and low inductance is
33
therefore added in parallel to the large capacitor. The small capacitors have excellent
high frequency response, but cannot store enough energy to deal with the large load
in parallel to the ceramic capacitor in the circuit. The large electrolytic capacitor handles
low frequency ripple, and major output load changes; the small capacitor handles noise
and fast transients. The small capacitor used here is a non-polarized and multilayer
ceramic capacitor. The value of the small capacitor selected here is a 0.1μF, to ensure
Gas sensors like CO2, SO2, and O3 usually require a long time to warm up and have
34
very large power consumption. Depending on the different type of gas sensors, the
circuit using TPS73801 is designed here to provide voltage directly to the gas sensors.
The sensors work according to the interval that has been set. In addition, this circuit
also meets the need for a 6V input voltage for the CO2 module. There are two LDO
regulators. One is used for the fixed CO2 sensor. The other is used for an extra sensor
that can be added to the system in the future, to provide a more personal and flexible
device.
The TPS73801 is a LDO optimized for fast transient response. Many sensitive sensors
cannot tolerate voltage ripple and spikes. The TPS73801 regulators have very low
output noise, which makes them ideal for sensitive RF supply applications. Output
devices are available as an adjustable device with a 1.21-20V reference voltage. Other
equipment. [19]
35
The TPS73801 regulator has an EN pin to shutdown the output power supply. The
output is off when the EN pin is pulled low, and the output is on when the EN pin is
pulled high. This enable the gas sensor working periodically. Thus the overall power
consumption of the system are reduced. In addition, the TPS73801 can regulate the
output voltage with small dropout voltage and current ripple. Through this design, the
The TPS78301 has an adjustable output voltage range, the output voltage can range
from 1.21V to 20V. In order to provide 5V and 6V voltages for sensors, respectively,
we need to calculate the values of resistance used in the circuits. The output voltage is
set by the ratio of two external resistors as shown in figure 3.20. The device maintains
the voltage at the FB pin at 1.21V referenced to ground. The current in R1 is then equal
to 1.21V/R1, and the current in R2 is the current in R1 plus the FB pin bias current. The
FB pin bias current, 3uA flows through R2 into the FB pin. The output voltage can be
calculated using the formula shown in equation 1. The value of R1 should be less than
4.17 kΩ to minimize errors in the output voltage caused by the FB pin bias current. The
36
𝑅2
𝑉𝑜𝑢𝑡 = 1.21𝑉 (1 + 𝑅1) + 𝐼𝐹𝐵 × 𝑅2 (1)
For most type of gas sensors, the input voltage supply is 5V.
𝑅9
Set𝑉𝑜𝑢𝑡 = 5𝑉, according to the equation (1), 𝑉𝑜𝑢𝑡 = 1.21𝑉 (1 + 𝑅10) + 3𝜇𝐴 × 𝑅9
following: 1.21V(1 + R9/R10) ≈ 5V, then we get that R9/R10 ≈ 3.13 Choosing
the value of R9 and R10 based on the above calculation, as well as the availability on
In figure 3.19, the LED 2 and LED 3 are two light indicators, when the EN pin is in a
high state, the output is on and the LED will light up. R11 and R15 are used to limit the
current flow go through the LED. R12 and R16 are pull down resistors. C7 and C12 are
bypass capacitors, the value selected here is the recommended value from the datasheet.
37
An electrolytic capacitor is added in parallel to a ceramic capacitor on the output of the
Additionally, J1 and J2 test pins are only used when we test the chip. In the normal
working state, they are not connected. When we need to test or debug the device (e.g.
that EN pins will be in the high state, keeping the LED lights on. This reduces the work
needed to control the EN pin state by the microcontroller and the code needed to run it.
The clock circuit will provide the function of time keeping, the coordinating and
The DS1302 was chosen as the time keeping chip, which uses an external 32.768 kHz
crystal. The DS1302 trickle-charge timekeeping chip contains a built in real-time clock
and 31 bytes of static RAM. The real-time clock circuit provides information about
second, minute, hour, day, week, month, and year. It can also adjust for leap years or
38
months with fewer than 31 days.
Even though Arduino has a built-in oscillator, it only operates at a resonant frequency
at 16MHz. In addition, this Arduino built-in timekeeper only keeps track of time since
the Arduino board was last powered, if it lost power, the timer is set back to 0. The
DS1302 chip can drive timings and execution on a more precise scale as the 32.768
KHz clock frequency can get a precise 1 second period by dividing the frequency.
DS1302 also uses a battery powered real time clock when the device is turned off.
The DS1302 uses synchronous serial communication, only three wires are required to
communicate between the microcontroller and the clock chip: I/O (data line), and
This chip has a dual supply configuration. It can be operated either by battery or a 5V
power supply. VCC1, VCC2 are both power supply pins. VCC2 is the primary power
supply pin,while Vcc1 is connected to a battery to maintain the time and date in the
39
The DS 1302 will operate from the larger of Vcc1 or Vcc2. When Vcc2 is greater than
Vcc1+0.2V, Vcc2 will power the DS1302. When Vcc2 is less than Vcc1, Vcc1 will
power the DS1302. Based on the commonly used battery type on the market and the
recommend value from the datasheet, here the system uses a 3V button battery for the
SCLK pin is used to synchronize data movement on the serial interface. The X1 and
X2 pins are bridged with a standard 32.768 kHz Crystal. I/O pin is date input/output
pin, and the Reset pin will pull high during a read or a write.
Because the chips are extremely sensitive to voltage fluctuations, a 0.1μF Bypass
capacitor is placed right next to the chip power pin, to help filter the electrical noise out
of circuits. Typically, 0.1uF is used for most logic circuits. In this way, noise is shunted
through the capacitor, reducing the effect it has on the rest of the circuit. R2, R3, R4 are
all pull up resistors. Their selections were based on general recommendations from the
datasheet and previous experience. 1-10K is the typical value for pull up and pull down
resistors. They are used to ensure that the signal will be on a defined logic level if no
active devices are connected to it. Pull up resistor pulls the terminal to the voltage
supplied and pull down resistor pulls the terminal to the ground. The benefit of
including a pull up or pull down resistor is that it makes the circuitry susceptible to
noise, and the logic level (1 or 0) cannot be changed from a small variation in terms of
40
3.5.3 Analog to digital converter circuit
The Electrochemical gas sensors give out analog output and so they have to be
Even though the Arduino 2560 has an on board 10 bit ADC, an external ADC with 16
bits has been selected to digitize the analog signals for better resolution.
resolution. It has a gain amplifier which is able to magnify 16X the original signals. An
onboard programmable gain amplifier that offers input ranges from the supply to as low
as ±256mV, allowing both large and small signals to be measured with high resolution.
Data are transferred via an I2C serial interface. ADS 1115 is able to operate in a wide
range of power supply, from 2.0V~5.5V, so they are compatible with all common 3.3v
and 5v processors.
41
Figure 3.23 AD converter circuit Figure 24
Pull-up resistors are required for I2C interface. R7, R8 are all pull up resistors while
the R5 and R6 are pull down resistors. C6 is a 0.1μF bypass capacitor that placed right
interface. The master provides a clock signal on the SCL pin and data are transferred
via the SDA pin. The ADS1115 never drives the SCL pin. ADDR pin is used to set the
42
I2C address, the pin can be connected to ground, VDD, SDA or SCL, allowing four
with ADS1115’s AIN0, AIN1 and AIN2 pins. ALERT pin is not used in this system, it
is an output pin that can be either tied to ground or be left floating. In general, unused
input pins should be connected to ground; unused output pins can be left floating.
The basic structure of the Arduino programming language runs in three parts. The first
part includes importing required libraries, declaring variables and functions. The
second part is setup. The setup function runs only once and is used to perform
initialization steps, such as setting pin mode as input or output, initializing serial
43
communication, etc. The third part is loop function, this function is the core of
Figure 3.25 Flow chart for monitoring air quality parameters Figure 26
Figure 3.25 shows the flowchart of the process that will occur during the operation of
the device. The basic structure of the software running on the Arduino board is shown
as flowing:
1. The first step is initialization and setup. This process includes declaration of any
44
required variables, setting up and initializing all the pins. For example, declaring using
float to define humidity value, setting pinmode, initializing serial communication, and
2. The loop function follows next and includes the actions of sensors that to be executed
by the controller continuously. In the loop, data collection proceeds in the following
sequence: rain, temperature and humidity, CO2, O2, PM2.5. This is an infinite loop and
3. The measurement results are displayed on the OLED screen and sent to the serial
port.
4. We set a 30 seconds cycle for the microcontroller to take all the measurements. If the
time has not passed the 30 seconds cycle, there will be a delay. During the delay, only
the time is refreshed (at the rate of once per second) on the OLED screen and the serial
port.
In figure 3.25, Timershort and Timerlong are two delay indicators,which are used to
If Timershort is false, 1 second has not passed. The system has to delay 500ms before
checking the Timershort again. If Timershort is true, then Timerlong will be checked
next. If Timerlong is false, this means 30 seconds timeframe has not passed. The system
will perform three actions: system will print current time to serial port, the OLED
screen will be refreshed to show the new time,and Timershort is reset to false.
45
If Timerlong is true, the system will collect data from the rain、temperature and
sent to the serial port. After finishing all the collection, the system moves forward to
following actions: the OLED screen will refresh to the show the new results, and
Timerlong is set back to False, new time will be print to serial port. Then the system
Because we need to implement the time interrupt to perform a task at very specifically
This “Timerfun” timer interrupt function, has two increment counters count the number
second is up.
46
Table 3.7 Timer function code Table 8
#include <FlexiTimer2.h> // import library
// Define timershort and timerlong indicators
int timercountshort = 0; // short increment counter
int b_timershort = false; //
int timercountlong = 0;// long increment counter
int b_timerlong = false;
#define TIMESHORT 2
#define TIMELONG 60
void setup() {
……………
// set 500ms as timer intervals,
FlexiTimer2::set(500, timerfun);
// function start
FlexiTimer2::start();
……………
}
void loop(){
if(b_timershort==true) // if timershort is ture, 1 second is up
{
if(b_timerlong==true) // if timerlong is ture, 30 seconds is up
{
47
Measuring function() ;
print_time(); // serial port print time
draw();// 12864 OLED display
b_timerlong = false;
}
else
{
print_time(); // serial port print time
draw();// 12864 OLED display
}
b_timershort = false; // reset to false
}
}
These are the two outputs from the system: first, the system has a 2.4" OLED screen as
output; second, the system can output results to a host computer through serial
OLED stands for organic light emitting diode. The OLED technology is active meaning
that it is able to emit light unlike the LCD technology that is dependent on backlight
unit to create light. Light is emitted from the smaller OLED pixels with the help of a
very thin organic film layer [21]. A LCD (liquid-crystal display) does not emit light
uses a lot of energy as the screen requires an external backlight to light up the whole
display underneath.
Because OLEDs emit light, they do not require a backlight .When electrical current is
48
applied, a bright light is emitted. OLED technology only uses electricity per pixel
because each pixel creates its own light. Compared with a LCD screen, an OLED
display has many advantages such as more efficient, thinner, better image quality and
better durability.
The screen module consists of an OLED panel and a SSD 1309 driver. It has a black
background and displays characters in white. The dimension of the screen is 60.5×37
Four pins are used in this module: GND, VCC, SCL and SDA. The SCL and SDA pins
of this screen are connected to the Arduino’s SCL and SDA. The Screen is
The proposed system can output results to a host computer through a USB to UART
49
adaptor CP2102 (figure3.32). Through serial communication, the measurements can be
Figure 3.29 is a screenshot of a host computer showing that measurement results are
Power for the board can come via an AC-DC adapter, or battery. Figure 3.30 shows a
12V power adapter currently used on the device. A Plug-in screw terminal block
50
connector is used for power entry connection. Figure 3.32 is the end device prototype.
51
4. Experiment and results
This chapter will discuss experiments of various air parameters. Using these values as
input we can plot an air environmental condition chart of a particular area over time.
The device was placed outdoors and monitored temperature and humidity for a 12 hour
span from 9 AM to 9 PM on April 2nd. The results were read from the OLED screen.
Before taking the measurement, the device was given time to adjust to the outdoor
temperature because of the large temperature difference between the room temperature
and outside temperature that day. In the figure 4.1and figure 4.2, the green line
The red line represent the measured value. The graph illustrates the two value are very
close.
52
Figure 4.1Temperature measurement
Figure 34
The CO2 sensor module requires a pre-heat time before taking measurements. Because
of this, the device was powered on for about 2 hours before taking the first reading.
53
After the CO2 sensor was fully warmed up, the testing started. Both the O2 and CO2
measurements were taken simultaneously. The device was placed indoor and the whole
testing period was 12 hours from 10AM to 10PM. As can be seen from the figure 4.3,
the indoor CO2 concentrations were higher between 2PM and 7PM. The data shows
that the concentration reached a peak value of about 600 ppm at 5 PM. There might be
many factors leading to the increased value, such as the testing place being occupied
by more people or a home heating increase. As seen in the figure 4.4, the O2 content in
500
400
300
200
100
10:00 11:00 12:00 13:00 14:00 15:00 16:00 17:00 18:00 19:00 20:00 21:00 22:00
54
Figure 4.4 O2 measurement Figure 37
In Cleveland, the PM2.5 value is rarely above 100, but there are still some days in which
PM2.5 pollutants reach an unhealthy level. The figure below illustrates the PM2.5
pollutant value measured on March 25, 2017. The highest value was 105μg/m3 that day,
which would have respiratory effects on the sensitive population. During the
experiment, the device was placed indoors with an open window, the monitoring lasted
for 12 hours from 7 AM to 7 PM. The results were read every hour and a graphical chart
Compare figure 4.5 to a screenshot taken from Airnow on March 25th at 10:20 am. Both
measurements show a pollutant level that would be unhealthy to sensitive groups in the
greater Cleveland area (Orange colored area). The yellow color shows the suburbs of
Cleveland had a moderate pollutant level. Airnow provides air quality data with colors
55
PM2.5 (μg/m3) March 25
120
105
100
89
80
65 65 68
60
54 53
40 43
20
12 8 10 9 8
0
7:00 8:00 9:00 10:00 11:00 12:00 13:00 14:00 15:00 16:00 17:00 18:00 19:00
A test was run to illustrate the measurement capabilities of the PM 2.5 sensor. In the
series of images below, the PM 2.5 measurements is shown before, during, and after
smoke was blown into the sensor. Before adding smoke, the PM reading is 9, but once
the candle was lit and the smoke was blown into the device, the reading went to 107
and reached a peak of 287. The readings show the PM 2.5 levels decreasing as the air
56
was ventilated. The images show the reader decreasing to 64, but, ultimately, the PM
57
4.3 Rain sensor experiment
In the figure below, the rain sensor sensed a droplet of water and the weather indicator
changed from “sun” to “rain” on the OLED screen. The rain sensor has been included
for multiple short and long term reasons. Rain is understood to lower air toxicity levels,
there will soon be a decrease in pollutant levels. This would allow people to choose
safer times to go outside. In the long-term, analyzing these measurements can help
researchers understand the cause and effect relationships between all of the
58
5. Summary and future work
5.1 Summary
This project was a valuable experience in the design, implementation, and testing of
environmental air parameters. The design process also helped raise awareness of the
quality of air that one breathes daily. In general, the design fulfills its intended objective,
device.
The measurement results were satisfactory in some aspects: PM2.5, O2, temperature
and humidity measurements reflects a relatively accurate value. The CO2 sensor would
work better after calibration; lacking a professional calibration equipment and condition,
the measured value only reflects the approximated trend of gas concentration, it does
Over all, this portable system can give a real time measurement of 6 air parameters and
record the results for future long term air quality studies. Furthermore, its dual power
supply design and low consumption components make it more affordable for home
based users. The device is also designed in such a manner that it can have extended uses
in the future, by adding an extra sensor such as sensors for the measurement of the SO2
parameter or CO parameter.
59
5.2 Future work
There are some future improvements that could be made to this device, including the
robustness of the system, accuracy of the data produced by the sensors, wireless
failure or a low battery is detected. For example, the ADM 708 supervisory
circuit is one example of a circuit suitable for monitoring the power supply. It
can be connected to the power supply rails of CO2 gas sensors and
continuously monitor the voltage level. If the voltage drops below 6V, the
against overvoltage.
Adding ESD protection circuit. The SRV05-4 is recommended for its ability
2. The size of the device can be reduced by optimizing the hardware PCB layout
design.
3. The function of the system can be enhanced by adding a wireless network function.
60
For example, the device sit outside and the data gathered by sensors can be sent to
4. The system can be modified by building a solar powered module to achieve greater
levels of energy efficiency and reduce power consumption. Solar energy is the free
source to recharge a battery. As illustrated in figure 5.1, we can use a solar panel
to power the board and to charge a rechargeable battery (e.g. nickel metal hydride
61
Appendix
A. Project schematic
62
B. Print circuit board
63
Figure B.3 Completely assembled circuit board without attached external components.Figure
46
C. Project budget
The cost of this project was calculated based on materials and components spent on
64
Bibliography
[1] T. H. R. I. H. M. A. Ashish M. Husain, "Air Quality Monitoring: The Use of Arduino and
Android," Journal of Modern Science and Technology, vol. Vol 4, pp. Page 86-96, Sep.2016.
[2] "Air quality guide for particle pollution," U.S. EPA, 26 January 2016. [Online]. Available:
https://www.airnow.gov/index.cfm?action=pubs.aqguidepart.
http://www.stateair.net/web/post/1/1.html.
[4] A. P. J. C. P. &. I. B. A. Asmi, "A Study of Indoor Air Quality of Public Toilet in University's
[5] S. Taranovich, "Let’s clear the air: analog and power management of environmental sensor
[6] A. S. Berger, Embedded Systems Design: An Introduction to Processes, Tools and Techniques,
http://internetofthingsagenda.techtarget.com/definition/embedded-system.
https://www.arduino.cc/en/guide/introduction.
65
pp. 10904-10909, 2016.
[10] K. V. Koziy, "WIRELESS HEALTH MONITOR DESIGN," ProQuest LLC, Fargo, 2012.
https://www.co2meter.com/blogs/news/6010192-how-does-an-ndir-co2-sensor-work.
[12] A. Liberti, "Modern methods for air pollution monitoring," Pure and Applied Chemistry, vol.
[13] "Mantech electronics website," Mantech Electronics (Pty) Ltd., [Online]. Available:
http://www.mantech.co.za/datasheets/products/A000047.pdf.
http://www.plantower.com/en/content/?106.html.
p. 389.
[16] X. Li, "Miniaturized particulate matter sensor for portable air quality monitoring devices," in
http://www.figaro.co.jp/en/product/docs/KE_Product%20Infomation_rev02.pdf.
http://sandboxelectronics.com/files/SEN-000007/MG811.pdf.
http://www.ti.com/lit/ds/symlink/tps73801.pdf.
66
[21] Z. Š. Srećko Kunić, "OLED Technology and Displays," in 54th International Symposium
http://makerpot.com/articles/Pull-Up-and-Pul-Down-resistor/.
67