So I got around to implement this. My project is an air conditioner controller. I decoded my AC remote IR protocol and write code to send it using an arduino pro mini.
This is the mainloop I'm using, basically I sleep 2seconds, then listen for commands for 15milli seconds.
void loop()
{
bool gotCommand = false;
RadioCommand data;
// Power up the radio, start listening and then sleep 15MS to allow
// the radio to receive any commands.
radio.powerUp();
radio.startListening();
LowPower.powerDown(SLEEP_15MS, ADC_OFF, BOD_OFF);
// Clean the full pipeline. Only execute the last command
while ( radio.available() )
{
radio.read( &data, sizeof (RadioCommand));
gotCommand = true;
}
if (nLoops > PING_LOOPS)
{
sendBatteryStatus();
nLoops = 0;
}
radio.powerDown();
// If we got a command and its actually different than last time
if (gotCommand && lastSeq != data.seq)
{
SendWhirlpoolCommand (data.data);
lastSeq = data.seq;
}
nLoops++;
LowPower.powerDown(SLEEP_2S, ADC_OFF, BOD_OFF);
}
The sending side is a raspberry pi that just tries to send the same message for 5 seconds when it wants to send a command.
I have very good reception so it always picks the package on the first try, this gives me an average command actuation of 1second, pretty good.
I ran this in two AA rechargable nimh batteries for 3 days and the voltage didn't changed at all. Today I changed the batteries for two ElCheapo alkalines, the ones that I actually want to use. I'll report back how the batteries are progressing.
I want to add a temperature/humidity sensor, probably going to be ordering either the Si7021 or the HTU21D as I need it go work with low voltages as I'm not using any step up, I'm running everything directly from the batteries.
BTW, I'm not using any of the mysensors.org software as I wanted to write the whole stack myself for the learning experience (I have already the the nodes, controller and web interfaces for this) but I have found that this community has a lot of the same goals that I do.