Introduction: IoT Based Toxic Gas Monitoring
People working in sewers and underground mines or other mining industries often have respiratory disorders due to the type of air present in the working atmosphere. For example, In my country the workers often have to enter manholes or sewers to clean them. The cleaning machines are available but sometimes they fail. Sometime deadly gases like CO or inflammable gases like H2,CH4, LPG may be present. These could be fatal for the person entering such areas.
In such cases where humans have to enter hazardous environment safety comes first.
This system can also be used for monitoring Indoor Air Quality.
So, here in my instructable I have proposed a simple system which can be used to monitor the gases present inside such hazardous working areas so that you know whether to enter the area or not or taking precautions while entering.
The system is IoT based i.e it is linked to a cloud server where we can see the gas sensor readings.
Please go to the next step for hardware implementation.
Please Vote for my instructable in the Sensors contest if you like it!
Step 1: Implementation Using Hardware
The main processing part of this project is done by MediaTek LinkIt ONE Board. It has got on board WiFi which makes it suitable for this project.
The Mediatek LinkIt ONE board is connected with gas sensors namely Grove LPG sensor and Grove Air Quality Sensor. The sensor readings will be sent to the Ubidots could server.
In the pictures you can see some more gas sensors like MQ-7, MQ-135 and MQ-138.
But the LinkIt ONE board has only 3 analog pins. A0,A1 and A2 so a maximum of 3 sensors can be interfaced.
As the output of the gas sensors is analog voltage and our board is a digital system (microcontroller).
We need to convert the analog voltage into digital values. This can be done by using the on board 10-bit ADC.
More on ADC and gas sensors is explained later.
Step 2: ADC-Analog to Digital Conversion
ADC stands for Analog to Digital conversion and the device which performs the conversion is called as an Analog to digital converter.
The most widely used ADC chips are the ADC0804 and ADC0808 from Texas Instruments.
Why do we need ADCs?
The world which we live in is analog i.e each and every thing is continuous in time. Be it the sound or light.
In order to make these analog signals compatible with digital devices like micro controllers which can only understand digital signals i.e. '0's and '1's.
So in order to convert our analog signals into digital form we need to use ADCs.
How is A/D conversion performed?
There are two steps involved in converting an analog signal into digital form-
Sampling means to divide the signal into small time slots. For example if we have a sine wave of a certain frequency which is continuous in time domain we will sample it i.e we will take the amplitude values of the sine wave at certain equal intervals of time and hence it will look somewhat like shown in the pictures.
The second step is to quantize the amplitude values obtained. As while sampling, the amplitudes which are taken can be of any irrational value such as pi(22/7) or 1.33333 or sq.root(2), etc.
These values will never terminate and hence will require infinite amount of memory if you want to store them in a digital device.
So we need to round off the numbers to the nearest place.
This finishes the A/D conversion part.
But this was just the theory?
How to perform ADC practically?
The answer is by using ICs like the ADC0804 or ADC0808.
The recent micro controllers like Arduino, AVR series, LinkIt ONE have on board ADC which we will be using in our project.
Step 3: Using the LinkIt ONE on Board ADC
The LinkIt ONE board has 3 analog input pins which means up to 3 analog devices can be interfaced with the board.
Also the term resolution of ADC is important.
The on board ADC has got a 10-bit resolution which means the the input analog voltage will be represented as values ranging from 0-1023 i.e., total 1024 values
How to get this?
It's easy. 10-bit ADC means we will have 10 bits in the digital value obtained. i.e.,2^10=1024 values.
In decimal range it will be 0 to 1023.
How does it assign digital values?
For analog input voltage of 0V we will get the corresponding digital value as 0.
For the max. analog input voltage i.e.,5V we will get the max digital value i.e, 1023.
And any analog input voltage in between 0V - 5V will have digital values in between 0 to 1023.
Here's the formula
ADC reading = (1024*Analog input voltage) / 5
So, as you can see for 0V you'll get ) as the ADC reading and for 5V you will get 1024(actually 1023 because counting starts from 0 here.)
Step 4: Gas Sensors: How Do They Work?
Gas sensors are available in various types. They are classified according to the way they detect the gases present in the atmosphere.
The MQ sensor series falls into this category of gas sensors. These gas sensors have a sensing element usually made of SnO2 or Tin(IV) Oxide which is the correct IUPAC name (International Union for Pure and Applied Chemistry) or commonly called as stannic oxide (no it's not satan-ic).
The SnO2 layer is coated on a ceramic base such usually made up of Aluminium Oxide(Al2O3).
The phenomenon which takes place here is called as adsorption and it is very much different from absorption.
Adsorption is a surface phenomena which means that the molecules of the gas accumulate only on the surface of the SnO2 layer.
To increase the rate of adsorption we need to heat the element. This is done by the heating coil( wired mesh) present on the MQ gas sensors.
Heating increases the rate of adsorption. There is a specific pre-heating time for each sensor before it can be used.
As the gas molecules start accumulating onto the surface we get a voltage proportional to the concentration as the output.
This is the voltage we are going to measure to detect the gas.
Now due to adsorption i.e., molecules getting accumulated on the sensing element of the sensor these sensors become useless after few months and need to be replaced with new ones. You cannot clean the sensors are everything takes place at a molecular level.
These are the most widely used and available sensors for electronics hobbyists.
Apart from these we have four other types
Now if you see any MQ gas sensor will have 6 pins out of which 4 are used for heating purpose and other 2 are for output voltage and ground.
In the pictures you can see the 6 pins of an MQ-8 gas sensor.
The second picture shows a MQ-8 gas sensor which is highly sensitive to H2. It can be used for LPG detection also.
For your reference I have attached the datasheet of the same. It is clear from the datasheet that many types of gases can be detected using a single MQ-8 sensor.
Before going further I would recommend you to read these two articles on How do gas sensors work and How to choose a gas sensor by Engineer's garage and Seeed Studio respectively.
Step 5: Hardware Requirements
Mediatek LinkIt ONE Board
Grove Air Quality sensor
Grove LPG Sensor
Step 6: Registering on Ubidots
The first step is to create a Ubidots account which is free of cost!!
Ubidots is the cloud service provider we are going to use.
You are free to use any other service.
The code will change if you're going to use some other service.
Go to http://www.ubidots.com
Register on the website.
Then follow the instructions given in the pictures.
Or follow these-
1)Register on Ubidots
2)In the top right corner click on + symbol to add new source.
3)Name your source such as Intel Edison, Arduino, etc.
4)Click on source to add new variable
5)Select the type of variable as gauge and set the min and max limits
6)Note down the variable id of each variable created.
7)Now go to your profile and in API keys note down the token id.
Please note that the pictures are from some other project of mine. everything remains the same just you need to give different names and select the display type accordingly.
Note down the variable id and auth. token numbers. You will have to type them in your program.
Everyone will have different numbers for both. Don't copy from the images.
Step 7: Transmitter
The Grove LPG sensor is connected to pin A0 and Grove Air Quality sensor is connected to the pin A1 of the Mediatek LinkIt ONE board
The function analogRead() performs the necessary analog to digital conversion.
The digital values obtained are between 0-1023(total 1024) because the resolution of ADC is 10-bit.
The reading obtained from the sensor is converted into percentage(%) using the formula-
reading % = (ADC reading/1024)*100
The program for the transmitter is written in Arduino IDE and the .ino file is attached.
Remember to make the following changes in the code.
1)WiFi AP name
And then upload the code to your board.
Step 8: Testing
Here's a small video recording of my ubidots screen which shows you that how the gauge readings vary when any of the sensor values changes.
For the demo purpose I connected the A0 and A1 pins directly to 3.3V and 5V pins on the board. So that I can get deflections in the gauge.
Hope you liked my instructable!
Comment below if you need any help related to this project or any help with Electronics!
Note:You can also see these values on the Arduino serial monitor as long as the board is connected via USB to the computer. Once you remove USB and use battery to power it will not print values in the serial monitor.
Participated in the
Sensors Contest 2016