Raspberry Pi Pico W LESSON 20: Using the DHT11 Temperature and Humidity Sensor in MicroPython

แชร์
ฝัง
  • เผยแพร่เมื่อ 8 ม.ค. 2025

ความคิดเห็น •

  • @robakers6127
    @robakers6127 ปีที่แล้ว +6

    Hello friends, There is bug I canont figure out. So you dont spend hours like I did, I had to do a priming measure in a try/expect construct.## notSure, but I had to do a priming read of the sensor, without this this script would timeout. I hope this helps
    ## I kept getting a timeout error. I don't see it in other peoples code
    ## So not sure why my environment is special
    try:
    sensor.measure()
    except:
    time.sleep(5)

    • @robakers6127
      @robakers6127 ปีที่แล้ว +1

      here is the final solution: th-cam.com/video/0E_24LZgYqw/w-d-xo.html - As always all comments are welcome

    • @paulmcwhorter
      @paulmcwhorter  ปีที่แล้ว +1

      LEGEND!

    • @justmc62
      @justmc62 ปีที่แล้ว

      Thank you so much for your solution. I did not get to the homework yet but could not get Paul's lesson to run correctly either. Kept getting an " OSError: [Errno 110] ETIMEDOUT" .
      I tried using a 3 pin DHT11 I had from an Elegoo kit I purchased for Paul's Arduino course but to no avail. The 3 pin was a module type with an onboard resistor . Tried code with PULL_DOWN, PULL_UP and no internal Pico resistor. Nothing worked but your try: except: with the Sunfounder supplied 4 pin DHT11 ... Hmmm. 😕

    • @lorisrobots
      @lorisrobots ปีที่แล้ว +1

      I was getting a timeout error as well. When I used a DHT-11 already on a breakout board (with three pins - purchased separately), it worked as Paul showed. With the DHT-11 from our kit, I found your code worked (just using your try except construct). Thanks!

    • @alexandrlysyuk335
      @alexandrlysyuk335 8 หลายเดือนก่อน +1

      I have changed from PULL_DOWN to PULL_UP resistor line. If anyone can explain why it helps it would be great..
      And Everything works without any sleep(1) delay
      #sensorPin= Pin(dataPin,Pin.OUT,Pin.PULL_DOWN)
      sensorPin= Pin(dataPin,Pin.OUT, Pin.PULL_UP)

  • @pauldeheij8350
    @pauldeheij8350 ปีที่แล้ว +2

    I also had the first read problem. After inserting a 2 second sleep after the sensor setup, everything works fine.
    @Paul: thanks so much! A great series with projects that actually work and that I can understand, entertaining presentation and no irritating music!

  • @justmc62
    @justmc62 ปีที่แล้ว +2

    Another great lesson Paul... Love the new formatting of the Print Function. Will be implementing that in most of my future code. Thanks for recognizing Rob's contribution.

  • @cbrombaugh
    @cbrombaugh ปีที่แล้ว

    I AM LEGEND! The good news is that my solution works. The bad news is that I had to use the DHT-11 from my Raspberry Pi Raphael Kit because the Kepler kit DHT-11 does not work. After looking at the other comments I see that there is a work-around for that issue, which I will have to try. What I don't like about my solution is that the 1 second loop delay means that I have to hold the button down for a while to change between C and F. Thanks Paul for another most-excellent lesson.

  • @keithlohmeyer
    @keithlohmeyer ปีที่แล้ว +6

    Hi all, I know some have gotten errors when first reading the sensor [sensor.measure()] I too got the error too and did a little search on the DHT line of sensors. In the same way we need a second two between reads, the sensor seems to need a second between it being created/initialized and the first read. Rob's try/except with a 1 second sleep works fine or you can just put a one second sleep after you create the sensor object like I did.

    • @cbrombaugh
      @cbrombaugh ปีที่แล้ว +1

      Many thanks to Rob Akers and Keith Lohmeyer for providing the fix for the DHT-11 problem. After beating my head against the wall for a couple hours, I finally switched to the DHT-11 from my Raspberry Pi Raphael kit and it worked fine, so I concluded that the DHT-11 in my Kepler kit is defective. After reading Keith's comment I simply added a 1 second delay after creating the sensor object. And voila! both sensors now work.

    • @ke7uia
      @ke7uia ปีที่แล้ว +1

      Oh, my I did receive an error that did not make much sense. Yes, I did hold my breath while running. The error was, ' File "", line 12, in '. The line was 'sensor.measure()'. So I placed a 'time.sleep(1)' after the 'sensor=DHT11(myPin)'.

  • @ChrisWalters-b1g
    @ChrisWalters-b1g 4 หลายเดือนก่อน

    Just want to say a big thank you Paul. Your videos are really helpful.

  • @irvw4510
    @irvw4510 ปีที่แล้ว +1

    I used the dth11 module (3 prong) from the Elegoo "Most complete starter kit Mega 2560" bought for the Arduino course. After a little research and debugging I found the wiring of that module is not the same as the sensor Paul used with 4 pins. For the module I used, the data pin is on the left, the +5 in the center and the ground on the right. Even though that module has a pull-up resistor the code Paul taught works fine after I wired it correctly. Great lesson Paul and thanks for taking the time to share your knowledge in Engineering.

    • @NebulaNuggets3
      @NebulaNuggets3 9 หลายเดือนก่อน

      Hey man, I had a question I am using the same dht11 module but I've wired it the exact same as you except when I run the code, I keep getting the OSError: [Errno 110] ETIMEDOUT. Have you experienced this and if so how did you fix it?

    • @austencook1036
      @austencook1036 4 หลายเดือนก่อน

      @@NebulaNuggets3 i fixed it underneath the sensor declaration with sensor=DHT11(myPin) and underneath time.sleep(2)

  • @SirSurreal
    @SirSurreal ปีที่แล้ว

    Thank you. The tutorial worked with the Keyestudio DHT11 which required +5v supply but worked just fine on the Pico's 3V3(OUT).

  • @stephenlightkep1621
    @stephenlightkep1621 ปีที่แล้ว +1

    I am always behind I had a few problems! Thanks for making all these great lessons!

  • @AikinsGlen
    @AikinsGlen 27 วันที่ผ่านมา

    If you take a look at the code for the temperature project on the SUNFOUNDER website, there are a few clues to solving the reading error problem. Adding delays helps with stability. As Paul's tip in the video description indicates, add a delay when initialising in the code. I found a 5 second init delay was pretty stable. In addition, the sensor isn't fond of repeated reads. It'll work OK with a minimum 2 second delay between reads, but found very good reliabilty with a 10 second delay (but no very functional for the button toggle homework).
    myPin=Pin(dataPin,Pin.OUT,Pin.PULL_DOWN)
    sensor=DHT11(myPin)
    time.sleep(5)
    while True:
    r_btnStateNow=r_btn.value()
    time.sleep(0.01)
    if r_btnStatePrev==0 and r_btnStateNow==1:
    tempUnitC= not tempUnitC
    try:
    sensor.measure()
    tempC=sensor.temperature
    tempF=round((tempC*9/5)+32,1)
    hum=sensor.humidity
    time.sleep(2)
    except InvalidPulseCount as e:
    print("
    ",'Bad pulse count - retrying ...',end='')

  • @brucemilyko8549
    @brucemilyko8549 ปีที่แล้ว

    Love the one line formatting. On a Mac you can type ° easily using the key combination option-shift-8.

  • @qzorn4440
    @qzorn4440 ปีที่แล้ว

    The "
    " hold in place, no scrolling is most interesting. 🥳 Thank you.

  • @andthatswhy5198
    @andthatswhy5198 4 หลายเดือนก่อน

    thank you for the error-fixer in the description!, i was getting an error but its fixed now

  • @davidh1187
    @davidh1187 9 หลายเดือนก่อน

    For the homework exercise, I can achieve the switch between f and C BUT since I am not using an interrupt the temp and humidity read only occurs when I press the button as well.

  • @MorrWorm8
    @MorrWorm8 ปีที่แล้ว

    This channel is top of its class!!

  • @masman1st
    @masman1st 5 หลายเดือนก่อน

    Most interesting, on ESP32 depending on what GPO Pin is used changes where the time.sleep (argument ?) statement line has to be. On one Pin it is above (while True:), on another Pin it is after (while True:), yet on a different Pin it is the last line at the bottom. An then there was one Pin that sleep was needed in two places.

  • @VandDangle
    @VandDangle ปีที่แล้ว +1

    I had an issue
    File "", line 10, in
    which was the sensor.measure() line. Quintuple checked everything then implemented Rob Ackers solution even though it was a different error it solved the issue. Thank you Paul I started this journey to learn how to make a vivarium controller with automated lights water and temperature and this lesson is exciting as it is directly related and I can envision doing it now exciting!

    • @lucarennabass
      @lucarennabass 11 หลายเดือนก่อน

      HI, I have the same issue, could you please post the solution you implemented? Thank you!

  • @charlotteswift
    @charlotteswift ปีที่แล้ว +3

    I posted this comment on lesson 19 by mistake.
    I've rather pre-empted what I think this week's homework will be with this solution as I won't be able to do any homework for at least 2 weeks.
    I've previously used the dht11 and lcd1602 with the pico about 8 months ago when I was trying to do all of Paul's Raspberry Pi lessons using a pico. There's a link to the old (terrible) video in the description.
    Here's the new video: th-cam.com/video/mfymYrhpRzY/w-d-xo.html

  • @stephenlightkep1621
    @stephenlightkep1621 ปีที่แล้ว

    Thanks Paul! I had to modify my code to get it to work. I used Rob Akers fix Thanks Rob.

  • @Ravensheart2000
    @Ravensheart2000 22 วันที่ผ่านมา +1

    Here is my fix to the issues. Time Out float errors, as stated previously the SunFounder code does a work around. I had an issue with the sensor itself. The DHT11 I had kept throwing 100s of bad pulses. It has been replace. My video and it's description explain everything. th-cam.com/video/YkAAiCHhJ74/w-d-xo.htmlsi=Ii0H9CvjurmybKNf
    Now I will go and do the homework.

  • @Ed-fv9rl
    @Ed-fv9rl ปีที่แล้ว

    Thanks Paul!
    I m late because, I moved back to USA from Portugal. Working on catching up.
    😊

    • @paulmcwhorter
      @paulmcwhorter  ปีที่แล้ว

      Welcome back. Now, get CAUGHT UP!

    • @edSabio572
      @edSabio572 ปีที่แล้ว

      @@paulmcwhorter Hi Paul: When I tried to run the program, dht is not present. tried to install using tools menu, but have the following message:
      "Could not fetch search results:
      "
      I could use some advise from the team...

    • @Ed-fv9rl
      @Ed-fv9rl ปีที่แล้ว

      @@edSabio572 Thanks Paul, I had to recreate my profile, get a new email Account. But I was able to continue my work. The certificate issue is gone after I changed my profile and resynced my computer to US time. I will catch up soon...

  • @320mb
    @320mb 2 หลายเดือนก่อน

    I kept getting a syntax error on line 14 also, Thonny confuses the Quote marks for some reason...
    I fixed it with this >>>
    print("
    ", "Temp =", tempC,chr(176) + "C ", "Humidity = ",hum,"%", end =" ")
    time.sleep(5)

  • @masman1st
    @masman1st 5 หลายเดือนก่อน

    Change print line to print("
    ", 'Temp is',tempF,chr(176)+'F or',tempC,chr(176)+'C &','Humidity is',hum,'%',end='') it will show both F or C & H.

  • @jensdietze3465
    @jensdietze3465 8 วันที่ผ่านมา

    I don’t understand why (myPin) is an Output. Because the pico is reading the value of the sensor and sensors always make an Input signal. This is a little bit strange for me.

  • @iampad545
    @iampad545 ปีที่แล้ว +3

    Paul, will you be covering raspberry pi pico PIO assembly coding?

    • @robakers6127
      @robakers6127 ปีที่แล้ว

      I have been looking at this to. Not so sure I understand much other than a couple of videos. I looked at books for Assember, but could not determine which one was the best. Anyone have any suggestions?

    • @keithlohmeyer
      @keithlohmeyer ปีที่แล้ว

      @@robakers6127 My understanding is PIO has a very limited cmd set so I would think a general book on assembly language would be less helpful. In my mind PIO is for the people that write libraries that need super fast execution such as Neopixels or audio.

    • @iampad545
      @iampad545 ปีที่แล้ว

      @@robakers6127 Had hoped Paul would be covering this incredible feature of the pi pico. The I/O using this becomes incredibly powerful. Let you know if I find out any more about it.

    • @keithlohmeyer
      @keithlohmeyer ปีที่แล้ว

      @@iampad545 Hi a good place to start is the rp2040 datasheet section 3. The Micro Python docs only have a one page tutorial and example that I see but there are quite a few YT vids on it. Adafruit also has a tutorial and some example code but it is based on their Circuit Python implementation of the PIO using their library modules. It is still an interesting read. Hope this helps.

  • @Ravensheart2000
    @Ravensheart2000 29 วันที่ผ่านมา

    Issue #1 In the words of cousin Eddie "Clark, that's a real humdinger". Ok 2 issues arose. 1. Wrote your code word for word and kept getting a float Error. It took a week and half to figure it out. IT was very much like Wren's space madness. None the less the float return was coming from using 'sensor.temperature()'. Don't know why it works but if you use 'sensor.temperature' with no parenthesis. It works. Issue #2 Once the code started working I kept getting bad pulse errors. To no avail. Come to find out the pins are kind of shoddy, very thin, they don't have a solid connection with the bread board. So for a permanent fix I soldered bread board jumper wires to the module, plugged them in without paying attention to the positive and negative pins and melted my DHT11 sensor. New ones arrive Friday, I will have a video showing all the issues. 😯 SunFounder's MicroPython code for the sensor allows for bad pulse errors, that will occur every once in a great while, but still I would get 5 good reads and then 200 pulse errors. No I have not yet folded up on this lesson! "I'll be Ba'cK!"

  • @jbelmont72
    @jbelmont72 ปีที่แล้ว

    I am getting the following error message and tried the various fixes.(can't find Akers referred to fix, I have added multiple delays as recommended). I have a three prong DHT11 which I understand has a pull up resistor. wondering if that makes the difference. the message I receive is: MPY: soft reboot
    Traceback (most recent call last):
    File "", line 33, in
    File "dht.py", line 1, in measure
    OSError: [Errno 110] ETIMEDOUT

    • @todd3c
      @todd3c 11 หลายเดือนก่อน

      After you create an instance of the sensor put in a sleep of 1 second.

  • @ErlankBru
    @ErlankBru 2 หลายเดือนก่อน

    A mistake I just made, not because I didn't listen, but because I'm too cautious, was to go and place a resistor at the data pin of DHT22. Before troubleshooting too much I should've just taken out the resistor, but I get even mOre easily distracted so I didn't think about the fact that we already programmed the pull-down resistor to do the job of the physical resistor. In case my mistake helps anyone😇

  • @israelpurdum9470
    @israelpurdum9470 ปีที่แล้ว

    I am trying to do this same project, but when I type the .measure() command the shell gives me the error code:
    Traceback (most recent call last):
    File "", line 12, in
    File "dht.py", line 1, in measure
    OSError: [Errno 110] ETIMEDOUT

    • @olisad5413
      @olisad5413 ปีที่แล้ว

      Hi I had the same problem. I'm using the 3 pin DHT11 not sure if you do as well. But in the example he uses DHT11 with the pull down resistor. I think the 3 pins have something of a pull up resistor. So, following the same code in the video, change line 7 to: myPin= Pin(dataPin, Pin.IN, Pin.PULL_UP). This worked for me. Hope it helps :)

  • @scottwait3585
    @scottwait3585 ปีที่แล้ว

    Thank you Paul!

  • @Dubot-f1v
    @Dubot-f1v ปีที่แล้ว

    Cool video perfect for my first pico project. I have an 11 on hand. Is there a on board temp and humidity sensor ? I think I heard some mention of it somewhere.

    • @zoro.73
      @zoro.73 ปีที่แล้ว

      picoW has an onboard temp sensor connected to ADC4

  • @patrykuczak1975
    @patrykuczak1975 ปีที่แล้ว

    Hi Paul, great video like always! I have a question for you. Are you planning some series about ESP32? It would be great to see you making videos about programming this especially in C language but micropython would be good too.

  • @vishwanathmali4338
    @vishwanathmali4338 ปีที่แล้ว

    Paul, Will you be covering tensorflow lite?, which is used to run Machine learning models using Pico

    • @paulmcwhorter
      @paulmcwhorter  ปีที่แล้ว

      I cover that in the Raspberry PI class. Dont think pico is powerful enough for tensorflow lite

  • @FranciscoCruz-jg7gc
    @FranciscoCruz-jg7gc 9 หลายเดือนก่อน

    time.sleep(1)
    sensor.measure()
    time.sleep(1)
    adding those lines fixed it

  • @GCRickerNH
    @GCRickerNH ปีที่แล้ว

    Hi Paul, I’ve been following this series, but maybe I’ve missed something. I’m confused with this DHT11. In your code you have myPin set as an output pin with a pull down resistor. I didn’t know this was even possible. I thought only input pins used pull up/down resisters to avoid pin floating? How do pull down resistors work with output pins? Why is it even an output pin if it’s reading in from the sensor? Lastly, looking at Rob Acker’s solution, he has it set as a pull up resistor, not pull down? I’m so confused.

    • @keithlohmeyer
      @keithlohmeyer ปีที่แล้ว +1

      The sensor uses a one wire protocol so in the DHT library module a request for data is sent and data is returned over the same pin. I assume that the pin is changed between input and output in the library. In Arduino we use an external pull down resistor on the data pin so I guess using the internal pull down makes the circuit easier.
      Also I think Rob's issue with his code is because he used pull up instead of pull down but that is just a guess.

  • @Video_editor2003
    @Video_editor2003 11 หลายเดือนก่อน

    AttributeError: 'DHT11' object has no attribute 'measure' how to tackle this error sir

  • @fornogg
    @fornogg 10 หลายเดือนก่อน

    The way I ended up getting this to work for anyone getting the error, is by connecting the sensor to VBUS instead of 3V3(OUT)

  • @marciuse70
    @marciuse70 7 หลายเดือนก่อน

    Hi! I get an error when I run the code. I search Google about this unsuccessfully. Can someone help me? Does anyone has the some error?
    from machine import Pin
    import utime as time
    from dht import DHT11
    dataPin = 16
    myPin = Pin(dataPin,Pin.OUT,Pin.PULL_DOWN)
    sensor = DHT11(myPin)
    while True:
    sensor.measure()
    tempC = sensor.temperature()
    hum = sensor.humidity()
    print(tempC, hum)
    time.sleep(1)
    MPY: soft reboot
    Traceback (most recent call last):
    File "", line 11, in
    File "dht.py", line 1, in measure
    OSError: [Errno 110] ETIMEDOUT

  • @FranciscoCruz-jg7gc
    @FranciscoCruz-jg7gc 9 หลายเดือนก่อน

    I fixed the error by adding the sensor.measure() outside the loop
    time.sleep(1)
    sensor.measure()
    time.sleep(1)

  • @LorisHW
    @LorisHW ปีที่แล้ว +3

    Here is my homework. Thanks to Rob Akers for his code to deal with the timeout error. th-cam.com/video/_Z3U62duXbI/w-d-xo.html

  • @PhysicsAssignmentHelp
    @PhysicsAssignmentHelp ปีที่แล้ว +1

    I've written the code, but i'm getting operator system error with .measure(). Does anyone else have this issue too?

    • @keithlohmeyer
      @keithlohmeyer ปีที่แล้ว

      Try adding a one second delay after creating the sensor object. That worked for me.

    • @PhysicsAssignmentHelp
      @PhysicsAssignmentHelp ปีที่แล้ว

      @@keithlohmeyer I did this right now, it works. Thank you Keith!

    • @Ed-fv9rl
      @Ed-fv9rl ปีที่แล้ว

      Adding 1 sec always works. Also

  • @320mb
    @320mb 2 หลายเดือนก่อน

    I looked this up on Google.... and It worked, Fantastic!!
    while True:
    sensor.measure()
    tempC = sensor.temperature()
    tempF = tempC * 9/5 + 32
    hum = sensor.humidity()
    print("
    ", "Temp =", tempF, chr(176) +"F ","Humidity =", hum,"%",end =" ")
    time.sleep(5)

  • @rupadarshisamanta3288
    @rupadarshisamanta3288 ปีที่แล้ว

    from machine import Pin, I2C
    import utime as time
    from dht import DHT11
    dataPin=28
    myPin=Pin(dataPin,Pin.OUT,Pin.PULL_DOWN)
    sensor=DHT11(myPin)
    print('My Sensor Data')
    while True:
    sensor.measure()
    tempC=sensor.temperature()
    hum=sensor.humidity()
    print("
    ", tempC,hum, end='')
    time.sleep(1), when i used this code i faced this error continuously.-
    Traceback (most recent call last):
    File "", line 11, in
    File "dht.py", line 1, in measure
    OSError: [Errno 110] ETIMEDOUT,
    please help me.

    • @mattclark2367
      @mattclark2367 ปีที่แล้ว

      where you able to find a solution? i am having the same bug.

  • @snowman58able
    @snowman58able ปีที่แล้ว

    I am legend. I made one mistake by having my sleep time in the wrong place and corrected it. I also could not remember how to limit my Fahrenheit to one decimal place.

  • @briankelly4095
    @briankelly4095 ปีที่แล้ว +1

    Hi Paul. My lesson 20 homework can be found at th-cam.com/video/VfU5xwmtXYk/w-d-xo.html
    Another classmate & I were coding along with you during the lesson and found that neither of our programs worked. We each needed a sleep statement that you didn't seem to need. Fascinating.
    I wound up with a sleep statement in the 'while True' loop of my homework too. It makes the pushbutton a little unresponsive. No worries for this application but other uses might need an alternate approach. Here's my vote for learning about Pico W interrupts when you think the time is right. Thanks for all the great course material Paul.

  • @Bob-zg2zf
    @Bob-zg2zf ปีที่แล้ว

    I'm glad you cough less often now.

  • @inchworm9311
    @inchworm9311 ปีที่แล้ว

    I think my DHT11 is busted, so instead I used the built-in temp sensor on the pico W:
    adcPin = 4
    sensor = machine.ADC(adcPin)
    adcVal = sensor.read_u16()
    voltage = (3.3/65535) * adcVal
    temperature = 27 - (voltage - 0.706)/0.001721
    Hope that helps anybody else w a broken sensor

  • @keithlohmeyer
    @keithlohmeyer ปีที่แล้ว +1

    Homework complete th-cam.com/video/mtozyW08yR0/w-d-xo.html
    Others were commenting about buttons not being very responsive. I show how I get around that problem.

    • @paulmcwhorter
      @paulmcwhorter  ปีที่แล้ว +1

      Excellent, thanks for posting.

  • @Wythaneye
    @Wythaneye ปีที่แล้ว +1

    Better late than never, my homework for lessons #20 and #21: th-cam.com/video/ViduxGxrOOg/w-d-xo.html

  • @zacremboldt9160
    @zacremboldt9160 4 วันที่ผ่านมา

    Homework completed! 🎉
    th-cam.com/video/Fgcvx9fEUY0/w-d-xo.html
    This one was interesting because I wanted to continuously listen for button presses that would instantly toggle the reading between Celcius and Fahrenheit, but at the same time I only wanted to ask for a temperature reading once every 10 seconds or so.
    I accomplished this by creating a tenth of a second parent loop that listens for button interaction and increments a counter. Then each time the counter hits 100 I get a fresh reading from the temperature sensor and reset the counter.

  • @kev67uk
    @kev67uk ปีที่แล้ว +1

    Another brilliant lesson Paul, thank you. My homework is here, with a basic, slightly buggy version, and a slightly more improved version at the end 😉 th-cam.com/video/s6WubbMIY-E/w-d-xo.html Looking forward to next week's lesson so I can see how we were supposed to do it 😁.

  • @todd3c
    @todd3c 11 หลายเดือนก่อน

    !!!!!!!!!!! IF using the sensor from the kit CHANGE DHT22 to DHT11 (I had a DHT22 in my junk box and used it)
    from machine import Pin
    import utime as time
    from dht import DHT22
    dataPin =16 # setup the DHT22
    myPin=Pin(dataPin, Pin.OUT, Pin.PULL_DOWN)
    sensor = DHT22(myPin)
    time.sleep(1) # Wait 1 second AFTER setting up the sensor otherwise you'll get a data error
    butPin=14 # Button setup
    myButton = Pin(butPin, Pin.IN,Pin.PULL_UP)
    toggle = False
    butLastState = 1
    while True:
    try:
    if myButton.value() == 0 and butLastState: # Button PRESSED
    toggle = not toggle #Toggle between C & F for the temp
    butLastState = 0
    elif myButton.value() ==1: # Button released get ready for next press
    butLastState = 1
    sensor.measure()
    temp=sensor.temperature()
    hum=sensor.humidity()
    if not toggle:
    fc = 'C'
    else:
    fc='F'
    temp=((temp*9)/5)+32
    print("
    ","Temp =",str(temp)+chr(176)+fc, " Humidity =",str(hum)+'%', end=' ')
    time.sleep(1)
    except KeyboardInterrupt:
    break
    except:
    print("Data error from sensor")

  • @freddyveza
    @freddyveza ปีที่แล้ว +1

    My homework link, using timers th-cam.com/video/WuwLBqkQeFs/w-d-xo.html

  • @jameslewellen150
    @jameslewellen150 ปีที่แล้ว +2

    Here is this weeks homework. Nice video Link: th-cam.com/video/G_v1cP6_nQ4/w-d-xo.html

  • @karliskide2460
    @karliskide2460 ปีที่แล้ว +1

    Thank you for an amazing lesson! Here is my homework assignment for this one: th-cam.com/video/zNgVhQbMIhQ/w-d-xo.html The measurement does not look very precise, it seems like DHT11 heats up internally.

  • @TheTechRancher
    @TheTechRancher ปีที่แล้ว

    My Homework Link: th-cam.com/video/DyHkFm3d0Dk/w-d-xo.html Another great video Paul. Looking forward to the next lesson.

  • @davidgoldsmith7475
    @davidgoldsmith7475 ปีที่แล้ว

    I get the error messge Traceback (most recent call last):
    File "", line 12, in
    File "dht.py", line 1, in measure
    OSError: [Errno 110] ETIMEDOUT
    I have used this code on another Raspberry Pico W and it worked fine. I have tried the sleep(1) solution but it does not stop the "dht.py" error.

    • @jbelmont72
      @jbelmont72 ปีที่แล้ว

      I'm getting the same message. What was your solution please?

    • @rupadarshisamanta3288
      @rupadarshisamanta3288 ปีที่แล้ว

      Yeah same problem.
      Did you figure out the solution?

    • @mikeshipley3509
      @mikeshipley3509 ปีที่แล้ว

      same problem here.

    • @mikeshipley3509
      @mikeshipley3509 ปีที่แล้ว

      does anyone have a dht.py in their thonny program folder? There are lots of them & that one is called for.

    • @JulioGuevara-nl6yf
      @JulioGuevara-nl6yf 11 หลายเดือนก่อน

      I just change the pull resistor from DOWN to UP and it seems to work fine. Hope it helps