For the 2nd x-mas day I decided to make a clock. I recently (well already 1.5 years ago I build a nixie clock. We are moving building at work and one thing I miss in my current room is a clock. Bringing a nixie clock was my first idea, but it has some problems. Firstly it is expensive to build (especially the tubes that have a real 5 not an upside down 2), it has 170V running through it and relatively easy to access and it probably wears down pretty quickly when used 24/5.
So lets build something new, preferable with LEDs. But any clock won’t do, I had some ideas:
- . Binary Clock.
- . Non normal clock-face design.
Secondly I had some extra requirements:
- . The minimal number of components needed and wires. This so if I like it I can easily make a cheap PCB.
- . Possible show temperature.
- . PC interface, so maybe to use for notifications.
I had this idea for a binary clock face a while back, its simple and it is round (like a clock). The top part (yellow leds) shows minutes, the middle part (red leds) hours (1-12 h) and bottom part (blue leds) seconds.
I am pretty confident it will work out.
As I said I wanted to use the least amount of components, basically:
- 16 LEDs and 2 resistors for the display.
- MCU (for now I took an Arduino I had lying around) plan to take an Cortex m0 later.
- DS1820 temperature sensor and pull-up resistor.
So I wanted the least amount of wires. So I re-used a trick I used several years back, to hook up LEDs. In this design I control 16 LEDs with 6 wires in total. Not sure hot to do it with less (without using extra hardware or LEDs with controllers build in).
It is a 2x4 grid (4 columns 2 banks), Then we can double the amount of entries by reversing polarity. If it works in star-trek why wouldn’t it work for me. The software is a bit more tricky, you can only enable certain LEDs at the same time (I choose to have only one on at the same time) and you need 3 states: High, Low, Floating. Luckely this is something easy to do on an AVR. The required resistors are in the bank lines.
This is where things get tricky, LEDs have the tendency to be bright, very bright. To top that, the only LEDs I had in stock where ultra-brights. So I tried several solutions:
- . Shine through wood. An idea that I had for a while now, but never knew if it would work. I drilled a hole that almost completely through the wood except for the last 0.5 mm (and dried various other depths). This did not give the desired result. The best result gave a weird stripe with the ‘flow of the wood’. I knew it was a long shot. Maybe I find the right wood for this later.
- . Veneer. I did not have anything sufficiently thin to work.
- . Milk-glass. This worked very well, except that the off-state are hard to see. Making it hard to read the time. So some ‘labeling’ on the glass was needed.
- . Paper. This worked surprisingly well and gave a nice ‘look’. Especially with the next point added.
- . Deep hole. I sunk the leds in a 3 mm deep hole, This looks very nice when looking at it from a (slight) angle. The problem of brightness still remains when looking directly in it.
- . I have some more ideas in combination with 5. If I find something perfect, I will blog about it.
For now I went with method 5, in a small wooden box. This box once held a ‘Amphenol precision connector/APC’ and dates back from 1973 or so. I got a few of these from the trash at work. If I am going to make a PCB I will make a nice small case around it. (Could be a watch?)
I also included the temperature sensor half embedded in the back of the case.
The software can be found on GitHub. It is a simple arduino sketch, that uses lower level register access here and there to speed things up (and I am more used doing it this way). As said before, only one led can be turned on at the time, but quickly turning the required LEDs on and off I can create the illusion that any number of led is on. By playing with on/off time I can also dim them when needed.
There currently is a simple API for controlling things:
- sHHMMSS Set time.
- t Show temperature.
- a Turn on all LEDs.
- x Test sequence.
- lX Set led on time between 0 and 255 (raw).
- dX Set led off time between 0 and 255 (raw).
More to come.
There is more to do, like with any project.
- Make a final version.
- Port to Cortex M0.
- Make small PCB.
- Get time via Wireless or DCF.
- Button to show temperature.