🤖Have you ever tried Chat.M5Stack.com before asking??😎
    M5Stack Community
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Register
    • Login

    Connecting M5Stack to an MQ-2 smoke/gas sensor

    FAQS
    3
    7
    20.7k
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • S
      Suntzu
      last edited by Suntzu

      I am trying to port my ESP8266 project to M5Stack but for the life of me I could not figure out how to connect the wires between M5Stack and the analog MQ-2 gas sensor.

      This is my wiring for ESP8266 that perfectly works:

       MQ-2 Sensor    ->    ESP8266
           A0         ->      A0
           D0         ->      D0
           VCC        ->      VIN (5.5V)
           GRD        ->      GRD
      

      This is what I have tried in M5Stack but did not work. The sensor's D0 LED and power LED do not even lit on.

       MQ-2 Sensor    ->      M5Stack
           A0         ->        Pin 36 (I also have tried 35)
           D0         ->        Pin 21 (I also have tried 16)
           VCC        ->        5V
           GRD        ->        G
      

      How do I wire the analog MQ-2 sensor To M5Stack? Is it doable? Any guidance please?

      JJJ 1 Reply Last reply Reply Quote 0
      • JJJ
        JJ @Suntzu
        last edited by

        @suntzu Hi Suntu,

        Try sourcing the 5V from the positive terminal on the Grove connector.

        S 1 Reply Last reply Reply Quote 1
        • S
          Suntzu
          last edited by Suntzu

          @JimiT I will try that when I get back home from the office. And I will make sure to keep you updated.

          Thank you so much, Jimi.

          1 Reply Last reply Reply Quote 0
          • S
            Suntzu @JJ
            last edited by

            @jimit 在 Connecting M5Stack to an MQ-2 smoke/gas sensor 中说:

            @suntzu Hi Suntu,

            Try sourcing the 5V from the positive terminal on the Grove connector.

            It worked like a charm! Thank you again. It's time to rewrite my sketches for M5Stack.

            JJJ 1 Reply Last reply Reply Quote 1
            • JJJ
              JJ @Suntzu
              last edited by JJ

              @suntzu Glad to hear it worked !!!!

              And you used pins 36 and 21 ?

              Now I will have to order some of these MQ-2 sensors !! Thank you for the tip.

              If you are open to posting a link to your code or a screenshot when done, that would be interesting to see.

              1 Reply Last reply Reply Quote 0
              • S
                Suntzu
                last edited by Suntzu

                @JimiT Yes, I used Pin 36 and 21.

                Absolutely, I will post the finish product and pictures in the Projects section.

                1 Reply Last reply Reply Quote 0
                • D
                  DrWino
                  last edited by

                  I am been able to read the ADC on pin 35. This corresponds to ADC1_CH7 BUT I cannot get ADC on pin 36 to work. I think this is ADC1-CH0. Anybody has any sample code ? Thanks.

                  1 Reply Last reply Reply Quote 0
                  • First post
                    Last post