Inconsistent DHT22 readings in sleep mode, solved using a delay()

Hello,

I am building myself a low power thermostat using a Moteino board, running with 3xAAA NiMH connected to VIN. If you are interested, please find the whole project in https://github.com/joaquimBS/ArduinoRepo/tree/develop/sketches/Thermostat

DHT22 pins:
VCC connected to Mote 3V3.
GND connected to Mote GND.
DATA connected to a Mote digital IO.

I programmed 20 seconds sleep period by sleeping 20 times 1s, and after that I run a cycle of sampling data, doing some internal logic with it, sending the data to my RX Mote (which is connected to an ESP8266) and then back to sleep.

So far so good. I read ~23uA during sleep time (measured with a multimeter, so I assume it's some kind of average).

At some point the thermostat switches ON the heater, and the temp readings rises almost a full 1ºC. :frowning: When the heater is turned OFF again, the temp readings drop again 1ºC.

The only difference is that, due to a SW bug, the function doing HeaterON was doing a delay(250), while the HeaterOFF wasn't.

Finally, I noticed that when plugging in the battery (the thermostat is awake during 10s), the temp reading were the same as when the heater is ON (the delay(250) active), so I assume that temp reading is the right one.

Additionally, adding a delay(250) to the HeaterOFF, make the temp readings consistent, during HeaterON and HeaterOFF states.

I used different DHT22 libraries, one with some delay before making the measurement, one without it, etc. But what makes the difference is the delay after the reading.

So here is the question, to the Moteino & DHT22 users. How do you integrate those two? Are you experiencing any issues?

I know the DHT22 has some restrictions regarding the sampling period, but since I am respecting this, I no longer know what to do...

Many thanks!

I am building myself a low power thermostat using a Moteino board,

It's always interesting how users on this forum buy very exotic hardware and write question without feeling the slightest need to provide a link to that uncommon hardware part. I guess one can assume that all users in this forum know the popular models that arduino.cc is selling. But I think it's quite hard to understand how someone can assume that we know every damned Arduino clone/derivation out there. Reading the sticky post at the top of the forum would have helped probably but that seems to much work for someone seeking for help.

DHT22 pins:
VCC connected to Mote 3V3.
GND connected to Mote GND.
DATA connected to a Mote digital IO.

This is missing the decoupling capacitor as well as the pullup for the data pin.

So here is the question, to the Moteino & DHT22 users.

I'd expect that target audience to approximate the empty set.

If you have a question to the general forum users, please post your code.