Monday, December 6, 2010

Binary picture-frame clock


Hi altogether!
After seeing quite a few clock projects on hackaday.com, I decided to make my own.
And here it is: The binary picture-frame clock!





















Now, how did it build it?
The first thing was to make an idea and a prototype.
I used an ATMEGA-8 as main part and layed out the rest around it.
I needed six LEDs for the minutes and the seconds (2^7 = 64 so just one factor under it to get up to 60)
and five LEDs for the hours.
Coming together with buttons, a light sensor for night dimming and the clock crystal,
filled nearly all the pins of the microcontroller.
Here is the schematic:

I did this in KiCad, its free and quite good.
Laying out a one sided PCB saved me a of of cost, and left the possibility to make it quite flat to fit in the frame. The frame is a cheap IKEA picture frame for like ten euro.

One of the advantages of KiCad is it provides a rendered 3D-image of a circuit board. Here it is:
Now, I ordered the PCB and the parts. Two long weeks of waiting followed, then the assembly part started!
Here is the PCB after soldering some resistors in:
The resistors, LEDs, caps and the crystal were pretty easy to solder. Use a good, branded soldering iron and 0.5 mm solder wire. For hobby use, lead is fully acceptable because it flows to the pads on its own.
The TQFP microcontroller was really hard to solder.
In my first atttempt, I didn't get the contacts on MOSI and SCK right,
but after microwaving the board for three seconds (no joke!), everything worked well!


Now the mechanical treatment of the of the picture frame followed.
I drilled holes and expanded them until the small switches fitted in.










After also drilling holes for the power supply,
I fitted the board into the frame. The three buttons for time setting flew just around.
With a lot of hot glue (a sacrifice for the science ;-) all was in place and ready!
The power supply is a 2W capacitor power supply with a european plug.
Now coding started. For AVRs, I recommend the AVR studio with the GCC plugin!
I use the 16-bit timer 1 to generate a secondary pulse out of the core frequency of 32.768 kHz.
The clock counters aren't any special, three registers for hours, minutes and seconds.
I used the ADC, and this is kind of special because it is claimed in the datasheet that the ADC just works in frequencies higher than 50 kHz. Due to the reason I only use the MSB for checking the brightness, it works really well!
I do software PWM to get one tenth of the brightness of the LEDs in dark surroundings.
The last part was to put all in place and then it was ready.
 Here are some pictures:
It is pretty hard to get it on camera. Either you get the bright flash or the LEDs disturbing the image.
The best image was captured when I got my fingers in front of the flash:
I hope you like it!
Here are the links:
Schematics
Layout
Code
HEX-file

Look in again!
\apexys\toan\12062010\1844