Monday, December 6, 2010
Binary picture-frame clock
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.
Here is the PCB after soldering some resistors in:
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.
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:
The best image was captured when I got my fingers in front of the flash:
Here are the links:
Look in again!