My Arduino Mini board has DHT22 temperature sensor and 433MHz radio transmitter modules. I'm using DHT
and RCswitch
libraries to make use of them. Code looks like this:
void setup() {
tempSwitch.enableTransmit(RADIO_PIN);
dht.begin();
}
void loop() {
float temp = dht.readTemperature();
unsigned long message = createTemperatureMessage(SENSOR_ID, temp);
tempSwitch.send(message, 32);
#ifdef MY_DEBUG
unsigned int sleepCount = 1;
#else
// 3600s / 2 / 8s == 225
unsigned int sleepCount = 225;
#endif
for (; sleepCount > 0; sleepCount--) {
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
}
}
So I'm reading temperature and sending it using RCswitch
library. Initially I just had delay(1000);
instead of fancy LowPower
sleep loop but I wanted to make my "device" more battery-friendly so I switched to low-power sleep.
The problem is that now Arduino is only sending data first time and after sleeping 30 minutes (in "release" mode) it does not send anything anymore. If I reduce 30 minutes to 8 seconds it is capable of sending data as well as if I replace sleep with delay(30*60*1000);
.
From beyond it looks like something is not caching up after the sleep. Do I need to "wake" radio module in any special way? How to fix that?