Examples - Electronic Bricks - Electronic GAS Sensor MQ6 Brick

Measure town gases, hydrogen..

That program gives you a basic understanding of how to measure propane, butane, liquified petroleum gas with the analog MQ-6 Brick. Just connect it to analog input port (1) on your micro-controller.

The Analog sensor is different from Digital sensor, the level of analog signal continuously reflect the factor been measured, like light strength, gas density, temperature and so on. Letís take the Gas sensor for example. First, adjust the Resistor of the Brick to correct the sensor output analog level. When power up the gas sensor will heat up, and then we can adjust the resistor to about 5K correct the output analog signal to about 1V.

/*
Gas sensor brick MQ6 Example
Senses: propane, butane, liquified petroleum gas, 300ppm to 10,000ppm
Example: How to use the gas sensor brick MQ6
Usage: Connect Brick to analog pin 1 on the Seeduino Shield
and use the SerialGraph Processing programm to visu the data
*/

int gasInputPin = 1;                        // Define the analog input pin for keypad
void setup()
{
        Serial.begin(9600);                     // Invoke Serial Interface for debugging purposes
}

void loop()
{
        int gas = analogRead(gasInputPin);        // Read the sensor
        Serial.println(gas);                      // Convert it to PPM, 5V == 10000 0V == 300
}