Note: The AM2302 module includes an internal pull-up resistor, so no external resistor was required.
Connection diagram
| AM2302 Pin |
ESP32 Connection |
| VCC (+) |
3.3V |
| DATA (OUT) |
GPIO 4 |
| GND (-) |
GND |
Figure 2. Sensor to ESP32 wiring diagram
Development Process
- The AM2302 sensor pins were identified and connected to the ESP32, ensuring proper voltage supply and correct grounding.
- The DHT library (Adafruit) was installed in the Arduino IDE to enable communication between the microcontroller and the sensor.
- A program was uploaded to the ESP32 to read temperature and humidity data from the sensor.
- The serial monitor was opened to visualize real-time environmental data.
Figure 3. Real-time data visualization in serial monitor
During testing, slight variations in temperature and humidity were observed when environmental conditions changed, such as placing a hand near the sensor or blowing air towards it. This confirmed the responsiveness and sensitivity of the sensor.
Figures 4 and 5. Sensor response to environmental changes
Results
The sensor provided stable and reliable readings consistent with the ambient laboratory conditions.
Temperature: 23.00 °C
Humidity: 40.50 %
Temperature: 23.00 °C
Humidity: 40.60 %
Figure 6. Recorded sensor data
It was observed that temperature increased slightly when a hand approached the sensor, and humidity values also changed accordingly. This demonstrates the sensor’s ability to detect environmental variations accurately.
Conclusion
A functional temperature and humidity measurement system was successfully implemented using the AM2302 sensor and the ESP32 microcontroller. The system demonstrated reliable digital communication and real-time data acquisition.
This assignment reinforced the importance of correct electrical connections and proper library configuration for system functionality. Additionally, it highlighted the role of sensors as input devices in embedded systems and their relevance in environmental monitoring and automation applications.