Connecting AM2320 With Arduino
Intro: Connecting AM2320 With Arduino
Hi guys. This is my first instructable. I decided to tell you how to connect a humidity and temperature sensor AM2320 to Arduino board.
This sensor is very accurate and sensitive so it's great for high precise measurements. However it's a new sensor and there is almost nothing about it. You must notice that AM2320 is not a DHT series and it requires I2C connection. This is very useful if you are using it for a weather station along with BMP180 which is also I2C.
I tried several libraries with no success until I made it. So if you want to buy an AM2320 here is how to use it with Arduino.
STEP 1: What You'll Need
Part list:
1. Arduino pro mini or compatible board.
2. USB to Serial adapter a.k.a. FTDI (just in case you are using pro mini)
3. AM2320
4. Some wires.
5. Arduino IDE
Some other things:
1. Solder.
2. Cutting tool or knife.
3. Some basic skills.
STEP 2: Soldering the Wires
You'll need to solder some wires to the AM2320 pins because they are very thin to use DuPont connectors directly. However I'm still using DuPont wires but cut in half. Just grab your solder and do it.
Now all you need is to connect everything and use some code of course.
STEP 3: Connecting...
Well this is the easiest part. Just grab the wires and connect them until there is no open wire left.
I'm unable to make a circuit design at this moment so I'll describe the connections.
AM(1) -- 5Vcc
AM(2) -- A4
AM(3) -- Gnd
AM(4) -- A5
STEP 4: Library and Codding
This is the crucial step. I searched a lot and tested a lot and finally I succeeded to put this sensor to work. I found the library in the comments of a Russian blog post. This is how deep I searched for a proper solution :-)
Here is the link for the library at GitHub: AM2320-master
The code is as an example inside so just download and install the library.
STEP 5: Final Tests
As you can see in the screenshot it works. And also you may note that the humidity went more than 99% when I breathed to the sensor.
And that's all. Don't be afraid to test this awesome sensor and share your experience.
I hope you enjoyed my first instructable and sorry for my non-native English :-)
19 Comments
AlexT359 4 years ago
monkhammon 4 years ago
monkhammon 4 years ago
KennethA54 6 years ago
Note that DHT22 emulation is supported - just connect pin 4 to GND (pin 3).
When in DHT22 emulation, one less wire is needed, of course. In DHT22 emulation wiring, my own GitHub project is available to enable multiple devices on Arduinos that have multiple Pin Change Interrupt (PCI) pins (most do). Every PCI pin can support its own DHT-compatible sensor. My demo code will display sensor readings (all or selected) and is intended as a starting framework for end-users willing to modify it to their purposes. It is called
Arduino_DHTs_on_Interrupt_steroids-and-pin-detailer-
StanKaravelikov 6 years ago
Well it's helpful to know that but AM2320 is NOT a DHT series sensor so it won't work with it. But thank you for your note. If I choose to use DHT sensors I'll definitely gonna try it.
kendrome 5 years ago
KennethA54 6 years ago
AdrianH2 5 years ago
I am curious why you haven't tied your sda and slc pins to vcc with 4.7k resistors like the data sheet suggests?
ДмитрийБ38 5 years ago
How to turn on relay if humidity less then 90% and turn on reley2 if temperature less than 14 ?
StanKaravelikov 5 years ago
Hi, you can just assign two variables and assign humidity and temperature values to them. Then you can check with IF statement the values and turn on and off relays. Something like:
if (hum < 90.0) {
digitalWrite(relay1Pin, HIGH);
} else {
digitalWrite(relay1Pin, LOW);
}
Same for relay2 at independant function.
cyzen 6 years ago
Works like a charme! Thank you
philh102 6 years ago
อริยะแ 6 years ago
Can I connect AM2320 more than 1?
StanKaravelikov 6 years ago
1. You can use an i2c multiplexer module which lets you to use up to 8 i2c sensors with the same address. You can find one here: http://www.ebay.com/itm/192035992071
2. You can use a logic switch to power up only one sensor at a time as described in this post: https://blogs.msdn.microsoft.com/laurelle/2012/02/24/using-2-identical-i2c-device-on-the-same-i2c-bus/
I prefer the first solution as it's cheap and stable.
I'll be happy if you try and reply with the results. Good luck! :-)
gmannz 7 years ago
Thanks for the clear and simple instructions. The library proved very useful. After checking around various resources on the internet, it is still up to date. One note, I could not get this to work on the Genuino 101, only the uno.
sffaf 7 years ago
Hi, большое спасибо! i needed this, i have a problem, i added the library and opened one of the examples, and without modifying anything it would not compile, i get this error:
am2320_I2Clcd2.ino:11:2: error: 'AM2320' does not name a type
am2320_I2Clcd2.ino: In function 'void loop()':
am2320_I2Clcd2.ino:30:13: error: 'th' was not declared in this scope
Error de compilación
any idea why?
fumble 7 years ago
Try another version of Arduino-IDE - this should help...
hexadec. 7 years ago
Great job, saved me some work and searching. Thanks
Your English is very good too. :-)
StanKaravelikov 7 years ago