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
4 Replies
wafa_ath
wafa_ath2mo ago
Are u sure that the wiring is correct!
Enthernet Code
Enthernet Code2mo ago
Yes I ahv checked that is properly connected
wafa_ath
wafa_ath2mo ago
What about the DHT library make sure it's compatible with micropython version...
Undefined
Undefined2mo ago
Since esp32 comes in different pin layout you can try debugging by adding a led to the pin 5 and try to blink it
Want results from more Discord servers?
Add your server