
- Arduino sensors tutorial mq2 tutorial how to#
- Arduino sensors tutorial mq2 tutorial pdf#
- Arduino sensors tutorial mq2 tutorial android#
- Arduino sensors tutorial mq2 tutorial code#
#define READ_SAMPLE_TIMES (5) //define the time interal(in milisecond) between each samples inįloat LPGCurve = point1: (lg200, 0.53), point2: (lg10000, -0.22)įloat Ro = 10 //Ro is initialized to 10 kilo ohms #define READ_SAMPLE_INTERVAL (50) //define how many samples you are going to take in normal operation #define CALIBRATION_SAMPLE_INTERVAL (500) //define the time interal(in milisecond) between each samples in the #define CALIBARAION_SAMPLE_TIMES (50) //define how many samples you are going to take in the calibration phase

which is derived from the chart in datasheet #define RO_CLEAN_AIR_FACTOR (9.83) //RO_CLEAR_AIR_FACTOR=(Sensor resistance in clean air)/RO, #define RL_VALUE (5) //define the load resistance on the board, in kilo ohms #define MQ_PIN (0) //define which analog input channel you are going to use
Arduino sensors tutorial mq2 tutorial code#
The MQ-2 gas sensor analog output pin(A0) is connected to the A0 ADC pin of the Arduino.īelow is the program code for detecting gas using MQ2 gas sensor and displaying the PPM values on the LCD. The Arduino pins 13 to 8 are used for LCD. The following diagram shows the wiring diagram of Arduino, 16x2 LCD with MQ-2 gas sensor. Wiring Diagram of MQ2 Gas Sensor with Arduino and LCD In the MQ-2 pin-out picture you can also see the potentiometer knob which is used to vary the sensitivity of the gas sensor. The third pin is the ground pin and the fourth pin the power supply Vcc pin. When the digital output is high, a LED on the module will turn ON. The second pin is digital output pin which can be configured to output high signal when certain level of gas is reached. The first pin is continuous analog output pin which can be read by the ADC module of a microcontroller. The module has four pins as shown in the MQ-2 pin out figure. The output voltage is taken from this voltage divider.

The load resistor(Rl) and the sensor resistor(Rs) form a voltage divider. The potentiometer is used to adjust the sensitivity. These two resistor together forms a series load resistor(Rl). So for applications to sense low levels of LPG, MQ5 is the ideal choice as it can sense values starting from 200 ppm.The MQ-2 module has protection resistor and potentiometer. We choose the right sensor based on the application requirement say for example – We can not choose MQ2 for sensing low levels of LPG in the range of 700 ppm because MQ2 is insensitive low levels of LPG (its range begins at 5000 ppm and extends to 10000 ppm). The difference between MQ5 and MQ2 therefore lies in its range of values. MQ2 can sense methane(CH4) upto 20000 ppm where as MQ5 can sense CH4 only upto 10000 ppm. So we can not choose MQ5 gas sensor to design a smoke alarm or smoke involving applications. Similarly MQ2 is sensitive to smoke where as MQ5 is not that sensitive to smoke. For example, MQ5 can sense LPG in a broader range of 200 ppm to 10000 ppm, where as the range of MQ2 for LPG is short and is from 5000 ppm to 10000 ppm. Both MQ5 and MQ2 are basically gas sensors but their range of sensing different gas levels vary. In a previous article, we have wrote a tutorial on Interfacing MQ5 Gas sensor to Arduino.

MQ2 is basically a general purpose gas sensor (similar to MQ5) which can sense a broad range of gases like LPG, Butane, Methane(CH4), Hydrogen and in addition to these gases MQ2 is sensitive to smoke as well.
Arduino sensors tutorial mq2 tutorial how to#
In this article, we are going to learn how to interface MQ2 Gas Sensor with Arduino. Arduino Tutorial Online Courses Video Training.
Arduino sensors tutorial mq2 tutorial pdf#
Arduino Nano Projects List in PDF offline downloadable.
Arduino sensors tutorial mq2 tutorial android#
