Wednesday, January 6, 2010

Arduino Binary Clock



So far, this has been hands down my favorite clock.  Over the winter break, I meant to build a real case for it and turn it into something permanent, but like so many other things, I just couldn't keep it above the water mark that is utter exhaustion from last quarter and only three weeks of break.

Binary clocks are a classic nerd cred device.  Instead of displaying the time on a circle, or with numbers, this clock just lights up LEDs that stand for powers of 2, and you're on your own to figure out what they mean.  The bottom row is 1, then 2, then 4, then 8, 16, and finally 32 for minutes and seconds.  Most commercial binary clocks I've seen use binary coded decimal, where each digit is individually encoded in binary, but I liked the idea of only having three columns of LEDs: hours, minutes, seconds.  In the picture, the clock is reading 8:24:55 (8:8+16:1+2+4+16+32).  The trick is that the top two LEDs are worth 16 and 32, so they're close enough to a quarter and half hour that you can just look at them to get a good idea are far into the hour you are.

The LEDs are lit up by a 16 bit LED driver, which was required because lighting 16 LEDs is too much for the Arduino on its own, current-wise.  Just connect the positive side of the LEDs to some positive voltage, the negative sides to the driver, and then tell the driver which LEDs to light up, using the standard shift register interface.

Parts list:
  • DS1307 clock chip + 32.768kHz 12.5pF crystal (surprise?)
  • 16 bit LED driver (Digikey) Chaining two 8 bit drivers would be just as good, and trivial.
  • 16 LEDs + another one for AM/PM (I just used the pin 13 one on the Arduino board)
  • 2 push buttons for setting the time
Source code.

No comments:

Post a Comment