How to Hookup Arduino to the AM2302 Temperature - Humidity Sensor
The AM2302 is the DHT22 sensor mounted inside a protective plastic case. It has three wires (PWR, GND and Data) ready for connecting to the Arduino. There is a pull up resistor included in the sensor so we do not need to install one when connecting to the Arduino.
Hardware and Software Parts List
- Arduino Board
- AM2302 Sensor. We used the Adafruit PN
- 10K Pullup Resistor
- Breadboard hookup wires
- USB Cable to suite Arduino
- Sample Sketch ( )
- AM2302 Library ( )
Wiring diagram for connecting AM2302 Sensor to Arduino Board
No pullup resistor is required as it is already installed between the PWR and Data wires inside the sensor.
To test this sensor we can use sample sketch shown below. You can download the sketch file and the cactus.iolibrary to communicate with the sensor. It reads the AM2302 every 3 seconds and prints the results to the console on the computer connected to the USB port on the Arduino.
We are using digital pin 2 to connect to the data pin on the sensor. If you are using a different digital pin then you will need to change the pin number defined on line 6 in the sketch code.Software Limitations
- Supports only one sensor on the data pin.
- Blocking Code - Nothing else is done until a sensor read is complete