Basic Circuit
Basic Circuit
The basic circuit connects the DHT11 or DHT22 sensor directly to the ESP32. The sensor’s VCC pin is connected to the ESP32 3.3V pin, providing the required operating voltage. The sensor’s GND pin is connected to the ESP32 GND pin to provide a common electrical reference.
The DATA pin of the DHT sensor is connected to ESP32 GPIO 4. This digital pin is used by the ESP32 to receive the temperature and humidity measurements from the sensor. The connection should be kept secure because a loose data connection can cause unstable or incorrect readings.
When required by the particular DHT sensor configuration, connect a 10kΩ pull-up resistor between DATA and 3.3V. This resistor helps keep the digital data line at a stable HIGH level when the sensor is not actively transmitting data.
The complete connection can therefore be summarized as DHT VCC → ESP32 3.3V, DHT GND → ESP32 GND, and DHT DATA → ESP32 GPIO 4. After these connections are made, the ESP32 can be programmed to periodically read the sensor and display or process the temperature and humidity values.