Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. General Discussion
  3. Can't compile Humidity sketch 2.0 .. What DHT library do I need?

Can't compile Humidity sketch 2.0 .. What DHT library do I need?

Scheduled Pinned Locked Moved General Discussion
19 Posts 9 Posters 18.3k Views 7 Watching
  • 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.
  • C Offline
    C Offline
    chuckconnors
    wrote on last edited by
    #2

    Can someone please look at their libraries and tell me which one I need to use? Apparently installing Arduino IDE does not install this library by default and all the ones I've tried have failed. I don't see any documentation on which one to use.

    I've got a handful of sensors built but I can't program them until I get this resolved. I really appreciate your time and help. Thanks!

    AWIA 1 Reply Last reply
    0
    • C chuckconnors

      Can someone please look at their libraries and tell me which one I need to use? Apparently installing Arduino IDE does not install this library by default and all the ones I've tried have failed. I don't see any documentation on which one to use.

      I've got a handful of sensors built but I can't program them until I get this resolved. I really appreciate your time and help. Thanks!

      AWIA Offline
      AWIA Offline
      AWI
      Hero Member
      wrote on last edited by AWI
      #3

      @chuckconnors this is what I found as a working example on my system. I still don't understand why the DHT keeps being so popular. There are much better temp/hum sensors around..... But anyway, this one should work.

      Installation
      ------------
      
      Place the [DHT][download] library folder in your `<arduinosketchfolder>/libraries/` folder. You may need to create the `libraries` subfolder if its your first library. Restart the Arduino IDE. 
      
      [download]: https://github.com/markruys/arduino-DHT/archive/master.zip "Download DHT library"
      [example]: https://github.com/markruys/arduino-DHT/blob/master/examples/DHT_Test/DHT_Test.pde "Show DHT example"
      [header]: https://github.com/markruys/arduino-DHT/blob/master/DHT.h "Show header file"```
      sundberg84S C 2 Replies Last reply
      1
      • AWIA AWI

        @chuckconnors this is what I found as a working example on my system. I still don't understand why the DHT keeps being so popular. There are much better temp/hum sensors around..... But anyway, this one should work.

        Installation
        ------------
        
        Place the [DHT][download] library folder in your `<arduinosketchfolder>/libraries/` folder. You may need to create the `libraries` subfolder if its your first library. Restart the Arduino IDE. 
        
        [download]: https://github.com/markruys/arduino-DHT/archive/master.zip "Download DHT library"
        [example]: https://github.com/markruys/arduino-DHT/blob/master/examples/DHT_Test/DHT_Test.pde "Show DHT example"
        [header]: https://github.com/markruys/arduino-DHT/blob/master/DHT.h "Show header file"```
        sundberg84S Offline
        sundberg84S Offline
        sundberg84
        Hardware Contributor
        wrote on last edited by sundberg84
        #4

        @AWI probably because its mentioned in the build page? But i agree - I now know as well there is better out there.

        Controller: Proxmox VM - Home Assistant
        MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
        MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
        RFLink GW - Arduino Mega + RFLink Shield, 433mhz

        AWIA C 2 Replies Last reply
        0
        • sundberg84S sundberg84

          @AWI probably because its mentioned in the build page? But i agree - I now know as well there is better out there.

          AWIA Offline
          AWIA Offline
          AWI
          Hero Member
          wrote on last edited by
          #5

          @sundberg84 Do I hear volunteering for a revised build example? :) Or better a joint initiative?

          1 Reply Last reply
          2
          • AWIA AWI

            @chuckconnors this is what I found as a working example on my system. I still don't understand why the DHT keeps being so popular. There are much better temp/hum sensors around..... But anyway, this one should work.

            Installation
            ------------
            
            Place the [DHT][download] library folder in your `<arduinosketchfolder>/libraries/` folder. You may need to create the `libraries` subfolder if its your first library. Restart the Arduino IDE. 
            
            [download]: https://github.com/markruys/arduino-DHT/archive/master.zip "Download DHT library"
            [example]: https://github.com/markruys/arduino-DHT/blob/master/examples/DHT_Test/DHT_Test.pde "Show DHT example"
            [header]: https://github.com/markruys/arduino-DHT/blob/master/DHT.h "Show header file"```
            C Offline
            C Offline
            chuckconnors
            wrote on last edited by
            #6

            @AWI said:

            @chuckconnors this is what I found as a working example on my system. I still don't understand why the DHT keeps being so popular. There are much better temp/hum sensors around..... But anyway, this one should work.

            Installation
            ------------
            
            Place the [DHT][download] library folder in your `<arduinosketchfolder>/libraries/` folder. You may need to create the `libraries` subfolder if its your first library. Restart the Arduino IDE. 
            
            [download]: https://github.com/markruys/arduino-DHT/archive/master.zip "Download DHT library"
            [example]: https://github.com/markruys/arduino-DHT/blob/master/examples/DHT_Test/DHT_Test.pde "Show DHT example"
            [header]: https://github.com/markruys/arduino-DHT/blob/master/DHT.h "Show header file"```
            

            Thanks for the reply. I'm pretty sure that's one of the ones I tried. I ended up finding an old install I had and copied the library from there and it's working now.

            1 Reply Last reply
            0
            • tbowmoT Offline
              tbowmoT Offline
              tbowmo
              Admin
              wrote on last edited by
              #7

              @chuckconnors

              if you look at the "examples" repository, it both examples folder, and libraries that should work with the enclosed examples. Copy the library, that you want to use, to Arduino/libraries/... and the example to Arduino/... and try to compile them.

              C 1 Reply Last reply
              2
              • tbowmoT tbowmo

                @chuckconnors

                if you look at the "examples" repository, it both examples folder, and libraries that should work with the enclosed examples. Copy the library, that you want to use, to Arduino/libraries/... and the example to Arduino/... and try to compile them.

                C Offline
                C Offline
                chuckconnors
                wrote on last edited by
                #8

                @tbowmo said:

                @chuckconnors

                if you look at the "examples" repository, it both examples folder, and libraries that should work with the enclosed examples. Copy the library, that you want to use, to Arduino/libraries/... and the example to Arduino/... and try to compile them.

                HOLY SMOKES! I totally missed the libraries directory. Thank you and sorry for the troubles.

                1 Reply Last reply
                0
                • sundberg84S sundberg84

                  @AWI probably because its mentioned in the build page? But i agree - I now know as well there is better out there.

                  C Offline
                  C Offline
                  chuckconnors
                  wrote on last edited by
                  #9

                  @sundberg84 said:

                  @AWI probably because its mentioned in the build page? But i agree - I now know as well there is better out there.

                  Can you tell me what better sensors are out there? These DHT11's I have vary wildly with regards to relative humidity.

                  1 Reply Last reply
                  0
                  • sundberg84S Offline
                    sundberg84S Offline
                    sundberg84
                    Hardware Contributor
                    wrote on last edited by
                    #10

                    @chuckconnors - BMP180 or Bmp280 for example.

                    Controller: Proxmox VM - Home Assistant
                    MySensors GW: Arduino Uno - W5100 Ethernet, Gw Shield Nrf24l01+ 2,4Ghz
                    MySensors GW: Arduino Uno - Gw Shield RFM69, 433mhz
                    RFLink GW - Arduino Mega + RFLink Shield, 433mhz

                    C 1 Reply Last reply
                    0
                    • sundberg84S sundberg84

                      @chuckconnors - BMP180 or Bmp280 for example.

                      C Offline
                      C Offline
                      chuckconnors
                      wrote on last edited by
                      #11

                      @sundberg84 said:

                      @chuckconnors - BMP180 or Bmp280 for example.

                      Those appear to be atmospheric pressure sensors. Looking for humidity sensors other than the DHT11/DHT22.

                      1 Reply Last reply
                      0
                      • Nca78N Offline
                        Nca78N Offline
                        Nca78
                        Hardware Contributor
                        wrote on last edited by Nca78
                        #12

                        Hello,

                        DHT22 is already much better than DHT11 which I think is complete garbage: wild variations in both temp and humidity between sensors, too unprecise and it's getting worse with time.
                        I heave read somewhere (sorry don't remember where but it was a guy testing a lot of temp/humidity sensors) that the best one for humidity is BME280. It has also atmospheric pressure and temperature (but is not really good for temp) like BMP180/280.
                        The Si7020 like on the sensebender micro seems pretty good too.

                        Just don't expect the same price level :D

                        AWIA 1 Reply Last reply
                        0
                        • Nca78N Nca78

                          Hello,

                          DHT22 is already much better than DHT11 which I think is complete garbage: wild variations in both temp and humidity between sensors, too unprecise and it's getting worse with time.
                          I heave read somewhere (sorry don't remember where but it was a guy testing a lot of temp/humidity sensors) that the best one for humidity is BME280. It has also atmospheric pressure and temperature (but is not really good for temp) like BMP180/280.
                          The Si7020 like on the sensebender micro seems pretty good too.

                          Just don't expect the same price level :D

                          AWIA Offline
                          AWIA Offline
                          AWI
                          Hero Member
                          wrote on last edited by AWI
                          #13

                          @Nca78 said:

                          Just don't expect the same price level

                          :confused: Si7021 can be found for €2.65 (DHT22 €2.43) on ali-express. BME280 €4.07 including barometeric pressure.
                          A link to a comparison in this post

                          1 Reply Last reply
                          2
                          • karl261K Offline
                            karl261K Offline
                            karl261
                            wrote on last edited by
                            #14

                            Yes, BME280 seems pretty good for T, P, H. I did not have much luck with DHT22 and SI7021.

                            1 Reply Last reply
                            0
                            • R Offline
                              R Offline
                              r-nox
                              wrote on last edited by
                              #15

                              I'm dead in the water with the same issue. Downloading the lib from the location above yielded the same result.

                              mfalkviddM 1 Reply Last reply
                              0
                              • R r-nox

                                I'm dead in the water with the same issue. Downloading the lib from the location above yielded the same result.

                                mfalkviddM Offline
                                mfalkviddM Offline
                                mfalkvidd
                                Mod
                                wrote on last edited by
                                #16

                                @r-nox did you download the library from MySensors or did you follow the link in the readme and download the upstream version of the library? Only the former will work.

                                R 1 Reply Last reply
                                0
                                • mfalkviddM mfalkvidd

                                  @r-nox did you download the library from MySensors or did you follow the link in the readme and download the upstream version of the library? Only the former will work.

                                  R Offline
                                  R Offline
                                  r-nox
                                  wrote on last edited by
                                  #17

                                  @mfalkvidd

                                  I can't tell what I'm using anymore. Been at it all afternoon installing and un installing. I think I'm using these now (https://github.com/mysensors/MySensorsArduinoExamples/tree/master/libraries/DHT).

                                  Where do I start please?

                                  1 Reply Last reply
                                  0
                                  • R Offline
                                    R Offline
                                    r-nox
                                    wrote on last edited by
                                    #18

                                    https://github.com/markruys/arduino-DHT/

                                    This one worked for me.

                                    What a frustrating time that was.

                                    1 Reply Last reply
                                    0
                                    • joaoabsJ Offline
                                      joaoabsJ Offline
                                      joaoabs
                                      wrote on last edited by joaoabs
                                      #19

                                      I really like mysensors.org, but I've always had difficulties with the site organization. In my opinion, is not intuitive at all, although it has a great and appealing theme.

                                      Well, maybe it shouldn't, but this sets me back when trying to build anything... I know this excellent initiative for a couple of years now, and from time to time I try to do something but I end up de-motivated because it takes too long to find simple answers/solutions. At the moment, I have nothing built although I have all the equipment I need, including SenserBenders. Yes, frustrating like r-nox commented 2 years ago.

                                      Anyway, my point is: For the ones looking for a library that makes this DHT sketch work, mysensors have compiled a set of libraries that include this DHT.h and many others. Just go to https://www.mysensors.org/about/arduino#optional---install-external-mysensors-examples (yes, the name is not intuitive, maybe the keyword library would make it more obvious?), or jump directly to here and follow the standard library instructions. It took me two hours to find this, hope it saves time for future followers of mysensors like myself.

                                      Good luck!

                                      1 Reply Last reply
                                      0
                                      Reply
                                      • Reply as topic
                                      Log in to reply
                                      • Oldest to Newest
                                      • Newest to Oldest
                                      • Most Votes


                                      21

                                      Online

                                      11.7k

                                      Users

                                      11.2k

                                      Topics

                                      113.1k

                                      Posts


                                      Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
                                      • Login

                                      • Don't have an account? Register

                                      • Login or register to search.
                                      • First post
                                        Last post
                                      0
                                      • MySensors
                                      • OpenHardware.io
                                      • Categories
                                      • Recent
                                      • Tags
                                      • Popular