Arduino Usage

You can easily wire this breakout to any microcontroller, we'll be using an Arduino. For another kind of microcontroller, just make sure it has I2C, then port the code - its pretty simple stuff!

  • Connect Vin to the power supply, 3-5V is fine. Use the same voltage that the microcontroller logic is based off of. For most Arduinos, that is 5V
  • Connect GND to common power/data ground
  • Connect the SCL pin to the I2C clock SCL pin on your microcontroller
  • Connect the SDA pin to the I2C data SDA pin on your microcontroller.

You will also need to add two I2C pullup resistors if your board does not already have them. You can use 2.2K - 10K but we will just use 10K. The resistors go from VDD to SCL and SDA each.

The AM2320 has a default I2C address of 0x5C and cannot be changed.

Install Adafruit Sensor

Open up the Library Manager in the Arduino IDE...

Search for Adafruit_Sensor to locate the Unified Sensor library and Install it

Download Adafruit_AM2320

To begin reading sensor data, you will need to download Adafruit_AM2320 from our github repository. You can do that by visiting the github repo and manually downloading or, easier, just click this button to download the zip

Rename the uncompressed folder Adafruit_AM2320 and check that the Adafruit_AM2320 folder contains Adafruit_AM2320.cpp and Adafruit_AM2320.h

Place the Adafruit_AM2320 library folder your arduinosketchfolder/libraries/ folder.
You may need to create the libraries subfolder if its your first library. Restart the IDE.

We also have a great tutorial on Arduino library installation at:
http://learn.adafruit.com/adafruit-all-about-arduino-libraries-install-use

Load Demo

Open up File->Examples->Adafruit_AM2320->am2320_basictest and upload to your microcontroller wired up to the sensor

Thats it! Now open up the serial terminal window at 9600 speed to begin the test.

You can try breathing on the sensor to increase the humidity.

Last updated on Mar 07, 2018 Published on Mar 07, 2018