But these little marvels come completely brain-dead! Ignorant... like a battery powered watch, they are useless until set. But Arduino users generally must load a sketch into their boards, connect the DS1307, and then run the sketch to program the time and date registers. Which is OK except a month later when you go to check and find that the DS1307 has drifted a couple of minutes. Well, maybe that is not a big deal for some, but I'm anal and I want my data loggers to have time more accurate than the inexpensive DS1307 modules will support.
I tried buying some quality crystals and replacing the stock crystal. That actually worked and this is where the 20 seconds every 24 hours shifted to 4 seconds every 24 hours. Not bad. But sometimes I do not use the data logger for a few months. Now, I have to load the Arduino sketch, set the time and date, and then reload my data logger sketch. Pretty annoying and even though it was just a little thing, it really grated on my psyche.
So, I decided to write my own set routine where I could set the date once and set the time anytime or just "hack" the seconds if that was all that was necessary. I did not want to deal with keyboards or terminals, so I rewrote a sketch I found for the ATtiny85 which can host an Infrared detector. With this less-than-$2 circuit, I can now use a $1 universal controller from the "dollar store" and my UNO and Mega sketches do not have to poll for IR since the IR activity is handled separately and the normally unused hardware serial input is used to identify that the remote control has activated the Power Button and IR commands are awaiting. If the user presses Power on the remote again, the UNO sketch simply returns to doing what it was doing. The ONLY wasted instruction in the main sketch is just to check the serial buffer:
if (Serial.available() > 0) // Something from IR is in the serial buffer