Once again I delve into the exciting world of LEDs, this time to make a really nifty clock.
Wanting to give this a try myself, and perhaps improve on the concept, element14 (Farnell) offered to supply me with the parts needed as part of their Blogger Outreach program. And who doesn’t love free stuff!?
The frame I purchased was a significant cost, as I wanted something of high quality that wouldn’t look tacky. Depth was the vital consideration here, needing to fit the LEDs and all the electronics. Ideally I would have purchased the RIBBA Frame from IKEA, however, as I am living in New Zealand, it was not easy to get hold of. Instead I settled on a simple 8″ x 8″ Square Black Frame.
The front panel was simply made using laser printing on standard 80gsm photocopying paper. The Black ink did well to block the light, and the unprinted letters to diffuse the light. To fully block the light on the black areas, two sheets where needed. Other methods were investigated, using OHP sheets, and cardboard, but I found the ink on the OHP sheets didn’t block enough light, needing many sheets to block the light enough and still needing white paper to diffuse the light, the cardboard I used worked adequately but blocked more light than two sheets of paper.
Coming up with the letter arrangement was the fun part. Trying to optimise the letter layout to minimise LED usage but maximise word availability. You’ll notice I snuck in BEER for Beer O’Clock. Using the knowledge that not all LEDs would be on at once allowed for some very clever overlapping, my favourite beingELEVENOONE covering Eleven, Noon and One in only 10 characters. That’s 140% efficiency!
To avoid visible light leaking between each letter on the front, I chose to make dividers to separate each LED into it’s own chamber. The LEDs themselves were then mounted in a on a panel which I had CNC‘d to keep them an even distance apart. They were then soldered in a matrix method similar to that of my LED Cube. The theory behind LED matrix multiplexing is explained in further detail there.
This is where I have element14 to thank for sponsoring me for these parts. For the controller I used an Attiny2313 and used the DS1307 as the Real-Time Clock. Even with multiplexing the LED rows, the lattice still needed 20 outputs. So once again I used the 74HC595 Shift-register IC to take care of that problem reducing 20 output’s to 5 (Possible for 3 if OE and RESET tied to rails).
For the display I used high brightness, blue LEDs (The second largest costing component to the frame). These were pretty decent quality considering the price at only 18 cents each. However, my mistake was choosing LEDs with only a 16° viewing angle. This meant that the light coverage was not consistent across the letters, showing obvious light decay at the letter corners (even with diffusion). Using larger viewing angle LEDs would be preferred if doing this project again.
This was the first chance I’ve had to use Atmel Studio 6 and I thoroughly enjoyed the experience. I imagine I will continue to use Atmel for any embedded projects in the near future. The Attiny2313 only has 2KB of program memory, which meant I needed to be careful about how much I used and I ended up hard on that limit (97.5%).
The LED driving was taken care of by the Shift Registers, but I needed to write functions to convert a time (given from the RTC) the the correct ones and zeros. Once this was completed, the I2C drivers needed writing. Because I hate reinventing the wheel, I borrowed doctek’s I2C drivers from his Instructable. This then took a little configuring to get the correct data from the RTC.
Finally, polling inputs were added to allow the user to modify the time on the clock (in increments of 5 minutes of course). The original plan was to use interrupts here, however this made too much disruption to the main loop which needs to keep its timing correct else the display can’t resolve.
The entire code can be found up on Github for your viewing pleasure.
Bill of Materials
The costs listed below are all in NZ$.
|8″ x 8″ Square Frame||framingonline.co.nz||1||$29.80|
|Attiny2313||Atmel 8-bit Micro||element14||1||$5.94|
|DS1307||I2C Real-Time Clock||element14||1||$6.76|
|74HC595||8-bit Shift Register||element14||3||$3.03|
|10uF Capacitor||Own Stock||1|
|64 ohm Resistor||Own Stock||11|
|4.7 Kohm Resistor||Own Stock||5|
|MTP3055E||N-Channel MOSFET||Own Stock||9|
|Push Button||Own Stock||3|
|6 Way Header||Own Stock||1|