Tuesday, January 26, 2010

What a difference...

... can a header/connector make.
Until today I used to plug the 8x8 LED matrices into these cheap and ubiquitous 40-pin female headers:
The round and thin pins of the LED matrices won't fit snugly the wide gaps of the above female headers. These headers are designed to work best, I strongly suspect, with the thick rectangular pins of the, also ubiquitous and cheap, 40-pin male header:


My LED matrices did not make firm contact when plugged into the above pictured female headers. Even scarier, every little touch seemed to affect the contacts, regardless of my efforts to find an easy solution (bend outwards the matrix pins a bit, thicken them with solder, insert them as deep as I could etc).

The final and permanent solution was to replace those headers altogether, with these round machined female pins:

They are a bit more expensive, but make a huge difference in terms of firmness of the contact.
They are also shorter, bringing the LED matrix closer to the board. That requires some attention when sockets are to be used: they should be either inside or outside the matrix package itself.
(Unfortunately I am talking from experience, since I had to remove a socket which was spread under two matrices.)


A different topic, but under the same umbrella of lessons learned: buying and using USB adapter power sources.
To shorten the story, this is the conclusion: when you buy such an USB adapter, never assume the output is 5V and just plug it into your expensive device!
Out of about 10 I bought on ebay, shipped from their manufacturers in China, 2 of them output 9V, way above the expected 5V. Although not statistically accurate (is there such a thing?), this is a 20% failure rate. Before plugging it on, always measure the output voltage to make sure it is what you expect.

Saturday, January 16, 2010

Complete "Wise Clock 2" kit for sale


Updated May 5, 2011
The "Complete Wise Clock 2 kit" is DISCONTINUED due to the lack of displays from Sure Electronics. If you have your own 2416 display, you can still buy the Duino644 board to make the Wise Clock 2.




Updated Jan 27, 2011
"Wise Clock 2 complete kit" is back in stock. The Duino644 board is re-designed, with the following changes for revision 2.1:
  • the real time clock can be either DS1307 (and crystal) or DS3231;
  • the on-board EEPROM (which was not used by the software) was eliminated;
  • the voltage dividers with resistors were replaced with 74125 gates;
The price remains the same (US$88 with free shipping, see below) for the DS1307 version. The version with DS3231 is $5 more.
Read more about Duino644 revision 2.1 here.


Updated Jan 1/2011
"Wise Clock 2 complete kit" is currently out of stock. It will be available again around the end of January 2011.


Updated June 17/2010
Starting today, "Wise Clock 2 complete kit" has the ATmega644P microcontroller loaded with the latest version of the "Wise Clock 2" software (this is on top of the bootloader, of course). This means that after assembling it, there is no need for ATmega644P chip to be programmed anymore; this eliminates the need for FTDI cable, Arduino IDE, code download, compilation, upload, and greatly simplifies the construction of the clock. (Obviously, the software can be changed/upgraded any time through the FTDI connector).

I recently received a batch of laser-cut acrylic covers designed as enclosures for the Wise Clock 2.
I decided to offer for sale a few complete Wise Clock 2 kits, which include:
  1. microcontroller board: Duino644 kit;
  2. display: red 16x24 LED matrix, from Sure Electronics;
  3. enclosure: 2 laser-cut acrylic plates, plus the auxiliary hardware (spacers, nuts, screws).
You can buy them for US$84, shipped free to any destination in North America.


 (US$88, free shipping to North America; I only ship to North America)

The assembled Wise Clock 2 should look pretty close to this one:


Note: Wise4Sure is the obsolete name for the Duino644 board. Duino644 can be used independently of the display from Sure Electronics, for example as the base for uzebox game console.


The photo below shows the content of the kit.




Assembling instructions are provided in this step-by-step "instructable".


In summary, Wise Clock 2 can currently (with the latest software release) do the following:
  • display current time;
  • read a user-editable file from SD card and display its content as quotations (hence the name "Wise Clock");
  • display current date;
  • set/trigger/sound/enable/disable alarm;
  • controllable from a Sony TV remote control;
  • user-selectable brightness for the high visibility display;
  • user-selectable speed for the scrolling text.

Sunday, December 6, 2009

Wise Clock 2 - Good news and bad news

Updated Feb 18/2010

Note: This posting is no longer relevant, from both the hardware and the software perspectives.
I'll keep it around just for the record.


The good news is that there is a new release, probably this year's last, of the Wise Clock 2 software.
Beside the expected bug fixes (related to alarm, thanks Mike B), there are also a couple of new features, both based on libraries published in the Arduino forum:
  • support for the infrared receiver, for commands from Sony TV remote controls;
  • alarm and other user settings are now saved into RTC's non-volatile memory (thanks Jeff S, matt).
The bad news is that you will need to do a bit more soldering for the above-mentioned software to work. Here is what happened: the infrared receiver and the Plus button are connected to the same D2 pin.

If you are not going to use the infrared receiver at all (bad idea, since you loose functionality), no hardware modifications are required. If you decide that the infrared receiver must do its job, then you need to replace a trace and a resistor. The idea is to move the Plus button onto pin D3, leaving the infrared receiver on D2 (also associated with INT2).

Edit (Jan/10): Turns out that the IR receiver is mandatory after all, due to the software. If it is not soldered (or inserted in a 3-pin socket), it must be "replaced" with a 10k resistor that pulls up D2 input (that is, D2 is connected to Vcc through a 10k resistor).


These are the steps:
  • on the top (parts) face of the board, cut the trace to the Plus button and the resistor R13, as shown below in yellow;
  • on the back of the board, solder a wire between the newly disconnected pin of button Plus and pin 4 of the microcontroller;
  • solder a new 10k resistor between pin 4 of the microcontroller and Vcc; an easy way to do this is shown in the image below;


These hardware "bug fixes" will allow the infrared receiver and the Plus button to coexist peacefully. The latest software release has the Plus button on D3.

Note: The latest batch of Duino644 boards, shipped after Dec 7, 2009, have, by design, the IR receiver on D2 and the Plus button on D3, so they won't require any hacking.


The "Wise Clock 2 User Manual" should get an update as well.

Talking about storage, notice that Duino644 has four places where data can be stored persistently (that is, it is not lost after a power shutdown):
  1. SD card;
  2. on-board external EEPROM;
  3. RTC non-volatile RAM, powered by the backup battery;
  4. internal (micro controller) EEPROM.

One last news is related to the LED display panel from Sure Electronics: they now sell green 24x16 displays.

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)

Sunday, November 15, 2009

Wise Clock 2 - New software release

Before talking about the new software release, I must point out a few corrections/edits I made in earlier posts:
The new software release can be downloaded from here. Most of the items on a previous "to do" list have been addressed. Following are the items I managed to do so far:
  • included Tone library (written by B. Hagman) to generate alarm sounds;
  • implemented functionality for the three buttons (Menu, Set, Plus);
  • removed the branching for ATmega328 (#ifdef _ATMEGA328P_), since many of the features won't fit in its RAM anyway;
  • ability to set up the date the same way as the time, through the file time.txt on the SD card;
  • display notification when the SD card is not inserted (or, to be more accurate, file quotes.txt is not found);
  • implemented sleep mode (more work is required for waking up from sleep mode with the remote control);
  • scrolling speed adjustable through 1-button (Plus) pushes;
  • dimming adjustable through 1-button (Set) pushes;
  • select to display the date or not;
  • ability to set the alarm time;
  • enable/disable alarm.
(Details and explanations to follow.)