Sunday, 9 February 2014

Setting the time

This is an old post, preserved for reference.
The products and services mentioned within are no longer available.

I've had a query about how I have been setting the time on the LED clocks I've made. Well, it depends. When I replaced the LED driver board on my old Cascade LED clock radio, I didn't bother with any buttons etc., so the only way to set the time is to reprogram it.
So every 6 months, I plug it into the PC via an FTDI cable (as shown here) or an Arduino USB Serial Light (as in the original article). I then upload the code with the following line uncommented.

  RTC.begin();
  //RTC.adjust(DateTime(__DATE__, __TIME__));

This sets the time to the system time and date at the point of programming. I then comment the line out again and immediately reprogram it, or it would reset to that that time each time power was applied.
That's fine for me, but for the ones other people have to use, I tend to add buttons to set the time, such as on this LCD clock. Note in this case, I use the USB cable for power, there is no data connection.
So I suppose it's down to how complicated you want to make it. I'm happy to reprogram a few clocks twice a year to cope with daylight saving. But obviously the average user would prefer buttons to change the time. You could use serial (directly or via USB) to set a time from a PC, but that's probably more work that reprogramming it. You could even use an Arduino Ethernet and get the time over the internet via NTP, or connect to a rugby radio module if you wanted to.