Hello all,
Hoping someone can help me out with a problem I'm having. I'm attempting to make my own smart thermostat. I chose to go with a DHT22 temperature sensor as my primary sensor. But i'm having some problems with it. Right now I just have a test case set up where it's reading the temperature every 30 seconds from it outputing it to a display. This works fine for a while, but then after a random amount of time (but the shortest observed period being about 12 hours), it's stops responding and does not return a valid reading.
If I unplug the DHT22 sensor from the breadboard and plug it back in, it immediately starts to work again.
Anyone have any ideas what the problem can be? Obviously I need the sensor to be more reliable than this to serve as a thermostat sensor...
It's all pretty basic stuff, but sure.. crudely drawn paint circuit attached. I don't have the actual sketch in front of me atm since I'm at work, but again very basic, something like this is pretty much what it's doing:
The only difference is instead of printing it to the serial, I also have code in place to output it onto an LCD display. But that code snippet will give you the jest of what is being done.
Yeah I had a 1k ohm in it originally with the same results. So I don't think the pull up resistor value is the problem. I only had a 10k ohm in there latest attempt because I found a few different wiring instructions via google suggesting to use a 10k.
3 or 4 inches maybe, haven't measured them, shortest jumper wire I have though. Yes I've tried adding the capacitor that the datasheet mentioned but it doesn't effect anything.
Like I said, everything works perfectly fine for a while, then it just randomly quits working. It's always after an extended period when it quits though. It almost makes me wonder if it's overheating and getting locked in a specific state while trying to read or something... I don't know. Was hoping someone else with more expertise than me might have a clue. It's just odd that immediately upon unplugging it and plugging it back in, it begins to work again.
I've also tried powering it from an IO pin to see if I could just give it power when I needed to read from it, but that doesn't seem to work. Not sure if it's not enough amperage or voltage from the IO pin to power it or what. Although, I'm not 100% sure I waited the 1 second to take a reading from it after powering the IO pin, I'll have to double check that.
Arctic_Eddie:
The DHTxx sensors have a history of unstable behavior. You may have to try another sensor or change to a SHT31-D breakout from Adafruit.
Really? That is a bummer lol. When I was researching the project I read a lot of good reviews about the DHT22, it's what made me decide to go with this one. I've just got the one unit for now that I got from a US shipper for testing but I've got a package of 10 of them otw from China That really sucks if they are going to have problems like this. Package of 10 is because I planned to have remote wireless temperature nodes as well. I would've thought I would have seen something like this mentioned in the reviews if it were commonplace.
I've got a BME280 breakout board as well, I have not messed with it yet but had planned to use it for an outdoor sensor. I felt those were too expensive to use in numerous indoor wireless nodes lol. That SHT31-D isn't cheap either... ~7 dollars each from China. Over twice as expensive as the DHT22. Was trying to keep the cost of each wireless node under 10 dollars each (with the DHT22 and a ESP8266 wifi module and other odds and ends, I'm at around 9 dollars each right now).
Eh, might just have to rebudget my project I guess. Like I said, I only went with the DHT22 after reading a lot of reviews, just surprised I didn't see more negative reviews if they have a history of being unstable.
Based on my experience, using US supplied parts, your package of ten sensors will have two that are not like the others in measured values. Out of the eight remaining, two more will suddenly output noticeably different values after operating for several weeks. You may have to connect all ten to an Arduino and just let them run for awhile. After some time, look at their output values again and keep only the ones that have been consistent.
There is some controversy as to the quality of the library for these parts. Search this forum for a discussion a few months ago and you'll find a link to an improved version. That may help your situation. However, if the part starts issuing different values after several weeks then you can't necessarily blame the library.
If you need temperature only then consider using just an NTC 10K thermistor bead with a low pass RC filter.
Yeah, I'm considering switching to a basic thermistor. I thought I would like to have the humidity reading as well but don't know if I'm really going to make use of it. The only other thing nice about the digital stuff is the output is more stable. When I connect up an analog thermistor the readings are a lot more jumpy. Maybe that is what the low pass rc filter you spoke of fixes, will have to look into what that is. When I have used one of those sensors in the past I just averaged the readings over 30 seconds to get a value hehe.
Numerical averaging will have the same effect as an RC filter. Just a simple, but good quality, 10uF cap across the analogue input will work fine. The NTC beads have the advantage that they can be put on the end of a piece of coax and somewhat removed from the Arduino. This will force your circuit to give inverse readings as ADC voltage will go down when temperature goes up. Essentially, sensor on low side and resistor on high side.
With this sensor, you can have several being read by one controller. The digital type must be very close, probably no more than a foot or two.
Try a set of beads using all the analogue inputs on your Arduino. Read each one twice in succession but use only the second reading. Select one as a reference, middle of group, and print out the deviation of the others relative to that one, maybe on five minute intervals. Do this over several days and look for any with a changing value outside of the normal spread. The deviation method will allow the ambient temperature to change but still show the stability of an individual sensor. After determining the spread of each sensor, you could switch to printing only those exceeding the limit. That allows you to run for weeks and not have a huge amount of data to scan.
TomGeorge:
Hi,
The DHT22 will work from 5V as well as 3.3V.
Have you tried 5V?
Tom...
TomGeorge:
Hi,
The DHT22 will work from 5V as well as 3.3V.
Have you tried 5V?
Tom...
Hello TOM , i have same issue with DHT22 , i use it into a refrigerator and see it stop working after about 12 hours , but when i changed it with dht11 it work very well.
what is wrong ?
I'm also suffering from intermittent readings from DHT22 which come good for a while when I unplug / reinsert the sensor when using a ESP8266-01.
I've found a library DHTesp.h which I'm exploring further which may help with a problem that could be caused by "use the value returned by the getMinimumSamplingPeriod method as delay in our Arduino loop".
I have also experienced strange behaviours from some DHT22s.
With some microcontrollers boards I do not have any problems (Arduino UNO, Arduino MEGA 2560, Microduino Core+, Arduino Nano) with others (Arduino Micro, flat Atmega328) there is no way to receive any data from the same DHT22 sensors, although the circuit, libraries and sketch was exactly the same.
At the beginning I thought that the issue were related to power supply differences between the different boards, but even though I managed to supply the circuitry with external clean power supply the issue persisted.
I will check if with DHT11 (I have got one) I do experience the same issues and I will give you feedback on that.