Examples - Electronic Bricks - Electronic GAS Sensor MQ7 Brick

Measure carbon monoxide with the MQ-7..

This program gives you a basic understanding of how to measure carbon monoxide with the analog MQ-7 Brick. Just connect it to analog input port (1) on your micro-controller.

The Analog sensor is different from Digital sensors, the level of analog signal continuously reflect the factor that has 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 to correct the output analog signal to about 1V.

/*
Gas sensor brick MQ7 Example
Senses: carbon monoxid 20 - 2000ppm, 100ppm to 3,000ppm
Example: How to use the gas sensor brick MQ7
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 this value to ppm
}

This website has been archived and is no longer maintained.