Troubleshooting OSError with DHT22 Sensor in ESP32 MicroPython Real-Time Control System
Hi guys @Middleware & OS , am developing a real-time control system using an
ESP32
, MicroPython, and an ML model to predict temperature based on sensor(DHT22
) readings, and integrate it with a relay to control a heating element. I have setup flash MicroPython firmware on the ESP32
, connected the DHT22
sensor to the ESP32
(data pin to GPIO 4
), connected the relay module to control the heating element (relay input to GPIO 5
).
But am getting the error
Failed to read sensor: OSError
This is my code![attachment 0](https://cdn.answeroverflow.com/1264624107685679247/file0.jpg)
4 Replies
Are u sure that the wiring is correct!
Yes I ahv checked that is properly connected
What about the DHT library make sure it's compatible with micropython version...
Since esp32 comes in different pin layout you can try debugging by adding a led to the pin 5 and try to blink it