Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    Pure Python library for reading DHT sensor on Pycom boards

    Scheduled Pinned Locked Moved Discussion
    dht dht11 dth22
    57 Posts 8 Posters 29.5k Views 9 Watching
    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.
    • Jurassic PorkJ Offline
      Jurassic Pork @geda
      last edited by Jurassic Pork

      @geda
      have you a dht22 module or simply a dht22 component ?
      have you a pullup resistor on the signal pin of your dht22 ?
      what pin of your lopy are you using for the dht22 ?
      hello robert-hh same idea :-) in the same time

      1 Reply Last reply Reply Quote 0
      • robert-hhR Offline
        robert-hh @geda
        last edited by

        @geda Which Pin are you using. Note that P13..P18 are input only and cannot be used for that purpose.
        see here: https://docs.pycom.io/pycom_esp32/_downloads/lopy_pinout.pdf

        1 Reply Last reply Reply Quote 0
        • RobTuDelftR Offline
          RobTuDelft @geda
          last edited by

          @geda Yes, I use the latest library from @Jurassic-Pork.

          This example works for me, maybe that helps.

          I used a 4k7 resistor between data and +.

          AM2302 circuit

          Without data you're just another person with an opinion.
          Hackster | About me

          G R 2 Replies Last reply Reply Quote 1
          • G Offline
            geda @RobTuDelft
            last edited by geda

            @RobTuDelft Thanks ! It works ! I made a mistake on my breadboard and had the wrong GPIO on my extension board.
            Thanks for your help, I have really appreciated it !

            Temperature: 23.30
            Humidity: 43.90  

            And thanks to Jurassic Pork for porting the library

            1 Reply Last reply Reply Quote 0
            • palmy-nzP Offline
              palmy-nz
              last edited by palmy-nz

              I am still getting false. Using DHT11, pins double checked and, module works on arduino.

              using @RobTuDelft 's main.py, but changed th = DTH(Pin('P4', mode=Pin.OPEN_DRAIN),0)
              as using GHT11 on Pin G11 on expansion board

              any ideas?
              Thanks guys

              Jurassic PorkJ L 2 Replies Last reply Reply Quote 1
              • Jurassic PorkJ Offline
                Jurassic Pork @palmy-nz
                last edited by

                hello,
                @palmy-nz
                what is your power supply for your DHT11 ? 5 v or 3,3 v ?
                are you using my library here ?
                have you a pull up resistor to 3,3v on the pin signal of your DHT11 ?
                have you try another expand board pin ? for example P3

                Friendly, J.P

                palmy-nzP 1 Reply Last reply Reply Quote 0
                • palmy-nzP Offline
                  palmy-nz @Jurassic Pork
                  last edited by

                  Hi @Jurassic-Pork, yes I am using your dht library.
                  and yes I have tried pulling it up to 3.3v and 5v, and have tried other pins.
                  Not sure what the problem is.
                  Here is my main py: https://gist.github.com/tairea/3607708a403b7501de142d125b07b7b8
                  and photo of set up: https://pasteboard.co/1p8ETKipZ.jpg

                  1 Reply Last reply Reply Quote 1
                  • L Offline
                    livius @palmy-nz
                    last edited by livius

                    @palmy-nz said in Pure Python library for reading DHT sensor on Pycom boards:

                    Pin G11 on expansion board

                    G11? If is see this right
                    in code you have P3 which is G24 not G11.
                    G11 is P4.
                    Or did you changed it from previous post?
                    Image quality is not enough to say for sure.

                    P.S. i have upvoted your posts then you can now write faster - and maybe you will be allowed to post images directly

                    think about people first, then computers

                    palmy-nzP 1 Reply Last reply Reply Quote 0
                    • palmy-nzP Offline
                      palmy-nz @livius
                      last edited by

                      @livius I was trying other pins in the code example and photo and am making sure they match. Has to be something else?

                      Jurassic PorkJ 1 Reply Last reply Reply Quote 0
                      • Jurassic PorkJ Offline
                        Jurassic Pork @palmy-nz
                        last edited by Jurassic Pork

                        @palmy-nz
                        on the photo , it seems that you have wired the dht11 in a strange manner.
                        alt text

                        it must be :
                        3.3v on pin 1
                        signal on pin 2
                        gnd on pin 4

                        may be it is not the same chip.

                        palmy-nzP 1 Reply Last reply Reply Quote 0
                        • palmy-nzP Offline
                          palmy-nz @Jurassic Pork
                          last edited by palmy-nz

                          @Jurassic-Pork
                          I am using this DHT11 sensor...
                          https://pasteboard.co/e4ZITp59g.png
                          This image just made me realize the pull up resistor is already embedded.
                          I have removed the resistor i had in my circuit, but still the same problem.

                          Jurassic PorkJ 1 Reply Last reply Reply Quote 0
                          • Jurassic PorkJ Offline
                            Jurassic Pork @palmy-nz
                            last edited by Jurassic Pork

                            @palmy-nz
                            ok it seems good for your module and you have a pull up resistor on your module.
                            be careful if you have powered your module with 5v may be you have the signal pin on your pycom module out of order. Try to check it without the dht11 module (input level 0 (gnd) input level 1 (pull up resistor to 3.3v)).

                            palmy-nzP 1 Reply Last reply Reply Quote 0
                            • palmy-nzP Offline
                              palmy-nz @Jurassic Pork
                              last edited by

                              @Jurassic-Pork
                              I got it working now. the problem was i was running an older firmware, after updating to latest, it seems to be working now.
                              Thanks to @livius for troubleshooting it with me.
                              and @Jurassic-Pork for the library.
                              This is a great forum.

                              1 Reply Last reply Reply Quote 0
                              • R Offline
                                robmarkcole @RobTuDelft
                                last edited by

                                @RobTuDelft in Pure Python library for reading DHT sensor on Pycom boards:

                                Hi Rob, using your library (https://github.com/rbraggaar/DHT_PyCom), DHT22 on Wipy with 10 kOhm pullup, I am getting a temp of 25 deg (correct) but humidity of 99.9% (incorrect). Any ideas what could be wrong?
                                Cheers

                                RobTuDelftR 1 Reply Last reply Reply Quote 0
                                • RobTuDelftR Offline
                                  RobTuDelft @robmarkcole
                                  last edited by RobTuDelft

                                  @robmarkcole that one I forked from JP. I was using a 4k7 resistor and it worked well.

                                  Do you have print('Humidity: {:3.2f}'.format(result.humidity / 1.0))? And
                                  You did declare the sensor object as th = DTH(Pin('P3', mode=Pin.OPEN_DRAIN), 1)? The last one declares it as a DHT22.

                                  Does the humidity fluctuate at all?

                                  Without data you're just another person with an opinion.
                                  Hackster | About me

                                  R 1 Reply Last reply Reply Quote 0
                                  • R Offline
                                    robmarkcole @RobTuDelft
                                    last edited by

                                    @RobTuDelft Yes used those. Humidity and temp constant. Swapped in a DHT11 now and seeing same behaviour. Any tips on how to debug?
                                    Cheers

                                    RobTuDelftR 1 Reply Last reply Reply Quote 0
                                    • RobTuDelftR Offline
                                      RobTuDelft @robmarkcole
                                      last edited by

                                      @robmarkcole Can you try it with a 4k7 resistor, maybe 10k is too much? You could also post a picture of your setup and the code fragments you are using.

                                      Without data you're just another person with an opinion.
                                      Hackster | About me

                                      R 1 Reply Last reply Reply Quote 0
                                      • R Offline
                                        robmarkcole @RobTuDelft
                                        last edited by

                                        @RobTuDelft I would, but I only have 1 and 10 k Ohm available at the moment.

                                        0_1496691300215_upload-20d267d5-acb8-46c0-9a1b-92b7165af7a6

                                        R 1 Reply Last reply Reply Quote 0
                                        • R Offline
                                          robmarkcole @robmarkcole
                                          last edited by

                                          Annoyingly I am unable to upload the code, as it is 'marked as spam' when I try. Nevertheless I am just using the examples in your Github repo

                                          Jurassic PorkJ 1 Reply Last reply Reply Quote 0
                                          • Jurassic PorkJ Offline
                                            Jurassic Pork @robmarkcole
                                            last edited by Jurassic Pork

                                            hello,
                                            @robmarkcole
                                            to see what is wrong, you can uncomment some lines in the file dht.py. The lines 49, 53, 54, 63 with the print function.
                                            you must see something like that for the dht11 :
                                            0_1496716130654_print_dht11_data.png

                                            the last line in the photo (line 63 print(the_bytes)) has the values for the humidity (32) and for the temperature (22).
                                            May be something is wrong with the WiPy module :
                                            i use a SiPy module and the other people who have used the library seems to use a LoPy module. If someone can try to use the library with a WiPy module to see if it is OK.

                                            Friendly, J.P

                                            R 1 Reply Last reply Reply Quote 0

                                            Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                                            Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                                            With your input, this post could be even better 💗

                                            Register Login
                                            • 1
                                            • 2
                                            • 3
                                            • 2 / 3
                                            • First post
                                              Last post

                                            Pycom on Twitter

                                            Pycom