Wednesday, November 18, 2009

Wise Clock 2 - User manual

The software for Wise Clock 2 is getting pretty hairy, thanks to the 4KB of available RAM. I actually have variables whose name include "app" (short for "application" :) Not that it's becoming windoze or something, but they suggest that there could be multiple "applications". For example, the functionality of the clock is an application. Conway's game of life is another application, as is an audio spectrum analyzer. The application running at a given moment is selectable through the menu.

So, it's about time to start putting together a user manual, a task more difficult than writing the code itself. The completion (if ever) will take some time. I plan on posting bits and pieces whenever I get some inspiration. Eventually I will assemble all these chapters into a coherent document.



Setting the clock with the current time and date

The Real Time Clock keeps time and date. The small on-board battery ensures timekeeping even when the power is disconnected. At the moment, the only way to set the time is through the SD card. This is not an inconvenience, since there is no reason to set the clock too often (unless accuracy is the goal, but then other variables, like temperature, should be considered as well).

In order to set the clock, the file time.txt must contain the time and date in a specific format, hh:mm:ssZyyyy-MM-dd-n, as shown in the example below, extracted from the file ("n" is the day-of-week):

# current time used to set up the clock;
12:22:45Z2009-11-14-6

As previously explained, the clock is set right after the board is powered, from the SD card containing time.txt. As soon as the clock is set, the file gets deleted (actually, marked as "deleted", through the insertion of 0x03 as the first character). So, next time you want to set the clock, just remove the first character, edit the line containing time/date, then reset (or power up again).


Displaying the current time and date

The time is shown continuously on the bottom row of the display, as hours and minutes. The separator between them indicates the state of the alarm: colon (":") means "alarm enabled", a dot (".") means "alarm disabled".

The current date is, by default, not shown. It can be displayed optionally, between quotations, by selecting the menu item "DT+" (press Menu repeatedly until you reach "DT+", then press Set).

TODO: The latest version of the software has the date format hard-coded. A future release should allow the user to specify the date format in the time.txt file.


Setting the alarm

Setting the alarm is usually a more complicated process than setting the clock itself (unless it's a mechanical clock with one "alarm" hand). The flowchart below explains how to set the alarm time. In a few words, here is how this works:
  • press Menu button repeatedly until you reach the item "ALRM";
  • press Set button to select this item;
  • now, by pressing Plus button, the hours will get incremented (rollover to 0 after 23);
  • pressing Set again will switch the "focus" of the Plus button to minutes;
  • now, by pressing Plus repeatedly, the minutes will get incremented (rollover to 0 at 59, obviously);
  • when the desired alarm time is shown, just wait a few seconds for the automatic menu expiration (when no button is pressed) to kick in; the alarm time is now set.



In order for the alarm to sound, it must be enabled. This is done by selecting the item "AL+" from the menu. To do that, press Menu button repeatedly until you reach "AL+". Then just press Set button and the alarm is ready to go at the set time. The diagrams below describe alarm enabling and disabling, respectively.



The fact that the alarm is enabled is indicated by the colon sign (':') between the hours and minutes. When the alarm is disabled, a dot ('.') is used to separate the hours and minutes.

After the alarm goes on, it can be dismissed by clicking on any button (not really practical when waking up in the morning, I agree), or by sending any command from the remote control.

The alarm time, together with other user settings, are saved in the non-volatile RAM of the real time clock (powered by the backup battery).


Menu items

The following menu items are currently implemented (or planned to be):
  • QUOT - run the Quote application
  • SLP - go to sleep mode
  • ALRM - set alarm time
  • AL+ - enable the alarm
  • AL- - disable the alarm
  • DT+ - show the date between quotes
  • DT- - do not show the date
  • MSG+ - show a special message between quotes (not yet implemented)
  • MSG- - do not show the special message
  • LIFE - play the game of life;
  • DEMO - show a demo application;
  • PONG - run the ping-pong application (not yet implemented).
The menu is accessed/entered by pressing the Menu button.

(to be continued)

2 comments:

  1. Huh, complicated! But very nice...:) I just finished up my own alarm clock, and the main board is very similar to the Wiseduino! fwiw the mode map is here:
    http://www.flickr.com/photos/salsaviz/4112117637/in/set-72157617521587008/
    Clock settings (AMPM vs. 24 hours, alarm time, backlight setting, alarm on/off status, etc) are stored in the 56 bytes on the RTC itself, and I use the EEPROM just to hold a log of the alarm times. I packed a lot of modes into the interface using a single button and rotary encoder (jog/shuttle)-- handling different button events gave me the flexibility to make an arbitrary mode map. I'll post the code over the next few days but would be happy to mail you the sketch if you'd like. More info on my blog: http://jmsarduino.blogspot.com/

    ReplyDelete
  2. Jeff, thanks for your comment.
    Your approach (rotary encoder, one button, cylinder enclosure etc.) looks very interesting, and I would like to get more details, of course.
    Yes, I appreciate if you send me the sketch, thank you.

    ReplyDelete