I had similar problems with my AM2315 temperature sensor. At times it would report values of zero (usually the result of a CRC error) or very large negative values. I re-wrote the standard AM2315 read code in GroveWeatherPi.py to execute a re-try on the sensor read until it returned a reasonable value. I don't know if the erratic values are common with this sensor but your description sounds similar to my problem.
The old code is :
outsideTemperature, outsideHumidity, crc_check = am2315.sense() My replacement code is:
Replace the old code with my code block to see if that fixes your problem.
Also, I'm not sure how familiar you are with python so be aware of the code indentation level where you insert the replacement code. In Python, source code with the same indentation is grouped together in a code block. Make sure my replacement code is indented to the same level as the old code.
Last Edit: Jul 6, 2017 14:36:59 GMT -8 by texag: corrected spelling
You solution is a good one at this point. When we released our ESP8266 based OurWeather Product, we had a reliability problem on the AM2315 which we eventually fixed by working with the driver code. We went over 200,000 reads with no errors. It's not the sensor, it's the I2C libraries we concluded.
I'll bet that the issue is the SMBUS I2C drivers on the Raspberry Pi and we should look at that. Start a big test and look at statistics.
Axel, you are getting a huge error rate from your database. A couple of questions:
1) What Raspberry Pi are you running this on?
2) Have you update/upgraded the Operating Systems
3) How is your AM2315 connected to the Raspberry Pi? The standard way or are you doing something different. Please let us know.