Comments on: MicroPython: ESP32/ESP8266 with DHT11/DHT22 Temperature and Humidity Sensor https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/ Learn ESP8266, ESP32, Arduino, and Raspberry Pi Thu, 15 Feb 2024 10:28:04 +0000 hourly 1 https://wordpress.org/?v=6.8.2 By: Sara Santos https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-891483 Thu, 15 Feb 2024 10:28:04 +0000 https://randomnerdtutorials.com/?p=84480#comment-891483 In reply to Sky Agnitti.

Hi.
What code exactly are you running?
What microdot.py are you referring to?
Regards,
Sara

]]>
By: Sky Agnitti https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-891303 Wed, 14 Feb 2024 22:54:51 +0000 https://randomnerdtutorials.com/?p=84480#comment-891303 Are the links in this tutorial still working? I keep trying to just use the 2 microdot.py files mentioned but they aren’t available. I’ve tried to use some of the library files for asyncio but I keep getting errors like these:
File “main.py”, line 4, in
File “microdot_asyncio.py”, line 8, in getattr
File “asyncio/init.py”, line 1, in getattr

Any reading this, can you help? I’m trying to have my esp32s running some sort of templated API system and I am at a complete roadblock. Also tried the esp32 – microWebSrv github situation and not much better luck with that though I was able to get the API server to startup.

]]>
By: Nando https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-800110 Tue, 29 Nov 2022 17:54:52 +0000 https://randomnerdtutorials.com/?p=84480#comment-800110 temp is class int, can I have class float?

]]>
By: David https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-749033 Sat, 14 May 2022 16:30:36 +0000 https://randomnerdtutorials.com/?p=84480#comment-749033 from dht import DHT22

sensorDHT = DHT22(Pin(32))

<ImportError: can’t import name DHT22>

]]>
By: Ralf https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-724802 Tue, 08 Feb 2022 22:42:12 +0000 https://randomnerdtutorials.com/?p=84480#comment-724802 May be too late but my experiences showed, that a pullup-resistor to Vcc is essential for reading. I put a 10k resistor from GPIO14 to 3.3V and it works.

]]>
By: Vxr https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-718327 Wed, 12 Jan 2022 15:12:34 +0000 https://randomnerdtutorials.com/?p=84480#comment-718327 Thanks for this tutorial. Very helpful.
Just one mention regarding the DHT11 library – temperature and humidity are now properties so if you want to refer to them don’t use the parenthesis:

from:
temp = sensor.temperature()
hum = sensor.humidity()

to:
temp = sensor.temperature
hum = sensor.humidity

Hope it helps.

]]>
By: Daniel Escasa https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-694142 Fri, 05 Nov 2021 03:31:26 +0000 https://randomnerdtutorials.com/?p=84480#comment-694142 In reply to Daniel Escasa.

Oops, comment in wrong post

]]>
By: Daniel Escasa https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-693895 Thu, 04 Nov 2021 12:25:27 +0000 https://randomnerdtutorials.com/?p=84480#comment-693895 Excellent tutorial! I got a “Micropython starter kit” which had the exact same boards: an ESP32, an SDD1306, and a DHT11. I was afraid at least the OLED module didn’t work since it didn’t seem to power up whether I connected it to the ESP32, or direct to the breadboard. I think it was uploading ssd1306.py to the board that brought it to life, and I got “Hello World” displayed on it.

I also appended your code for the DHT11 to main.py, modifying it to send output to the OLED module instead. After a little futzing with the parameters to oled.text, the temperature and humidity show up below the Hello World strings.

Next up: a nicer format instead of the bare numbers, and installing larger fonts so the numbers take up more of the screen. The “Hello World” strings can go

]]>
By: Sara Santos https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-504575 Fri, 09 Oct 2020 10:58:26 +0000 https://randomnerdtutorials.com/?p=84480#comment-504575 In reply to Nick Cox.

Hi.
Can you try powering the sensor using 5V instead?
I also recommend reading this troubleshooting guide that may help: https://randomnerdtutorials.com/solved-dht11-dht22-failed-to-read-from-dht-sensor/
Regards,
Sara

]]>
By: Nick Cox https://randomnerdtutorials.com/esp32-esp8266-dht11-dht22-micropython-temperature-humidity-sensor/#comment-504299 Thu, 08 Oct 2020 15:13:24 +0000 https://randomnerdtutorials.com/?p=84480#comment-504299 Hello!

Please help – I am having trouble making this program work.

Here’s the situation:
-My board is an ESP8266 nodeMCU (Geekreit DOIT ESP-F Devkit v4, if it matters), running MicroPython v. 1.13.
-My DHT11 module is the kind with the little breakout board and three pins – data, power and ground, respectively. I have the data pin attached to GPIO 14 as per your program, and the other pins attached to the adjacent GND and 3V3 pins.

So I copy-pasted your code and uploaded it to my board using Thonny, but all I get is “Failed to read sensor.”

I can blink an LED with this board using MicroPython, so that’s not the problem. I can also get the DHT11 to work with an Arduino, so that’s not the problem either. I have checked the wiring over and over and I know it’s correct. What am I doing wrong?

]]>