Page 1 of 1

esp8266-01 using dht11 sensor not working

Posted: Sun Apr 11, 2021 10:31 pm
by pytyler
I am using esp8266-1m-20210202-v1.14.bin on a esp8266, esp-01 and have a dht11 3 pin sensor connected to GPIO2
I have tried:
from machine import Pin
from dht import DHT11
import time
sensor = DHT11(Pin(2))
sensor.measure()
dht_temperature = sensor.temperature()
dht_humidity = sensor.humidity()
print('temperature:',dht_temperature)
print('humidity:',dht_humidity)

and I get:
dht.py line 16 in measure
OSError:[Errno110] ETTIMEDOUT
Is there a way to get it to read temperature and humidity using the esp-01 module?