Saturday, 9 May 2015

Arduino Tips & Tricks

Interfacing Gas Sensors with Arduino

Gas sensors commonly available in the market are the MQ series gas sensors. Different sensors in this series have different target gases for detection.But they all have more or less same structure and parts.Every gas sensor has a  heating coil and a surface with coating of some compound which is sensitive to the presence of a target gas.
Below is the picture depicting the structure of  MQ-2 which is a combustible gas sensor.


 These sensors require a 5V supply to power the heating coil .Since there is no electronic circuit inside them they can also be powered up using the AC.  These sensors can draw current upto 130 to 150 mA so these shouldnot be powerd using the Arduino. In case of the MQ-2 the sensitive material used in detection is Tinoxide. Mq2 is sensitive to LPG propane and Hydrogen.Below is a table with different gas sensors and their target gas.


CONNECTIONS WITH ARDUINO

As always now we will interface the sensor with the arduino Uno. The picture below shows the pins and how to connect it.
The polarity is not important in this sensor connect any one of the H pin to ground and the other one to the VCC. 
The MQ-2 sensor is not breadboard friendly,also it is difficult to solder wire directly on pins,I have designed a board on eagle to ease this out. I have also incorporated a LM35 temperature sensor.If you want to read out it interfacing you can read my previous post here



You can find the design files and gerbers on my github repository here Board,Gerbers. As always free to use and remix

SOURCE CODE:
float temp;
int gas;
int tempPin = A0;
int gasPin=A1;

void setup()
{
  Serial.begin(9600);
  
}

void loop()
{
  temp = analogRead(tempPin);
  gas=analogRead(gasPin);
  temp = temp * 0.48828;
  Serial.print("Temperature=")
  Serial.print(temp);
  Serial.print(',');
  Serial.print("Gas Sensor output")// 
  Serial.print(gas);// Stable readings comeout after 2 3 minutes
  delay(1000);
}

CALIBRATION:

The real challenge in dealing with the Gas sensors is the calibration,if you just want to use the gas sensor to know between high concentration of gas and low concentration  and then do something based on this ,for this much whatever we have seen so far is sufficient enough. But when you precisely want to know that what ppm of gas is there it is very important to correctly calibrate the sensor. For MQ2 it is recommended to expose the sensor to know value of target gas say 1000ppm and then observe the output and then with this data an algorithm is made to calculate the exact concentration of gas. But the problem is how to create an environment with known value of a gas. This would require a Lab with all the necessary equipments.
There are other factors that may also impact the sensor reading like humidity and temperature. Also there is a concept of burn in time which says that the sensor should be made to run for  of 18 to 24 hours after which it starts giving reliable readings. 

Quick Tip: In case you make the ADC to work with external reference or internal reference of 1.1 you might need to reduce the value of load resistance.Thats why i have kept a potentiometer in my hardware design so that it can be tweaked as needed.




No comments:

Post a Comment