Examples - Electronic Bricks - Electronic GAS Sensor MQ5 Brick

Measure town gases, hydrogen..

This program gives you a basic understanding of how to measure with the analog MQ-5 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 reflects the factor being 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: town gases, hydrogen, 100ppm to 3,000ppm
Example: How to use the gas sensor brick MQ5
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);                      // just convert it to ppm 3000ppm == 5V input
}


This website has been archived and is no longer maintained.