Multichannel Gas Sensor Not Detecting Error (not compatible with nodeMCU (ESP8266) )

i used nodeMCU (ESP8266) to connect mutichannel gas sensor V2.
SCL - D1
SDA - D2
VCC - 5V
GND - GND

And used the code below to read the gas sensor's sensor values but no output is coming. it didn't even print the firmware version. I think it's unable to initialize the beginning. need help to solve this problem.

code

/*
    This is a demo to test gas library
    This code is running on Xadow-mainboard, and the I2C slave is Xadow-gas
    There is a ATmega168PA on Xadow-gas, it get sensors output and feed back to master.
    the data is raw ADC value, algorithm should be realized on master.

    please feel free to write email to me if there is any question

    Jacky Zhang, Embedded Software Engineer
    qi.zhang@seeed.cc
    17,mar,2015
*/

#include <Wire.h>
#include "MutichannelGasSensor.h"

void setup()
{
    Serial.begin(115200);' '  // start serial for output
    Serial.println("power on!");
    gas.begin(0x04);//the default I2C address of the slave is 0x04
    gas.powerOn();
    Serial.print("Firmware Version = ");
    Serial.println(gas.getVersion());
}

void loop()
{
    float c;

    c = gas.measure_NH3();
    Serial.print("The concentration of NH3 is ");
    if(c>=0) Serial.print(c);
    else Serial.print("invalid");
    Serial.println(" ppm");

    c = gas.measure_CO();
    Serial.print("The concentration of CO is ");
    if(c>=0) Serial.print(c);
    else Serial.print("invalid");
    Serial.println(" ppm");

    c = gas.measure_NO2();
    Serial.print("The concentration of NO2 is ");
    if(c>=0) Serial.print(c);
    else Serial.print("invalid");
    Serial.println(" ppm");

    c = gas.measure_C3H8();
    Serial.print("The concentration of C3H8 is ");
    if(c>=0) Serial.print(c);
    else Serial.print("invalid");
    Serial.println(" ppm");

    c = gas.measure_C4H10();
    Serial.print("The concentration of C4H10 is ");
    if(c>=0) Serial.print(c);
    else Serial.print("invalid");
    Serial.println(" ppm");

    c = gas.measure_CH4();
    Serial.print("The concentration of CH4 is ");
    if(c>=0) Serial.print(c);
    else Serial.print("invalid");
    Serial.println(" ppm");

    c = gas.measure_H2();
    Serial.print("The concentration of H2 is ");
    if(c>=0) Serial.print(c);
    else Serial.print("invalid");
    Serial.println(" ppm");

    c = gas.measure_C2H5OH();
    Serial.print("The concentration of C2H5OH is ");
    if(c>=0) Serial.print(c);
    else Serial.print("invalid");
    Serial.println(" ppm");

    delay(1000);
    Serial.println("...");
}

Hi @solite. You need to set the baud rate in the menu at the top right corner of the Serial Monitor to match the baud rate set in the Serial.begin call of your sketch:

image

i did still same

what is meant by "0x04"

Read the code in setup. There's a comment to 0x04.

yes I know but need a more explanation
like what actually mean by "the default I2C address of the slave is 0x04" this statement

Can it be more clear? What is the difficult word?

why is it 0x04 instead 0x02 or any other number how to identify ur address of slave of a device

Manufactorers choice. Different types of devices usually use different addresses. Some devices have straps so their identity can be changed. The range of addressis is from 1 to 127 I think. Address 0 is for the master.

1 Like

I preheated the device and did all thing as instructed but the code still keep running without saying calibrated stopped
Just want to know what can I do to fix this

// Calibration code for Grove - Multichannel Gas Sensor
// Note that it need 10 minutes pre-heat before calibration
// This code is writen by Loovee@2016-5-18

#include <Wire.h>
#include "MutichannelGasSensor.h"

#define SENSOR_ADDR     0X08        // default to 0x04
#define PRE_HEAT_TIME   30           // pre-heat time, 10-30 minutes is recommended

void setup()
{
    Serial.begin(115200);
    gas.begin(SENSOR_ADDR);   // 
    Serial.println("power on, and pre-heat");
    
    for(int i=60*PRE_HEAT_TIME; i>=0; i--)
    {
        Serial.print(i/60);
        Serial.print(":");
        Serial.println(i%60);
        delay(1000);
    }
    
    Serial.println("Begin to calibrate...");
    gas.doCalibrate();
    Serial.println("Calibration ok");
    
    gas.display_eeprom();
}

void loop()
{
    
}

@solite ,

Your two or more topics on the same or similar subject have been merged.

Please do not duplicate your questions as doing so wastes the time and effort of the volunteers trying to help you as they are then answering the same thing in different places.

Please create one topic only for your question and choose the forum category carefully. If you have multiple questions about the same project then please ask your questions in the one topic as the answers to one question provide useful context for the others, and also you won’t have to keep explaining your project repeatedly.

Repeated duplicate posting could result in a temporary or permanent ban from the forum.

Could you take a few moments to Learn How To Use The Forum

It will help you get the best out of the forum in the future.

Thank you.

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.