A simple implementation of a DHT-22 sensor with an ESP-32
- 1 ESP-32 dev module (at least 30 pins)
- 1 DHT-22 sensor
- 3 jumper cables
- 1 breadboard
-
To supply power to the DHT-22, you'll need to wire the ESP-32's 3v3 pin to the DHT-22's VCC pin.
-
To transfer data from the sensor to the microcontroller, you'll have to wire the DHT-22's DATA pin to the ESP-32's GPIO 4 pin.
(You can use any GPIO pin, but you'll need to modify the source) -
Wire sensor's GND pin to microcontroller's GND pin
| ESP32 | DHT22 |
|---|---|
| 3v3 | VCC |
| GPIO 4 | DATA |
| GND | GND |
- Download and install the arduino ide.
- Open the project.
- Connect your ESP-32 to your computer using a USB-C cable (can be a USB-B cable, depends on the model)
- Go to File > preferences and paste "https://dl.espressif.com/dl/package_esp32_index.json" into the "additionnal boards" text input.
- Next, you'll need to install DHT sensor library from Adafruit in the library manager (3rd icon on the left sidebar).
- Go to Tools > board > esp32 and select ESP32 Dev Module.
- Go to Tools > board > port and select the correct COM port.
- Falsh with the top left arrow button !
- Open the serial monitor, select 115200 baud, and wait for output.

