I am using a Raspberry Pi with a GrovePi and a DHT Pro sensor and am having some problems over longer periods of time, after a while the sensor just reports the same value over and over again.
I am reading the DHT in a loop using [self.temp, self.humidity] = dht(4, 1) that runs every N seconds. The sensors will start out fine and report reasonable values for at least the first minute or so. I can check this by holding the sensors in my closed hand, the temp and humidity go up. But after a while, the sensor will stop reporting new values, it just reports that last value over and over again. There are no errors I am seeing. If I restart my app, the sensors starts reading normally again for a while then does the same thing.
I have also plugged a light sensor in and get the same results.
At first I thought I was request sensor updates too quickly (0.5 s) so I have been using various values of N between 0.5 and 60. That does not seems to affect this. I’m stumped. Anyone have any ideas or have seen this before?
Hi Karen thanks for the quick reply.
The time it takes for the sensors to flatline varies, but currently it is flatlining after about 12-15 mins. Previously it was about and hour or so. Here is a real-time graph of the output http://rvapp.solalla.com/#/app/home (it takes a few seconds to load the graph).
Right now the Raspberry Pi is rebooting every 15 mins. I attached an image of the temperature time series. If you look closely and the bottom of the temp dips you see it flatlines for a few minutes, then the Pi reboots and it starts reading temperature correctly again for about 12 mins.
This is running as part of a larger project called lilybot, and runs inside a Tornado Web socket client’s IOLoop. You can see the callback (line 127). It calls and get_sensor_values() (line 141)
The actual sensor readings take place in this file around line 84.
This maybe hard to reproduce without installing the entire project because I think the Tornado IOLoop is starting its own thread and it could be that thread is somehow erroring out. There are instructions on how to install this here https://github.com/wilblack/lilybot if you want to try. So far I am the only one to have used this, so it is alpha but it would be great to get some feedback.