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

    Grove - Temperature & Humidity Sensor Pro

    FAQS
    3
    7
    17.0k
    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.
    • A
      atsu
      last edited by

      Hello
      I would like to connect Grove - Temperature & Humidity Sensor Pro to m5stack, please tell me how to write
      Sample DHTtester did not work

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

        @atsu Hi Atsu,

        There are two DHT files in the M5 examples files.... One listed under folder name "Advanced / Blynk" called Post-DH12 and another under "Modules" called DHT12.

        DHT12 should work. I've tested it.

        [ You need these files in place: DHT12.h and Wire.h ]
        [ Im using M5Stack library ver 0.1.5, currently the second most recent available.]

        1 Reply Last reply Reply Quote 1
        • P
          PeterO
          last edited by

          hi all,
          have the issue that temp and humidity are read with zero value. After spending a long time with trouble shooting and checking if the signals and power is correct ( the delivered grove cable has mixed up colors) I disconnected the sensor and connected again. Then the sensor was working fine,
          but only until the next power off/on action.
          Is this a common issue or an issue with a defect DHT12 sensor or M5Stack Unit ?

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

            @petero Hi PeterO,

            I had some zero readings using the DHT12 example & Grove sensor.... but it also worked as well.

            I don't recall that powering off would cause it to stop working.

            Perhaps there is an issue with the cable or sensor.

            I seemed to get more reliable performance using the temperature app in Tom Such's SAM menu, although there is no apparent reason why this would be. Both sketches use the same libraries and the same function to do the measurements with the DHT12. It was possibly/probably coincidence. But I recall that it worked reliably and repeatedly.

            Here's a link if you want to try his sketch... its worth trying for the other apps anyway.
            https://github.com/PartsandCircuits/M5Stack-SAM

            P 1 Reply Last reply Reply Quote 0
            • P
              PeterO @JJ
              last edited by

              @jimit
              Thank you for the answers. Have tried to use some code in the link. Yes, my code is similar.
              Then I have isolated the I2C Scanner code and found a very confusing result, all addresses show up as active. Normally I expect to see only the actively used addresses as active.

              Here the Scanner code. On M5Stack LCD screen I see all addresses white, see picture.
              Is this really normal ?

              To check if the cable is broken I will try to connect with the pins and not with the Grove, but could be the unstable connection is in DHT12 module .

              0_1524871504000_I2CScanTest.jpg

              And here the code I have used:

              // I2C Scanner code used from this link to check if M5Stack is working
              // https://github.com/PartsandCircuits/M5Stack-SAM/tree/master/M5Stack-SAM

              // confusing part is that all I2C addresses are found in scan. That is surprising for me, because in a
              // normal Arduino Uno(Mega you see only addresses which are actively used.
              //
              // Peter Obermeier 28 April 2018

              #include <Wire.h>
              #include <M5Stack.h>

              void setup() {

              M5.begin();
              Wire.begin(9600);

              }

              void loop(){
              byte error, address;
              int nDevices;
              byte ridx = 0;
              byte lidx = 0;

              boolean scanrun = HIGH;

              // Create buttons
              M5.Lcd.setTextSize(2);
              M5.Lcd.setCursor(46,215);
              M5.Lcd.setTextColor(RED);
              M5.Lcd.printf("Scan");
              M5.Lcd.drawRect(42,212,55,30,WHITE);

              M5.Lcd.setCursor(135,215);
              M5.Lcd.setTextColor(GREEN);
              M5.Lcd.printf("Upd");
              M5.Lcd.drawRect(130,212,55,30,WHITE);

              M5.Lcd.setTextSize(1);
              M5.Lcd.setTextColor(WHITE);

              while(M5.BtnB.wasPressed()){
              M5.update();
              }

              while(!M5.BtnB.wasPressed()){

              if(scanrun==HIGH){
                scanrun = LOW;
                nDevices = 0;
                for(address = 1; address < 127; address++ ){
                  ridx++;
                  if(ridx==17){
                    ridx = 1;
                    lidx++;
                  }
                  Wire.beginTransmission(address);
                  error = Wire.endTransmission();    
                  if (error == 0){
                    M5.Lcd.drawString(String(address,HEX),0+(ridx*18),45+(lidx*20),2);
                    nDevices++;
                  }else if (error==4){
                    M5.Lcd.drawString(F("ER"),0+(ridx*18),45+(lidx*20),2);
                  }else{
                    M5.Lcd.drawString(F("--"),0+(ridx*18),45+(lidx*20),2);
                  }
                }
                M5.update();
              }else{
                if(M5.BtnA.wasPressed()){
                  M5.Lcd.fillScreen(BLACK);
                  
                  M5.Lcd.setCursor(0,0);
                  M5.Lcd.print("new scan will start now ... ");
                  delay(2000);
                  M5.Lcd.fillScreen(BLACK);
                  ridx = 0;
                  lidx = 0;
                  scanrun = HIGH;
                }
                M5.update();
              }
              

              }

              }

              P 1 Reply Last reply Reply Quote 0
              • P
                PeterO @PeterO
                last edited by

                @petero
                Have found the issue in the I2C scanner code. I have used Wire.begin(9600); instead of Wire.begin();
                The value 9600 is disturbing the whole thing,
                The Link to the SAM menu code is very very useful. JimiT, Thank you again,

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

                  @petero Hi PeterO,

                  Sorry I didn't get a chance to look into that further - was busy with github stuff etc. Glad you found the problem. These things can be very particular !!

                  Also glad the link was useful....... the SAM menu is fantastic.... with the included I2C scanner and other features.

                  There are also two other excellent menu systems... You can easily add your own apps to the "M5Stack-SD-Updater" menu (more are being added over time) and the other "M5Stack_MultiApp _Firmware" has a number of useful tools included.... including I2C scanner, voltmeter, etc.....

                  https://github.com/PartsandCircuits

                  Enjoy !

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