DHT11 Sensor Read Issue with MicroPython on Zephyr (ESP32)

Hello guys based on my project simple temperature monitoring system using MicroPython on a Zephyr RTOS-supported microcontroller, such as the ESP32, and transmit the data over Bluetooth Low Energy (BLE) to a mobile app?. Am currently trying to integrate the DHT11 Sensor with MicroPython on Zephyr reading temperature and humidity data from the DHT11 sensor using MicroPython on Zephyr. But my code fails to read from the DHT11 sensor can anyone help me resolve this
OSError: [Errno 110] ETIMEDOUT
OSError: [Errno 110] ETIMEDOUT
import machine
import dht
import time

sensor = dht.DHT11(machine.Pin(4))

while True:
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
print("Temperature: {}°C, Humidity: {}%".format(temp, hum))
time.sleep(2)
import machine
import dht
import time

sensor = dht.DHT11(machine.Pin(4))

while True:
sensor.measure()
temp = sensor.temperature()
hum = sensor.humidity()
print("Temperature: {}°C, Humidity: {}%".format(temp, hum))
time.sleep(2)
1 Reply
Dark AI
Dark AI4mo ago
Hi, @Enthernet Code You can try adding a small delay before calling sensor.measure() to stabilize the sensor. The DHT11 sensor is sensitive to timing. reach out if you have any other challenge.
Want results from more Discord servers?
Add your server