💬 Gas Sensor

  • Admin

    This thread contains comments for the article "Gas Sensor" posted on MySensors.org.

  • Just a note for any Domoticz users who may try this sketch - it presents in the log, but is not available under 'Devices' to be added UNTIL it gets a reading > 0. My solution to that was to go put the node over the gas hob and let the gas run (unlit) for a few seconds so that it generated a reading 😄

    Remember kids, gas is dangerous, stay safe.

  • Where can I get chep MQ-138 sensor please?

  • Mod

    Have you looked at aliexpress?

  • HI Gohan,

    Yes I did, seems that they are very expensive wherever I look. I'll wait on this one ofr now.

    Thanks for the suggestion though 🙂

  • Mod

    I believe it is on the cheap side. These price ranges are mainly for hobbyist sensor. The real calibrated ones are usually way more expensive. The cheap ones are only good to measure trends, not for the actual value.

  • Please advise what would be curve for MQ135 sensor for CO2. Thank you.

  • Mod

    @apl2017 itsn't the curve in the datasheet linked on the build page sifficient?

  • Sure, the curve is there. I am trying to make sense out of two points curve that is used in sketch for MQ2 sensor, CO gas. "point1: (lg200, 0.72), point2: (lg10000, 0.15)" while I see on the curve from datasheet (lg200, 5.2) and (lg10000, 1.3). That is why I am asking for help, sorry for not making it clear.

  • Lack of support makes you think, so I figured out the "hidden" calculations in the sketch above and proposing the code modification to allow users to port the code to a different gas sensor using data taken directly from the sensor chart. Here are modified fragments of the code showing only CO curve for MQ2 sensor:

    float CO2Curve[4] = {0.8,200,2.2,10};
    //two end points are taken from the curve with two coordinates for each point
    //in form of{Y1, X1,Y2, X2) where X is PPM axis, Y is Rs/Ro axis from the sensor chart for specifc gas
    //then equation X=(Y-b)/m is used,
    //where m is slope of the curve, b is Y axis intersept point
    float Slope = (log(pcurve(1)-log(pcurve(0))/(log(pcurve(3)-log(pcurve(2));
    float Y_Intercept=log(pcurve(1)-Slope*log(pcurve(3);

    int MQGetPercentage(float rs_ro_ratio, float *pcurve)
    { return (pow(10,((log(rs_ro_ratio)-Y_Intercept)/Slope))); }

Log in to reply





Looks like your connection to MySensors Forum was lost, please wait while we try to reconnect.