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. Announcements
  3. 💬 Air Humidity Sensor - DHT

💬 Air Humidity Sensor - DHT

Scheduled Pinned Locked Moved Announcements
149 Posts 48 Posters 47.9k Views 38 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.
  • carlosC Offline
    carlosC Offline
    carlos
    wrote on last edited by
    #6

    I was looking for examples on mysensors 2.0 having several sensors in the same node and this sketch looks very iteresting.
    Thanks

    1 Reply Last reply
    0
    • T Offline
      T Offline
      thomas schneider
      wrote on last edited by
      #7

      Hi everybody,

      I try to uploaded the sketch on my arduino nano and I have an error with this line :dht.readSensor(true);

      When I delete this line I have no error on the upload but the senosr has no refresh...

      carlosC 1 Reply Last reply
      0
      • T thomas schneider

        Hi everybody,

        I try to uploaded the sketch on my arduino nano and I have an error with this line :dht.readSensor(true);

        When I delete this line I have no error on the upload but the senosr has no refresh...

        carlosC Offline
        carlosC Offline
        carlos
        wrote on last edited by
        #8

        @thomas-schneider
        Did you see the comments from Mikael?. Do you have the DHT library?.
        What does the error say?

        1 Reply Last reply
        0
        • T Offline
          T Offline
          thomas schneider
          wrote on last edited by
          #9

          Yes I saw the comments of Mickael. But sorry, I didn't understand how to download the library. Now all is done and ok ! We need to come back and download the entire folder. Why this library is not in mysensors library ? It's not easy for a newbie.

          Thanks for the support and congratulations for the website.

          1 Reply Last reply
          0
          • skywatchS Online
            skywatchS Online
            skywatch
            wrote on last edited by
            #10

            Can anyone please show how to connect more than one DHT with this sketch? What needs changing in the code? (I am OK with the hardware side of things).

            Once I have an example I can work the rest out but at the moment this bit baffles me! ;)

            Thank you :)

            1 Reply Last reply
            0
            • mikeSM Offline
              mikeSM Offline
              mikeS
              wrote on last edited by
              #11

              @skywatch
              I know what you mean, I was having the very same trouble with relay actuators, and that's where your solution lies. There is a sketch that allows you to name the number of relays, and then the sketch automatically names the children, you should be able to modify that, (or at least get an idea of how you have multiples of the same sensor on the same board) to add as many dht's as you have spare digital pins on your arduino. Good luck, hours of fun lies ahead ;)

              1 Reply Last reply
              0
              • tianaT Offline
                tianaT Offline
                tiana
                wrote on last edited by
                #12

                Is exist some way to calibrate DHT sensors? today i make a experiment assemble 5 nodes with 5 DHT11 sensors put all nodes on one table and leave them for some hours, and the result is the every sensor give different values about temperature and humidity + - MAX 5 degree Celsius around the real temperature in the room. Hardware used Arduino Nano X 5pc., HDT11 X 5pc., the power supply is 12V 2,2A enough to power all of the arduinos.

                1 Reply Last reply
                0
                • AndurilA Offline
                  AndurilA Offline
                  Anduril
                  wrote on last edited by
                  #13

                  @tiana well you could simply calibrate the value you get in your sketch for every DHT on it's own. But you have to do a calibraton, meaning measure all of them at multiple temperatures and humidities.
                  If it's only a offset you can also use

                  // Set this offset if the sensor has a permanent small offset to the real temperatures
                  #define SENSOR_TEMP_OFFSET 0
                  

                  to correct for this, otherwise you have to implement your calibration function on your own.

                  1 Reply Last reply
                  0
                  • tianaT Offline
                    tianaT Offline
                    tiana
                    wrote on last edited by
                    #14

                    For some sensors is possible to make with offset, but some of the sensors changing their values 2 times in minute with + - 2 degree Celsius some times show more sometimes show less.

                    1 Reply Last reply
                    0
                    • AndurilA Offline
                      AndurilA Offline
                      Anduril
                      wrote on last edited by
                      #15

                      well I think this kind of noise can not be calibrated. I thought they all have different values, but with offset, linear oder squared function for deviation.

                      1 Reply Last reply
                      0
                      • tianaT Offline
                        tianaT Offline
                        tiana
                        wrote on last edited by
                        #16

                        I read datasheet for DHT11 and 2 degree deviation is ok for them. Now i playing with DHT22 I try this #define SENSOR_TEMP_OFFSET -1.3, but nothing is changed the sensor still give me same value.

                        mfalkviddM 1 Reply Last reply
                        0
                        • tianaT tiana

                          I read datasheet for DHT11 and 2 degree deviation is ok for them. Now i playing with DHT22 I try this #define SENSOR_TEMP_OFFSET -1.3, but nothing is changed the sensor still give me same value.

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

                          @tiana try setting SENSOR_TEMP_OFFSET to a really big value, for example -30.8 to make sure that the change is large enough to be noticeable.

                          1 Reply Last reply
                          0
                          • pepsonP Offline
                            pepsonP Offline
                            pepson
                            wrote on last edited by
                            #18

                            Where i can found good DHT library for this sketch ?

                            mfalkviddM 1 Reply Last reply
                            0
                            • pepsonP pepson

                              Where i can found good DHT library for this sketch ?

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

                              @pepson how about the library linked from the build page?

                              1 Reply Last reply
                              0
                              • pepsonP Offline
                                pepsonP Offline
                                pepson
                                wrote on last edited by
                                #20

                                sorry i found

                                1 Reply Last reply
                                1
                                • Jim DanforthJ Offline
                                  Jim DanforthJ Offline
                                  Jim Danforth
                                  wrote on last edited by
                                  #21

                                  Using library linked above
                                  Getting: no matching function for call to 'DHT::readSensor(bool)'

                                  1 Reply Last reply
                                  0
                                  • hekH hek

                                    This thread contains comments for the article "Air Humidity Sensor - DHT" posted on MySensors.org.

                                    ramoncarranzaR Offline
                                    ramoncarranzaR Offline
                                    ramoncarranza
                                    wrote on last edited by
                                    #22

                                    @hek
                                    hi, how do I change the readings from C to F?
                                    My sensor works fine, by I get the readings I celsius

                                    mikeSM 1 Reply Last reply
                                    0
                                    • ramoncarranzaR ramoncarranza

                                      @hek
                                      hi, how do I change the readings from C to F?
                                      My sensor works fine, by I get the readings I celsius

                                      mikeSM Offline
                                      mikeSM Offline
                                      mikeS
                                      wrote on last edited by
                                      #23

                                      @ramoncarranza
                                      Change the line in the sketch:

                                      temperature = dht.toFahrenheit(temperature);

                                      to

                                      temperature = dht.toCelsius(temperature);

                                      probably? I haven't checked it, just looked at the DHT library. You may need to comment the isMetric line earlier in the sketch too. But I think that's how you do it.

                                      ramoncarranzaR 1 Reply Last reply
                                      3
                                      • mikeSM mikeS

                                        @ramoncarranza
                                        Change the line in the sketch:

                                        temperature = dht.toFahrenheit(temperature);

                                        to

                                        temperature = dht.toCelsius(temperature);

                                        probably? I haven't checked it, just looked at the DHT library. You may need to comment the isMetric line earlier in the sketch too. But I think that's how you do it.

                                        ramoncarranzaR Offline
                                        ramoncarranzaR Offline
                                        ramoncarranza
                                        wrote on last edited by
                                        #24

                                        @mikeS Thanks so much for your reply, it's working perfectly now.

                                        1 Reply Last reply
                                        1
                                        • meanmrgreenM Offline
                                          meanmrgreenM Offline
                                          meanmrgreen
                                          wrote on last edited by
                                          #25

                                          @Jim Danforth
                                          Getting the same, have tried a number of different DHT libraries and cant get it to compile.

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


                                          19

                                          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