I've been working on Moteino R2 based outdoor temp/humidity sensor for my clocks. I got some success with it working over 6 months from a single AAA battery, however there some really weird issues I'm having with Moteino. I call it "sleepwalking". Let's say Moteino is programmed to sleep for about 2 minutes between transmissions. However it wakes up at random times and sends just bad pockets (I see it as BAD-CRC). Nothing indicates that MCU has woken up, but RFM12b still sends something.
This becomes more apparent the longer sleep period is.
This is my sleep function that uses LowPower library:
void goSleep()
{
Serial.println ("Going to sleep");
delay (10);
for (int i=0;i<SLEEP_MULTIPLIER;i++) {
LowPower.powerDown(SLEEP_8S, ADC_OFF, BOD_OFF);
//LowPower.idle(SLEEP_8S, ADC_OFF, TIMER2_OFF, TIMER1_OFF, TIMER0_OFF, SPI_OFF, USART0_OFF, TWI_OFF);
}
Serial.println ("Wakup up");
delay (100);
}
I added some Serial prints for debugging, normally it's off. I'm also attaching hole sketch just in case.
Here's output from Reciever (which is not Moteino btw, just my ATMega1284p based board with RFM12b).
16:12:20
Receiving Temp...
Temp: 10
Humidity: 75
16:13:19
BAD-CRC
16:14:36
Receiving Temp...
Temp: 10
Humidity: 75
16:14:46
BAD-CRC
16:15:18
BAD-CRC
16:15:32
BAD-CRC
16:16:52
Receiving Temp...
Temp: 10
Humidity: 75
16:18:19
BAD-CRC
16:19:8
Receiving Temp...
Temp: 10
Humidity: 75
That is very strange and never seen that happen. Unless you have an external interrupt setup to wake the MCU there is no reason why it would wake up by itself.
There is noise that the RFM12B can catch especially if there's other stuff in the area using the same band.
So I wanted to ask how can you verify that the unit indeed wakes up and its not some external source that causes the receiver to get the BAD-CRC?
BAD-CRC just means junk that did not verify the CRC check byte. So it could be anything.
Strange right?
No I do not have external interrupt setup. I also at first thought that my receiver was picking up some other signal at 915Mhz but it's not the case (although I will double-check tonight) as it doesn't show anything received (BAD CRC etc) when Moteino is not powered up. I'm 99% sure Moteino or just RFM12b chip sends it.
Again there was no indication that ATMega chip itself woken up, at least it did not do Serial output. Just for heck of it I'll try monitoring power usage for spikes with my Oscilloscope. I'll also try to run sketch on my other Moteino to see if same thing is happening.
Try to isolate the problem or hook up something to the sender and log the time when it sends. Ie keep it hooked up to a laptop or something ... then you can log the wakeup times and sends on both sides.
>:( Damn it, it looks like it had nothing to do with Moteino after all :) After all looks like either interference from some other RF source or internal circuit noise :(
Yay, I knew it :) Moteinos are better than that ;)