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.
  • skywatchS Offline
    skywatchS Offline
    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
                                  • mikeSM Offline
                                    mikeSM Offline
                                    mikeS
                                    wrote on last edited by
                                    #26

                                    @meanmrgreen The only DHT library that will work is the one from the link before the sketch. If you have used others chances are you need to move or rename those other DHT libraries as that is why the sketch cannot call that function.

                                    meanmrgreenM 1 Reply Last reply
                                    0
                                    • mikeSM mikeS

                                      @meanmrgreen The only DHT library that will work is the one from the link before the sketch. If you have used others chances are you need to move or rename those other DHT libraries as that is why the sketch cannot call that function.

                                      meanmrgreenM Offline
                                      meanmrgreenM Offline
                                      meanmrgreen
                                      wrote on last edited by
                                      #27

                                      @mikeS

                                      Ive tried to reinstall and start från scratch but i guess i Missed something.

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

                                        @meanmrgreen sometimes windows puts libraries in your documents folder, so they may be located in 2 or more places. Use windows search to find them all. I have 3 DHT libraries, the mysensors one, the adafruit(I think) and another that came with an MQTT based sketch for an ESP board. I just rename them. Incidentally the mysensors DHT library gives me the most accurate results, as much as 2 degrees and 10% out on the same sensor using a different library.
                                        Also don't update the DHT library if you are told there is an update!
                                        As you can tell I had a few problems myself before I got this working, it almost made me disregard the whole project. Keep trying , it's worth it.

                                        meanmrgreenM 1 Reply Last reply
                                        0
                                        • mikeSM mikeS

                                          @meanmrgreen sometimes windows puts libraries in your documents folder, so they may be located in 2 or more places. Use windows search to find them all. I have 3 DHT libraries, the mysensors one, the adafruit(I think) and another that came with an MQTT based sketch for an ESP board. I just rename them. Incidentally the mysensors DHT library gives me the most accurate results, as much as 2 degrees and 10% out on the same sensor using a different library.
                                          Also don't update the DHT library if you are told there is an update!
                                          As you can tell I had a few problems myself before I got this working, it almost made me disregard the whole project. Keep trying , it's worth it.

                                          meanmrgreenM Offline
                                          meanmrgreenM Offline
                                          meanmrgreen
                                          wrote on last edited by
                                          #29

                                          @mikeS thanks alot!
                                          I'll keep that in mind. Should be getting my "starter kit" order soon from eBay so we'll see how it goes ;)

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


                                          8

                                          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