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 test_aosong_am2315.py script to be sure the sensor is wired correctly.
Sitting in a restaurant last month with Mrs. Sopwith, it was impossible to have a conversation because the large TV over our heads and the six others within 12′ were blaring. Living in Southern California, it is nearly impossible to escape obnoxious TV’s and their noise pollution. Bars, restaurants, cafes, heck even grocery stores have them assaulting us.
On this particular night, the normally mellow Mrs. Sopwith was quite unhappy. After droning on about the evil trend of constant noise in our world, she finally said the magic words: “I wish I could turn off every TV in here.” Being the typical faithful husband, I decided to make her wish possible.
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.