avon_remote

I’m super happy today, because I got IR remote control working with Xronos clock!  Thanks to this IR library, that was pretty easy task. Library worked out of the box for ATMega644p/1284p (well actually only on 1284p, but more on this later).
I figured out a “hack” to add function for remote control that doesn’t affect any other clock code! See details after break.

// ===================================================================
// * Decode IR Codes *
// ===================================================================
void IR_process () {
if (irrecv.decode(&results)) {
switch (results.value) {
case IR_ON:
lastButtonTime=millis()+ BOUNCE_TIME_BUTTON;
processMenuButton();
break;
case IR_PLUS:
Serial.println (“Recieved PLUS”);
decrement=false;
lastButtonTime=millis()+ BOUNCE_TIME_BUTTON;
processIncButton();
break;
case IR_MINUS:
Serial.println (“Recieved MINUS”);
decrement=true;
lastButtonTime=millis()+ BOUNCE_TIME_BUTTON;
processIncButton();
break;
case IR_UP:
Serial.println (“Recieved UP”);
lastButtonTime=millis()+ BOUNCE_TIME_BUTTON;
processSetButton();
break;
case IR_DOWN:
Serial.println (“Recieved DOWN”);
lastButtonTime=millis()+ BOUNCE_TIME_BUTTON;
processSetButton();
break;
case IR_ENTER:
Serial.println (“Recieved ENTER”);
break;
case IR_MUTE: // Start Talk function
Serial.println (“Recieved MUTE”);
lastButtonTime=millis()+BOUNCE_TIME_QUICK;
buttonReleased=true;
last_ms=millis();
quickDisplay();

break;

//Serial.println(results.value, HEX);

}
irrecv.resume(); // Receive the next value
}
}

IR_ON, IR_PLUS, etc are preset IR HEX codes that I got back by running
Serial.println(results.value, HEX); 
For example:
#define IR_ON  0x17E18E7
It can be adopted to any remote!

And then I went further and added “decrement” functionality, so now with remote you can increase or decrease items (i.e. hours, minutes, etc.).

It works fairly well, although there’s some lag as clock now have to process a lot more information.

Bad news is, it now doesn’t work with ATMega644p chip at all because IR library eats a lot of RAM. But no issues with ATMega1284p. I might tweak IR library to make it smaller, after all I don’t need to send any IR codes, only receive..

Additionally I figured there’s a room in current enclosure to attach IR receiver, however faceplate will block it, so it will need to be modified 🙁