Gas
Gas
Gas
This project aims at providing smart solutions to monitor poisonous sewage gases and
works on a system of live sewage level detection and monitoring. Whenever, a certain
threshold is crossed, an alert is sent to the observer who is examining the conditions
from a remote location. The information is then forwarded along with different gas ppm
values indicating whether it is safe for the worker to clean or work in that environment
or not. The remotely placed IoT monitoring equipment and IoT platform are integrated
to create proposed system. This requires calibration of gas sensors for industrial
purposes and determining the correct threshold levels for septic plants and facilities.
The hardware is designed such that it shall send a prior alert to the sewage worker to
ensure their safety, if damaging gaseous constituents increase in concentration over
time. Various types of sensors are utilized to monitor parameters present in sewage like
gas, temperature etc. When the threshold value is lesser than the sensed values, this
system alerts the sewage worker/cleaner by sending SMS and call alerts by analyzing
concentrations of different toxic gases and graphing out their results for real-time
monitoring thereby aiding in protection from hazardous diseases and hence serves a
social cause as well. In the proposed system, sample values for sensors have been
recorded and plotted on
ThingSpeak analysis tool. Carbon monoxide and methane sensors charted values up-to
2.3 and 60 ppm respectively, and this breached threshold and WIFI module was utilized
for sending alert to mobile number fed in the code.
CHAPTER-1
1.1 INTRODUCTION TO EMBEDDED SYSTEM
An embedded system is a special-purpose computer system designed to perform one
or a few dedicated functions, sometimes with real-time computing constraints. It is usually
embedded as part of a complete device including hardware and mechanical parts. In contrast,
a general-purpose computer, such as a personal computer, can do many different tasks
depending on programming. Embedded systems have become very important today as they
control many of the common devices we use. Since the embedded system is dedicated to
specific tasks, design engineers can optimize it, reducing the size and cost of the product, or
increasing the reliability and performance. Some embedded systems are mass-produced,
benefiting from economies of scale.
Physically embedded systems range from portable devices such as digital watches and
MP3 players, to large stationary installations like traffic lights, factory controllers, or the
systems controlling nuclear power plants. In general, "embedded system" is not an exactly
defined term, as many systems have some element of programmability. For example,
Handheld computers share some elements with embedded systems — such as the operating
systems and microprocessors which power them — but are not truly embedded systems,
because they allow different applications to be loaded and peripherals to be connected.
Certain operating systems or language platforms are tailored for the embedded market,
such as Embedded Java and Windows XP Embedded. However, some low-end consumer
products use very inexpensive microprocessors and limited storage, with the application and
operating system both part of a single program. The program is written permanently into the
system's memory in this case, rather than being loaded into RAM (random access memory),
as programs on a personal computer.
In recent days, you are showered with variety of information about these embedded
controllers in many places. All kinds of magazines and journals regularly dish out details
about latest technologies, new devices; fast applications which make you believe that your
basic survival is controlled by these embedded products. Now you can agree to the fact that
these embedded products have successfully invaded into our world. You must be wondering
about these embedded controllers or systems.
The computer you use to compose your mails, or create a document or analyze the
database is known as the standard desktop computer. These desktop computers are
manufactured to serve many purposes and applications.
You need to install the relevant software to get the required processing facility. So,
these desktop computers can do many things. In contrast, embedded controllers carryout a
specific work for which they are designed. Most of the time, engineers design these
embedded controllers with a specific goal in mind. So these controllers cannot be used in any
other place.
In an Embedded system, there is only one application software that is typically burned
into ROM. An x86 PC contains or is connected to various embedded products such as
keyboard, printer, modem, disk controller, sound card, CD-ROM drives, mouse, and so on.
Each one of these peripherals has a Microcontroller inside it that performs only one task. For
example, inside every mouse there is a Microcontroller to perform the task of finding the
mouse position and sending it to the PC.
CHAPTER-2
2.1 INTRODUCTION
Sewage environment IoT device and IoT platform to monitor poisonous gas has been
proposed as a solution to help the sewer workers who put their lives risk. Because of these
poisonous gases, the death rate of sewer workers has increased in the recent years. The lack of
treatment of sewage after crossing dangerous levels leads to the deaths of thousands of
sewage cleaners throughout the year from accidents and various diseases such as hepatitis and
typhoid that occur due to sudden or sustained exposure to hazardous gases. Septic tanks are
devices which are found commonly in different types of localities, ranging from residential
areas to largely developed industrial areas to provide solutions for treatment of sewage
wastes. Sewage gases generally arise from the natural decomposition of sewage and their
mixtures formed by slurries which leads to the production of toxic wastes that release
hazardous gases. These gases can be lethal if inhaled in high concentrations or for a
prolonged period of time. Septic tank gases are primarily constituted of methane, carbon
dioxide, ammonia, hydrogen sulphide and traces of carbon monoxide. In order to evaluate the
gases which are present in sewage environment, sensors have been used to analyse the
amount of hazardous gas and send an alert. The hazardous gases like hydrogen sulphide,
methane and carbon monoxide emitted from sewage are sensed by gas sensors every moment
and updated when it surpasses the normal grade. The project aims at designing a prototype for
monitoring a sewage plant or septic tank in real-time for keeping a check on concentration
levels of gases.
The designed system can be installed in various sewage facilities, both rural and
urban. The system can be made to work properly in both domestic as well as industrial plants,
by changing small specifications of design. For accessing the ppm concentrations, an user-
friendly android application was developed with multiple facilities integrated. The death rate
of sewage workers has been increased day by day.
Even by such understated estimates, the NCSK identified 817 sewer workers’ deaths
since 1993 from 20 states. By official estimates, Tamil Nadu recorded 210 deaths, Gujarat
recorded 156, followed by UP and Haryana with 77 and 70 deaths, respectively.
Reason for the deaths include: 1. Forcing the workers by the supervisors 2.
Unawareness about the poisonous gases present in sewage system.
In this proposed system we have MQ4 gas sensor (consist of methane, carbon
monoxide and hydrogen sulphide) which is used to detect harmful gases present in the
sewage. Different nodal locations are provided to a single receiver end. The gas sensor
produces values(ppm) which are emitted from sewage to the kit. Depending on a set of
conditions, the output obtained by the gas sensor is transmitted via the WIFI module to the
cloud. In this project we have used ThinkSpeak cloud to store the values.
CHAPTER 3
HARDWARE COMPONENTS
1Kbytes EEPROM
One 16-bit Timer/Counter with separate prescaler, compare mode, and capture mode
Temperature measurement
Six sleep modes: Idle, ADC noise reduction, power-save, power-down, standby, and extended standby
I/O and packages
range:
Speed grade: 0 to 8MHz at 2.7 to 5.5V (automotive temperature range: –40°C to +125°C)
The AVR® core combines a rich instruction set with 32 general purpose working
registers. All the 32 registers are directly connected to the arithmetic logic unit (ALU),
allowing two independent registers to be accessed in one single instruction executed in one
clock cycle. The resulting architecture is more code efficient while achieving throughputs up
to ten times faster than conventional CISC microcontrollers. The Atmel® ATmega328P
provides the following features: 32K bytes of in-system programmable flash with read-while-
write capabilities, 1K bytes EEPROM, 2K bytes SRAM, 23 general purpose I/O lines, 32
general purpose working registers, three flexible Timer/Counters with compare modes,
internal and external interrupts, a serial programmable USART, a byteoriented 2-wire serial
interface, an SPI serial port, a 6-channel 10-bit ADC (8 channels in TQFP and QFN/MLF
packages), a programmable watchdog timer with internal oscillator, and five software
selectable power saving modes. The idle mode stops the CPU while allowing the SRAM,
Timer/Counters, USART, 2-wire serial interface, SPI port, and interrupt system to continue
functioning. The power-down mode saves the register contents but freezes the oscillator,
disabling all other chip functions until the next interrupt or hardware reset. In power-save
mode, the asynchronous timer continues to run, allowing the user to maintain a timer base
while the rest of the device is sleeping. The ADC noise reduction mode stops the CPU and all
I/O modules except asynchronous timer and ADC, to minimize switching noise during ADC
conversions. In standby mode, the crystal/resonator oscillator is running while the rest of the
device is sleeping. This allows very fast start-up combined with low power consumption. The
device is manufactured using Atmel high density non-volatile memory technology. The on-
chip ISP flash allows the program memory to be reprogrammed in-system through an SPI
serial interface, by a conventional non-volatile memory programmer, or by an on-chip boot
program running on the AVR core. The boot program can use any interface to download the
application program in the application flash memory. Software in the boot flash section will
continue to run while the application flash section is updated, providing true read-while-write
operation. By combining an 8-bit RISC CPU with in-system self-programmable flash on a
monolithic chip, the Atmel ATmega328P is a powerful microcontroller that provides a highly
flexible and cost effective solution to many embedded control applications. The ATmega328P
AVR is supported with a full suite of program and system development tools including: C
compilers, macro assemblers, program debugger/simulators, in-circuit emulators, and
evaluation kits.
Specifications
To use the Sensor Module, you have power the device with 5V supply and the
Power LED will start to glow. You should give it some time for its preheating period
before start reading the output. While measuring the gas present, the Output LED will
glow in a specific concentration of the gas. You can change it by using the potentiometer.
Else you can also use the Analog Output to see how your program reacts to different
concentrations of gases present.
DESCRIPTION
To use the Sensor Module, you have power the device with 5V supply and the Power
LED will start to glow. To power it, you can use external supply or connect +5V and GND
pin of Arduino. You should give it some preheating time before start reading the output.
While measuring the gas present, the Output LED will glow in a specific concentration of
the gas. You can change it by using the potentiometer. Else you can also use the Analog
Output to see how your program reacts to different concentrations of gases present.
The ESP8266 ESP-01 is a Wi-Fi module that allows microcontrollers access to a Wi-Fi
network. This module is a self-contained SOC (System On a Chip) that doesn’t necessarily
need a microcontroller to manipulate inputs and outputs as you would normally do with an
Arduino, for example, because the ESP-01 acts as a small computer. Depending on the
version of the ESP8266, it is possible to have up to 9 GPIOs (General Purpose Input Output).
Thus, we can give a microcontroller internet access like the Wi-Fi shield does to the Arduino,
or we can simply program the ESP8266 to not only have access to a Wi-Fi network, but to act
as a microcontroller as well. This makes the ESP8266 very versatile, and it can save you
some money and space in your projects.
A model described here is for its low price and great possibilities most frequently used
in practice. It is based on the HD44780 microcontroller (Hitachi) and can display messages in
two lines with 16 characters each. It displays all the alphabets, Greek letters, punctuation
marks, mathematical symbols etc. In addition, it is possible to display symbols that user
makes up on its own. Automatic shifting message on display (shift left and right), appearance
of the pointer, backlight etc. are considered as useful characteristics.
PINS FUNCTIONS
There are pins along one side of the small printed board used for connection to the
microcontroller. There are total of 14 pins marked with numbers (16 in case the background
light is built in). Their function is described in the table below:
Function Pin Name Logic Description
Number State
Ground 1 Vss - 0V
9 D2 0/1 Bit 2
10 D3 0/1 Bit 3
11 D4 0/1 Bit 4
12 D5 0/1 Bit 5
13 D6 0/1 Bit 6
14 D7 0/1 Bit 7 MSB
Over the years Arduino has been the brain of thousands of projects, from everyday
objects to complex scientific instruments. A worldwide community of makers - students,
hobbyists, artists, programmers, and professionals - has gathered around this open-source
platform, their contributions have added up to an incredible amount of accessible knowledge
that can be of great help to novices and experts alike.
Arduino was born at the Ivrea Interaction Design Institute as an easy tool for fast
prototyping, aimed at students without a background in electronics and programming. As
soon as it reached a wider community, the Arduino board started changing to adapt to new
needs and challenges, differentiating its offer from simple 8-bit boards to products for IoT
applications, wearable, 3D printing, and embedded environments. All Arduino boards are
completely open-source, empowering users to build them independently and eventually adapt
them to their particular needs. The software, too, is open-source, and it is growing through the
contributions of users worldwide.
Why Arduino?
Thanks to its simple and accessible user experience, Arduino has been used in thousands of
different projects and applications. The Arduino software is easy-to-use for beginners, yet
flexible enough for advanced users. It runs on Mac, Windows, and Linux. Teachers and
students use it to build low cost scientific instruments, to prove chemistry and physics
principles, or to get started with programming and robotics. Designers and architects build
interactive prototypes, musicians and artists use it for installations and to experiment with
new musical instruments. Makers, of course, use it to build many of the projects exhibited at
the Maker Faire, for example. Arduino is a key tool to learn new things. Anyone - children,
hobbyists, artists, programmers - can start tinkering just following the step by step
instructions of a kit, or sharing ideas online with other members of the Arduino community.
There are many other microcontrollers and microcontroller platforms available for
physical computing. Parallax Basic Stamp, Netmedia's BX-24, Phidgets, MIT's Handyboard,
and many others offer similar functionality. All of these tools take the messy details of
microcontroller programming and wrap it up in an easy-to-use package. Arduino also
simplifies the process of working with microcontrollers, but it offers some advantage for
teachers, students, and interested amateurs over other systems:
breadboard version of the module in order to understand how it works and save money.
CHAPTER-5
5.1 INTERNET OF THINGS
The Internet of Things(IoT) is a system of ‘connected things’. The things
generally comprise of an embedded operating system and an ability to communicate
with the internet or with the neighbouring things. One of the key elements of a generic
IoT system that bridges the various ‘things’ is an IoT service. An interesting implication
from the ‘things’ comprising the IoT systems is that the things by themselves cannot do
anything. At a bare minimum, they should have an ability to connect to other ‘things’.
But the real power of IoT is harnessed when the things connect to a ‘service’ either
directly or via other ‘things’. In such systems, the service plays the role of an invisible
manager by providing capabilities ranging from simple data collection and monitoring to
complex data analytics. The below diagram illustrates where an IoT service fits in an
IoT ecosystem:
One such IoT application platform that offers a wide variety of analysis,
monitoring and counter- action capabilities is ‘ThingSpeak’. Let us consider
ThingSpeak in detail.
5.2 What is ThingSpeak
ThingSpeak is a platform providing various services exclusively targeted for
building IoT applications. It offers the capabilities of real-time data collection,
visualizing the collected data in the form of charts, ability to create plugins and apps for
collaborating with web services, social network and other APIs. We will consider each of
these features in detail below.
The core element of ThingSpeak is a ‘ThingSpeak Channel’. A channel stores the
data that we send to ThingSpeak and comprises of the below elements:
• 8 fields for storing data of any type - These can be used to store the data from a sensor or
from an embedded device.
• 3 location fields - Can be used to store the latitude, longitude and the elevation.
These are very useful for tracking a moving device.
• 1 status field - A short message to describe the data stored in the channel.
You can change the name to fit your need and you can add a description corresponding
to the channel. You can add any other useful description into the metadata field. In the
same page, you should see the fields for Latitude, Longitude and Elevation. Also, when
you scroll down you should see a check box that says ‘Make Public?’. Let us consider
the significance of the various fields and the tabs:
• Latitude, longitude and elevation - These fields correspond to the location of a ‘thing’
and are especially significant for moving things.
• Make Public? - If the channel is made public, anyone can view the channel's data feed
and the corresponding charts. If this check box is not checked, the channel is private,
which means for every read or write operation, the user has to pass a corresponding API
key.
• URL - This can be the URL of your blog or website and if specified, will appear on the
public view of the channel.
• Video ID - This is the ID corresponding to your YouTube or Vimeo ID. If specified, the
video appears on the public view of the channel.
• Fields 1 to 8 - These are the fields which correspond to the data sent by a sensor or a
‘thing’. A field has to be added before it can be used to store data. By default, Field 1 is
added. In case you try posting to fields that you have not added, your request will still be
successful, but you will not be able to see the field in the charts and the corresponding
data. You can click on the small box before the ‘add field’ text corresponding to each
field to add it. Once you click the ‘add field’ box, a default label name appears in the text
box corresponding to each field and the ‘add field’ text changes to ‘remove field’. You
can edit the field text that appears by default when a field is added to make more sense.
For example, in the below screen, I have modified the text for Field 2 to ‘SensorInput’.
To remove a field which is added, just check on the ‘remove field’ box. Once you click
this, the text ‘remove field’ changes back to ‘add field’ and the corresponding field text
is cleared.
Once you have edited the fields, click on ‘Save Channel’ button. You should now see
a page like the below in which the ‘Private View’ tab is defaulted:
The Private View shows a chart corresponding to each of the fields that we have added.
Now click on the ‘Public View’ tab. This should look exactly similar to the what we see in
the ‘Private View’ tab since our channel is public. In case your channel is not public('make
public' check box not checked in the ‘channel settings’ tab), the public view tab shows a
message that
‘This channel is not public’.
Now click on the ‘API Keys’ tab. You should see a screen similar to the below. The
write API key is used for sending data to the channel and the read API key(s) is used to read
the channel data.
When we create a channel, by default, a write API key is generated. We generate read
API keys by clicking the ‘Generate New Read API Key’ button under this tab.You can also add
a note corresponding to each of the read API keys.
Note: Please note that clicking on the ‘Generate New Write API Key’ will over-
write the previous key. You will only have one Write API key at any point of time. Also, in
case your channel is private, others can only view the channel’s feed and charts by using a
Read API key. Please share the Read API keys with people who are approved and
authorized to view your channel.
Now click on the ‘Data Import/Export’ tab and you should see a screen similar to
the below. This tab is used to import the ‘Comma Separated Values(CSV)’ data from a file
into the channel. You can also download the channel’s feed from here in CSV format. This
tab also outlines how to send and view data by providing the URIs to the send and view
APIs.
After a series of updates, the charts in the private view tab for each of the fields will look like
the below:
Each of the dots correspond to the value and the time at which the value was posted to
the channel. Place the mouse over a dot to get more details on the exact date and the
GMT offset from which the value was posted.
Please note that in the above example, I have sent some sample values to the channel. You can
send any data here, say the periodic readings from a temperature sensor or RPM values from a
motor. The Y-axis show the names that we specified to each of the labels. I have used Internet
Explorer 11 to run this example. After running this, to check whether the feed got updated,
run the below URL:
http://api.thingspeak.com/channels/YOUR_CHANNEL_ID/feed.json?key=YOUR_KEY&lo
cation=tru e
NOTE: As mentioned above, you have to replace YOUR_KEY with your write API key and
replace YOUR_CHANNEL_ID with the ID corresponding to your channel. Also, if you
invoke the above URL without specifying location=true, you will not be able to see the
latitude, longitude and altitude fields.
The below is a screen after running the above URL after updating my location details for
few times:
One of the key elements of an IoT system is an IoT service. ThingSpeak is one such
application platform offering a wide variety of features. At the heart of ThingSpeak is a
channel which can be used for storing and processing data collected from the ‘things’.
ThingSpeak also provides various apps for integration with web services, other APIs and
social networks and provides the capability to create the applications as plugins. It is a
great platform with extensive possibilities to explore the integration of the Internet of
Things.
CHAPTER-6
6.1 SCHEMATIC DIAGRAM
Figure below shows the system methodology which includes Arduino UNO where
simulation of sensors, Software and tracking is done on this microcontroller.
Calibrating the sensors: MQ series sensors consist small heater with an electro-chemical
sensor in order to measure different kind of gases combinations. It is recommended to calibrate
the detector for 5000 ppm of gas concentration and use value of Load resistance (RL) about
20KΩ. The sensor itself yields an analog voltage which is transferred using an ADC. The values
transferred can be used for designing to get the ppm values of the gas. Connecting WIFI Module
to Arduino: It creates a serial communication between Arduino and WIFI module. Hence, the
serial pins of Arduino (Rx and Tx) and WIFI is done by connecting Rx pin of WIFI module to Tx
pin of Arduino and Tx pin of WIFI module to Rx pin of Arduino.
ThingSpeak IOT platform uses channels to store data sent from devices. By altering the
settings in Channel configuration, and creation of a channel is done, and then data is sent to and
from to the channel and retrieved in the same way. Channels are made public to share data. Is
done by connecting MQTT publish method which can be also used to update the channel feed
and the MQTT subscriber to receive messages. Sending the readings to ThingSpeak server and
analyzing graphs using MATLAB in ThingSpeak- ThingSpeak IoT platform is an open source
with incorporate Wi-Fi chip. In the proposed design, it is used to take readings from sensors and
upload the value of ppm concentration of gas on the cloud using WIFI that using HTTP.
6.2 CONCLUSION:
Septic tanks are a method to check on hazardous release of gaseous components into the
environment in areas inclusive of both residential and industrial premises. Sewage, on
natural decomposition, often leads to production of toxic gases. These gases can be
poisonous if inhaled for a long period of time and may lead to chronic illnesses in work
force, if it is introduced in the body in high concentrations. Septic tank gases contain
sulphur dioxide, hydrogen sulphide (H2S), methane, ammonia, nitrogen dioxide, carbon
dioxide and traces of carbon monoxide. These toxic gases thus become dangerous
especially for sewage workers and cleaners and sometimes lead to their death. Therefore,
to prevent exposure to such workplace hazards, an IOT based monitoring system was
proposed and designed which monitored their levels and analyzed the quantities present in
the environment. In this project carbon monoxide gas was sensed using sensor module MQ-
7 and methane gas using sensor module MQ-4.