Atmospheric Gas Analyser

by hariramanil810 in Workshop > Energy

33 Views, 0 Favorites, 0 Comments

Atmospheric Gas Analyser

Screenshot (630).png

This is a simple atmospheric Gas Analyser Using Arduino

Supplies

Screenshot (635).png
Screenshot (639).png
Screenshot (630).png
Screenshot (631).png

If you have hard-time 3d printing stuff and other materials which i have provided in this project please refer the professionals for the help, JLCPCB is one of the best company from shenzhen china they provide, PCB manufacturing, PCBA and 3D printing services to people in need, they provide good quality products in all sectors

Please use the following link to register an account in JLCPCB

jlcpcb.com/RNA


Pcb Manufacturing

----------

2 layers

4 layers

6 layers

jlcpcb.com/RNA

PCBA Services

JLCPCB have 350k+ Components In-stock. You don’t have to worry about parts sourcing, this helps you to save time and hassle, also keeps your costs down.

Moreover, you can pre-order parts and hold the inventory at JLCPCB, giving you peace-of-mind that you won't run into any last minute part shortages. jlcpcb.com/RNA


3d printing

-------------------

SLA -- MJF --SLM -- FDM -- & SLS. easy order and fast shipping makes JLCPCB better companion among other manufactures try out JLCPCB 3D Printing servies

JLCPCB 3D Printing starts at $1 &Get $54 Coupons for new users


This Is An AtmosphericGasAnanlyser Using MQ Series Sensors, Dht-11 Sensor & Arduino The Basic Idea Is To Precisely Measure Data Using Sensors Analog Read & Display It In I2CLcd, Here The Sensors Can Give Values Of LPG, CNG, HYDROGEN, AIR-QUALITY This Project Can Be Used To Collect Sensor Readings For FutureResearchProcesses. If You Need You Can Simply Add An SD Card To Store The Data As String And Collect The Readings, Here For Simplicity & SpaceReduction Iam Using Arduino Nano And I2ClCD Display, For My Ease. The Sensors Spit Out Aanalog Readings And I Have Converted It Into Useful PPM Values Of The Sensors analogToPPM(analogRead(The Sensor)). It Is Very Useful So I Have Converted It To PPM,

Wiring.

Screenshot (632).png
Screenshot (634).png
Screenshot (637).png
Screenshot (638).png

Connecting the hardware and Reading the analog value is easy, but the most difficult thing is to calibrate the sensors and calculating the ppm(parts per million) value for a specific gas. After searching for a long time on the internet, I find a library for those sensors. And comparing the calculation with the datasheet of the sensors, it seems promising.

Here I found an article that explains the working and the calculation for an MQ sensor- UNDERSTANDING A GAS SENSOR.

I use the library and write a code to use six of those sensors with an Arduino nano and show different gas concentrations on air.

You can find the library here - MQUnifiedsensor library

Fixing

Screenshot (633).png
Screenshot (636).png
Screenshot (641).png

For coding, first of all, I include the LiquidCrystal_I2C and MQUnifiedsensor library and then define the display parameter and the Input PIN for the sensors. Then in the setup section, I initialize the display and the sensors and set the R0 value for every sensor. You have to calibrate your sensors to find this R0 value. For that, uncomment a section in the setup function and upload the code to your Arduino with the pre-burned sensor connected. Then you will find the R0 value for every sensor in the serial monitor. Note the values and change them in the setup function. It is recommended that calibrate the sensors once in a clean environment and set the R0 value. The part to uncomment is indicated in the code.

And in the loop function, I set the A and B values for the exponential equation for different gases. Here A and B value is for PPM = A*ratio^B. Those values are different for different gas in different sensors.

After that, I display the gas concentration on the LCD by two values on a page. There is a 3-second delay between every page.

Screenshot (640).png
Screenshot (642).png
Screenshot (643).png

MQ2 is one of the commonly used gas sensors in MQ sensor series. It is a Metal Oxide Semiconductor (MOS) type Gas Sensor also known as Chemiresistors as the detection is based upon change of resistance of the sensing material when the Gas comes in contact with the material. Using a simple voltage divider network, concentrations of gas can be detected.

It can detect the gases and smoke anywhere from 200 to 10000ppm.

The Hitachi-compatible LCDs can be controlled in two modes: 4-bit or 8-bit. The 4-bit mode requires seven I/O pins from the Arduino, while the 8-bit mode requires 11 pins. For displaying text on the screen, you can do most everything in 4-bit mode, so example shows how to control a 16x2 LCD in 4-bit mode

Screenshot (645).png
Screenshot (646).png

The RS pin or register select pin is used for selecting whether we will send commands or data to the LCD. For example if the RS pin is set on low state or zero volts, then we are sending commands to the LCD like: set the cursor to a specific location, clear the display, turn off the display and so on. And when RS pin is set on High state or 5 volts we are sending data or characters to the LCD.

Next is the E pin which enables the writing to the registers, or the next 8 data pins from D0 to D7. So through this pins we are sending the 8 bits data when we are writing to the registers or for example if we want to see the latter uppercase A on the display we will send 0100 0001 to the registers according to the ASCII table. The last two pins A and K, or anode and cathode are for the LED back light.

After all we don’t have to worry much about how the LCD works, as the Liquid Crystal Library takes care for almost everything. From the Arduino’s official website you can find and see the functions of the library which enable easy use of the LCD. We can use the Library in 4 or 8 bit mode. In this tutorial we will use it in 4 bit mode, or we will just use 4 of the 8 data pins.

Screenshot (644).png

arduino code


#include <Wire.h> 
#include <LiquidCrystal_I2C.h>
#include "DHT.h"
#define DHTPIN 13
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);
LiquidCrystal_I2C lcd(0x27, 16, 2);

const int mq2 = A0;
const int mq4 = A1;
const int mq5 = A2;
const int mq135 = A3;

float m = -0.6527;
float b = 1.30;
float R0 = 21.91;

void setup() {

lcd.begin();
lcd.backlight();
lcd.print("Atmosphere");
lcd.setCursor(0,3);
lcd.print("Gas Analyser");
delay (3000);
lcd.clear();

lcd.print("By");
lcd.setCursor(0,3);
lcd.print("Zeno Modiff");
delay (3000);
lcd.clear();

pinMode(mq4, INPUT);
pinMode(mq135, INPUT);
pinMode(mq5, INPUT);
pinMode(mq2, INPUT);

Serial.begin(9600);
dht.begin();
}

void loop() {

float h = dht.readHumidity();
float t = dht.readTemperature();
float f = dht.readTemperature(true);
if (isnan(h) || isnan(t) || isnan(f)) {
Serial.println(F("Failed to read from DHT sensor!"));
return;
float hif = dht.computeHeatIndex(f, h);
float hic = dht.computeHeatIndex(t, h, false);
}
double mq4_value = analogToPPM(analogRead(mq4));
double mq135_value = analogToPPM(analogRead(mq135));
double mq5_value = analogToPPM(analogRead(mq5));
double mq2_value = analogToPPM(analogRead(mq2));

Serial.println("************************************");
Serial.print("MQ-4 Value: ");Serial.print(mq4_value, DEC);Serial.println(" PPM");
Serial.print("MQ-135 Value: ");Serial.print(mq135_value, DEC);Serial.println(" PPM");
Serial.print("MQ-5 Value: ");Serial.print(mq5_value, DEC);Serial.println(" PPM");
Serial.print("MQ-2 Value: ");Serial.print(mq2_value, DEC);Serial.println(" PPM");
Serial.print("DHT-Temp: ");Serial.print(t);Serial.println(" c");
Serial.print("DHT-Humi: ");Serial.print(h);Serial.println(" %");
Serial.println("************************************\n\n");

lcd.setCursor(0,0);
lcd.print("CNG Value");
lcd.setCursor(0,3);
lcd.println(mq4_value);
lcd.setCursor(7,7);
lcd.print("PPM");
delay(3000);
lcd.clear();

lcd.setCursor(0,0);
lcd.print("AQI Value");
lcd.setCursor(0,3);
lcd.println(mq135_value);
lcd.setCursor(7,7);
lcd.print("PPM");
delay(3000);
lcd.clear();

lcd.setCursor(0,0);
lcd.print("LNG");
lcd.setCursor(0,3);
lcd.println(mq5_value);
lcd.setCursor(7,7);
lcd.print("PPM");
delay(3000);
lcd.clear();

lcd.setCursor(0,0);
lcd.print("SMOKE");
lcd.setCursor(0,3);
lcd.println(mq2_value);
lcd.setCursor(7,7);
lcd.print("PPM");
delay(3000);
lcd.clear();

lcd.setCursor(0,0);
lcd.print("DHT-11");
lcd.setCursor(0,3);
lcd.print("Temp -");
lcd.setCursor(7,4);
lcd.println(t);
delay(3000);
lcd.clear();

lcd.setCursor(0,0);
lcd.print("DHT-11");
lcd.setCursor(0,3);
lcd.print("Humi -");
lcd.setCursor(7,4);
lcd.println(h);
delay(3000);
lcd.clear();

}
double analogToPPM(int aValue) {
float sensor_volt;
float RS_gas;
float ratio;
int sensorValue = aValue;

sensor_volt = sensorValue*(5.0/1023.0);
RS_gas = ((5.0*10.0)/sensor_volt)-10.0;
ratio = RS_gas/R0;
double ppm_log = (log10(ratio)-b)/m;
return ppm_log;
}