Introduction: Mini Dotclock

About: update later
An array of LEDs randomly changes patterns every 10 seconds or so. To read the time, simply count the number of dots per digit. The main pic shows the time, 22:11. Different colours are assigned to different digits, red-10hours, amber-hours, green-10minutes, blue-minutes. Using 3mm superbrights means the clock can be read daytime or night (though it'd be washed out in full sunlight).
Having a random pattern is a lot less distracting than having numeric digits staring at you...this would also be a great project for adding to the front or size panels of a PC mod.

Step 1: Overview

This project was inspired from the TixClock device I saw being advertised at ThinkGeek. That was a little large for my application, I wanted a clock above my DVD because it didn't display the time when playing a DVD.
The design is based around the case, a low profile 'display' case from Jaycar Electronics ( catalog number HB6083. If you want to put this clock in another case, you'll have to modify the PCB layout.
A zip file with sourcecode, pcb files in EagleCad format and some pics is included in the project.

Some tracks are a bit narrow and have very little clearance. I built this using press-n-peel film, so it can be done....just take a little care not to smudge things and carefully check the result, scratching out any blurred tracks that might be touching another.

The PCB is designed for two layers, however I constructed this on a single sided board to save effort. There are only a few tracks on top, and these can be dealt with by using hookup wire. Note the picture is a little different from the PCB design in the zip file. The changes were connecting the enable pins of the 74hc154 chips directly to ground and an extra diode to step down the voltage across the supercap to make it closer to the 3.3V required by the RTC chip.

Some handy hints when doing double sided board using single layers is to:
- do as much trackwork on the bottom side as possible
- when laying a track on top, always take it to a via, rather than connecting the top layer track directly to a component.
- when using press-n-peel, print out the silkscreen (in reverse) and iron this to the PCB after drilling and etching. This not only gives you component placement, but if you print the top tracks out as well it is an easy guide for hookup wire. Note the black lines in the PCB below....these would be where the top layer tracks would be.

Step 2: Front Panel Design

A handy trick for cool looking front panels aligning with your PCB layouts is to print an image of your silkscreen, then edit out any non front panel items. In this case I have kept only the LEDs. The image was edited in a photo editor and text added. Using a photoprinter you can get colourful designs (although the colour scheme is a bit minimal in this). The LED holes were cut out with a sharp knife and some tracing paper added to the back to diffuse the light a bit.
My little photo printer created prints a little too narrow to fit the entire case, so a little strip was added to fill it out. It looks OK in this case because the front panel is so minimal.

Step 3: Control Switches

You need to be able to set the time. I used three microswitches I salvaged from an old stereo, mounted them to a bit of veroboard (or stripboard) and gummed the switch assembly using hot glue to the case.
The first switch selects the time set mode, the second selects the digit and the third increments the digit. After changing the time select the first switch again and the clock will run.
The ribbon cable from the switch has 5 lines, vcc/gnd and the three switch inputs. Each switch is momentary closed. On size connects to ground, the other to the switch input line and a resistor pullup to vcc. In other words the inputs are normally high, then pulled low to activate. See the schematic for details on the wiring.

On thing that was useful in using veroboard was that the board itself because the drilling template for the switch holes. Small holes were drilled in exactly the right positions, then squared out with a file. It made a nice fit.

Step 4: Final Assembly

The PCB was designed specifically for this case, so simply slid over the mounting posts. Because space was very tight, the switch assembly was soldered directly to the PCB and a piezo buzzer hot glued to a chip. If you want a louder piezo you'll have to add a driver as this is driven directly from the microcontroller. You really do need to glue or fix the piezo to something in oder to increase the volume.
The power supply lead was tied around the bottom mounting post as a strain relief. I've just pocked it out the mounting holes, but you can use a proper grommet if necessary.
That's about it really, the device is powered from a 9V plugpack and sits above my dvd player merrily changing patterns.

Step 5: About the Firmware and Supercap Backup

This firmware was designed with the Sourceboost compiler and uses the Sourceboost I2C library to talk to the RTC chip. I had to modify the i2c driver to use longer delays in order to get reliable operation.
The firmware initialises io, then reads the every ten seconds or so (you can modify this in the code if you want a quicker update or random update times. I found this period to be the least distracting). If keypresses are detected then it goes into the clock time change routine until exited with a press of switch one.

Also in the design is a space for a supercap. I haven't tested this, but installing one should allow the clock to handle power outages for a short period of time.

In the firmware once the RTC data is read, a routine takes the digit values and assigns a random selection of active LEDs to that digit, the same number as the digit value. These are kept in a table. An interrupt routine takes one value out of the table at a time and sends them to the LED driver chips, and an LED is lit (actually two, one per chip). Next entry to the routine gets another and so on. When run fast enough the LEDs active in the table all appear to be lit at the same time. You can change the timing of the interrupt routine to make it faster if you like.

Have fun, and if you build one of these into something cool...send me a picture.
Philip Pulle