Tuesday, January 17, 2012

Binary Clock

Here is a cool project that keeps surprisingly good time.  I had wanted to build a binary clock using a PIC F84 microprocessor.  A binary clock is one that counts up using the binary counting system of 1's and 0's.  In this case the column of lights furthest to the right is the 1's column, followed by the 2's, 4's, 8's, 16's and 32's columns. Using this system 100110 is 32+4+2=38.

The problem with this project was that although I could get the clock to work, I had a miserable time getting the clock to keep accurate time and also be able to display the time using LEDs.  If I had a seperate time keeper, the project would have been a breeze but using PIC Basic as the programming language made it hard to be able to tell to the microsecond how long various arguments would take to execute.  I gave up a few years ago but revisited this project just about a year and a half ago.  This time I came at the problem from the angle of using Assembly Language as the programming language.  This took all the timing variables out because I knew the frequency of my crystal and also knew how long each operation would take.  After some experimentation on a bread board I had a stable and well functioning circuit.  When I soldered up the project, the timing changed and it took several weeks of bench-top experimentation to get the clock working to be accurate to within a second or two per week.

The buttons are for suspending the timer and setting the minutes and hours.  It uses a twenty four hour timing period and the LEDs are muiltplexed in sequence because the PIC F84 has only 12 output pins and I need to drive 17 LEDs.  The circuit strobes the hours LEDs, then the minutes LEDs and lastly the seconds LEDs.  This happens so quickly that there is no blinking or flickering, although there is occasionally a little ghosting in non lit LEDs that can be seen in a very dark room.  The power supply is a 9V DC wall transformer and the case is an Altoid tin because every electronics project is cooler if you can fit it in an Altoid tin...

The time is 8:28 and 53 seconds


No comments:

Post a Comment