Revisiting the AM2315 Humidity Sensor

I was quite surprised by the number of comments and emails I received about the AM2315 humidity sensor. This confirms two things. First, it appears this sensor is quite popular. Based on my experimentation with the device, it is also quite accurate. Secondly, there are a lot of folks hacking this sensor but struggling with the am2315-python-api code.

It was really great of Joehrg Ehrsam to publish the code and make it available to all of us. Unfortunately, the code is poorly formatted and not commented. Also, the code has some timing issues that can result in bogus data. If you look at the below screenshot you can see the sensor is sending garbage.


The AM2315 datasheet warns about this:

“Send read/write command, the host must wait at least 1.5ms, and then send a read sequence, to read back the data…” (pg15).

Failure to get this timing right means you can get inaccurate data from the sensor. I have written Joehrg twice and did not receive a response. So, I decided to write a new Python class to read the sensor data accurately. You can download the code here:


Be sure to read the README.txt file and I suggest you run the script to be sure the sensor is wired correctly.



Hacking the AM2315 Humidity Sensor

I recently discovered the AOSONG AM2315 humidity/temperature sensor and was quite intrigued. This is a very accurate and affordable device that is a nice addition to a current project. Supposedly, this device is i2c compliant, so I figured it would be easy to talk to. Little did I know….

After hacking around for a couple of long days I was able to get the device working on my breadboard with a Pi Cobbler. Google and forum searches determined there are a lot of people struggling to get the device to work.

So, Sopwith decided to write-up his adventure with the AM2315 and provide a very detailed step-by-step guide with screenshots.

I hope this helps save my fellow smoke-breathers some time and frustration.