Line 16: Line 16:
 
Resistance value of MQ-2 is difference to various kinds and various concentration gases. So,When using this components, sensitivity adjustment is very necessary.<br/>
 
Resistance value of MQ-2 is difference to various kinds and various concentration gases. So,When using this components, sensitivity adjustment is very necessary.<br/>
 
The sensor resistor RS and load resistor RL form a voltage divider.
 
The sensor resistor RS and load resistor RL form a voltage divider.
Based on the chart provided in the MQ-2 datasheet, RS in clean air under given temperature and humidity is a constant,which is the “initial” resistance of the sensor named RO.
+
Based on the chart provided in the MQ-2 datasheet, RS in clean air under given temperature and humidity is a constant,which is the “initial” resistance of the sensor named RO. The ratio of RS/R0 in clean air is 9.8 as shown in datasheet. We will get R0 value by dividing it by

Revision as of 17:44, 9 April 2016

After basic peripheral interfaces with AVR, it's time to interface some sensors with it. In this tutorial we will interface Gas sensor MQ2 with Atmega 32 breakout. We will require a Smoke Sensor (MQ2) Board .

Basics

The gas sensor MQ2 suitable for detecting of LPG, i-butane, propane, methane, alcohol, Hydrogen, smoke etc. Since It is highly sensitive and gives fast response, we can take measurements as soon as possible. This sensor can be used for gas leakage detection.

fig 1: MQ-2 sensor schematic

At normal condition, sensor resistor will be high so voltage drop across the load will be low and it will be a constant.If sensor senses flammable gases, resistance of sensor will drop. That means more current will flow from load resistor.So the voltage across it increases. This output voltage increases with increase in concentration of gas in air. The sensitivity of the gas sensor can be adjusted using potentiometer.
Refer MQ-2 datasheet for detailed information.
This Smoke Sensor (MQ2) Board has analog as well as digital output. For this tutorial we will use analog output. Analog output pin needs to be connect ADC channel 0 of atmega 32 breakout as shown in hook up.

Hook Up

  • As MQ-2 sensor has heater inside, it is prefer to give power to the sensor from separate source.
  • For stable operation sensor requires around 24 hour preheating.
  • We can use Ultra AVR Developement Board,Starter AVR or Atmega32 Breakout.

Code

Resistance value of MQ-2 is difference to various kinds and various concentration gases. So,When using this components, sensitivity adjustment is very necessary.
The sensor resistor RS and load resistor RL form a voltage divider. Based on the chart provided in the MQ-2 datasheet, RS in clean air under given temperature and humidity is a constant,which is the “initial” resistance of the sensor named RO. The ratio of RS/R0 in clean air is 9.8 as shown in datasheet. We will get R0 value by dividing it by