For this week's assignment, I made a clock that uses linear motion to tell time. Two independent layers run in parallel, counting hours and minutes. The clock takes advantage of microcontroller sleep modes to reduce its power usage.


Each slider is moved by a motorized slide potentiometer, which can detect where it is and move along the slide.

The potentiometers have a resistance varying logarithmically between 0 and 10 kOhms. When I ordered them, the product page said they were linear - it got updated while they were in transit.

This little surprise made my life more interested.


I used Eagle to make a controller board based on the ATmega168 microcontroller, because it allows for asynchronous Timer2 operation while the rest of the chip is powered down (more detailed explanation are in the software section).

The board includes the microcontroller, an H-Bridge for motor control, a 32.768 KHz clock crystal for timekeeping, an LED, and various other parts.

The microcontroller can be programmed through the on-board SPI header. There is also an FTDI header for serial communication (helpful in debugging!), and a five-pin header that connects to the slide potentiometer.


I've used enough assembly to know that I like having a compiler to manage my stacks and variables. I wrote the firmware for this week's clock in C then used the avr-gcc + avrdude toolchain to program the chip.

Interesting features of the firmware include:


I designed a case as a cad file, then fabricated it out of 1/8" scrap wood on the Universal laser cutter.

Of course, I made it out of cardboard first:

Power System

The project needed to be run from 5V, but I hadn't though to include a regulator on the board.

I solved this problem by making a clever modifications to a 9V battery plug:






Creative Commons License
All source files are licensed under a Creative Commons Attribution-NonCommercial 3.0 Unported License.