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.
  • 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
                • meanmrgreenM Offline
                  meanmrgreenM Offline
                  meanmrgreen
                  wrote on last edited by
                  #30

                  Finaly got it to compile.
                  I tried the library link above but no go, cleared out everything about ardouino on the pc, no go.

                  I finaly stubled onto this:
                  https://github.com/mysensors/MySensorsArduinoExamples
                  Downloaded all the expample libraries, loaded the scetch and it worked!

                  Something is up with the linked library on this page i think

                  mfalkviddM 1 Reply Last reply
                  0
                  • meanmrgreenM meanmrgreen

                    Finaly got it to compile.
                    I tried the library link above but no go, cleared out everything about ardouino on the pc, no go.

                    I finaly stubled onto this:
                    https://github.com/mysensors/MySensorsArduinoExamples
                    Downloaded all the expample libraries, loaded the scetch and it worked!

                    Something is up with the linked library on this page i think

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

                    @meanmrgreen the link pointed to a folder on GitHub. If that folder is downloaded, you get the MySensorsExamples. But in that folder, there is also a link to the original DHT library. If that link is followed, the wrong library will be downloaded.

                    Several people have been bitten by this so I have now changed the link to point directly to the MySensorsExamples zip file.

                    1 Reply Last reply
                    0
                    • OliO Offline
                      OliO Offline
                      Oli
                      wrote on last edited by
                      #32

                      Could someone explain me why "Must be >1000ms for DHT22 and >2000ms for DHT11" when sampling rate is once per sec for DHT11 (once per 1000ms) and twice per sec for DHT22 (once per 500ms)?

                      1 Reply Last reply
                      0
                      • AmputA Offline
                        AmputA Offline
                        Amput
                        wrote on last edited by
                        #33

                        In Wiring Things Up and screen are used DATA_PIN 3, but in example is wrote #define DHT_DATA_PIN 2 :-) ...please correct it.

                        hekH 1 Reply Last reply
                        1
                        • AmputA Amput

                          In Wiring Things Up and screen are used DATA_PIN 3, but in example is wrote #define DHT_DATA_PIN 2 :-) ...please correct it.

                          hekH Offline
                          hekH Offline
                          hek
                          Admin
                          wrote on last edited by
                          #34

                          @Amput,

                          Thanks, updated.

                          1 Reply Last reply
                          1
                          • skywatchS Offline
                            skywatchS Offline
                            skywatch
                            wrote on last edited by
                            #35

                            @hek

                            No it is not fixed!

                            mfalkviddM 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
                              #36

                              @hek how do I change fro C to F?

                              mfalkviddM 1 Reply Last reply
                              0
                              • skywatchS skywatch

                                @hek

                                No it is not fixed!

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

                                @hek I think @skywatch meant that the text is updated, but not the picture. The picture is still using pin 3.

                                1 Reply Last reply
                                0
                                • ramoncarranzaR ramoncarranza

                                  @hek how do I change fro C to F?

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

                                  @ramoncarranza set your controller to use non-metric.

                                  1 Reply Last reply
                                  0
                                  • hekH Offline
                                    hekH Offline
                                    hek
                                    Admin
                                    wrote on last edited by
                                    #39

                                    Yes, didn't see that one @mfalkvidd. Hmm.. Not sure I have the source photoshop psd available any more.

                                    mfalkviddM 1 Reply Last reply
                                    0
                                    • hekH hek

                                      Yes, didn't see that one @mfalkvidd. Hmm.. Not sure I have the source photoshop psd available any more.

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

                                      @hek you mean you delete files? :fearful:

                                      1 Reply Last reply
                                      0
                                      • hekH Offline
                                        hekH Offline
                                        hek
                                        Admin
                                        wrote on last edited by
                                        #41

                                        Ha, probably not, just a matter of find it. :sweat:

                                        1 Reply Last reply
                                        0
                                        • skywatchS Offline
                                          skywatchS Offline
                                          skywatch
                                          wrote on last edited by
                                          #42

                                          What @Skywatch meant was that "#define DHT_DATA_PIN 2" is STILL in the example code on this page. Anyone who even gets as far as working it all out and wiring it all up and it still it won't work like that! - Not when it needs to be connected to PIN 3 instead (esp if the NRF is using pin 2, which is likely).
                                          Happy New Year to you all! :)

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


                                          15

                                          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