Gas Sensor Arduino Hookup&code

Advertisements

gas-sensor-arduino

 

MQ-XX series Gas sensors are common and easy to use Gas detection sensors, in previous article i have discussed about How to choose Gas Sensor? Here we are going to know about how to interface Gas sensor with Arduino development board.




What is Gas Sensor?

gas-sensor

Answer for this Question is simple that is a transducer converts particular Gas concentration in Air to equivalent electric signal. Every Gas sensor operates in a common way, it may contain a heater coil and a electro chemical sensor.

How Gas sensor Work?

When we apply bias to the sensor it takes some “burn-in time” that is for to sensor getting warm, after that the electro chemical sensor detects specific Gas and varies the current flow through sensor. Hence we get analog output ranges depends on Gas concentration.

Gas Sensor Pinout

mq-gas-sensor-pinout The MQ-xx have six pins, most of the Gas sensors in these series will have six pins.

The center two pins are called as H pins (Heater pins),

Remaining pins both up & down side called as A and B pins. Both pins are connected with separate electro-chemical sensor.

We can use both pins to bring output, only thing is No H pins are connected with micro controller or Arduino, because it draws much current.

Gas sensor Wiring

gas-sensor-connection-diagram

The both A pins can be connected together and applied to the +5V DC supply, By the way both B pins can be connected together and fed into the Output terminal. To vary the sensitivity we can connect the Rl resistor with B pin to Ground, it may valued from 2KΩ to 47KΩ, when you connecting lower value the less sensitivity, and the higher value gives good sensitivity but less accurate for higher concentration of Gas. The heater pins H & H should connected separately with +5V and Gnd.

Gas Sensor Arduino Hookup

mq-gas-sensor-arduino-hookup

As per the wiring diagram, the MQ-XX series sensor can be connected with Arduino board. The resistor (10K) connected with B pin to Gnd to maintain sensitivity level of Gas sensor at particular point, if you need variable sensitivity from your sensor you can use variable resistor instead for 10K.

A and H pins are connected together with +5V power source pin of Arduino board, and Separate H pin is connected with GND, Both B pins are connected together and linked to Arduino’s Analog pin A0.

gas-sensor-arduino-wiring

Just finished hookup, Don’t Make mistakes in the wiring if any thing goes wrong the sensor could damaged, otherwise you are advised to use breakout boards of Gas sensor.

gas-sensor-brakout-board

These kind of breakout boards are easy to handle and it can directly connected with microcontroller or Arduino board,

It has four pins namely +Vcc, Gnd, Do, Ao.

The breakout board with three pins will only give Analog output(Ao), The four pin (With ADC) breakout board will give Ao and also Digital output (Do) in standard logic level.

 

Gas sensor Arduino Code

 

/* theorycircuit.com */
/* this code can be used for MQ2,MQ5,MQ-xx series Sensors*/
int mqxx_analogPin = A0; // connected to the output pin of MQ-xx 

void setup(){
  Serial.begin(9600); // open serial at 9600 bps
}

void loop()
{
  // give ample warmup time for readings to stabilize

  int mqxx_value = analogRead(mqxx_analogPin);
  Serial.println(mqxx_value);

  delay(1000); //Just here to slow down the output.
}


 



Add a Comment

Your email address will not be published. Required fields are marked *