Binary Clock

A friend of mine (yes, the Nearly' has friends!) wanted to build a simple digital circuit to learn a little about hardware and circuit design. We decided to build a circuit to count the time in binary.

The longest binary number that is quick and convenient to read and convert to decimal in your head is eight bits, or one byte. 8 bits is also convenient since you can buy 8 bit integrated circuit counters. With one byte you can count up to 256 (2^8) so the circuit should count up to 240 in 24 hours, making the time easy to read off - just convert the binary number to decimal and divide by 10 to get the time in hours, to within one tenth of an hour (6 minutes).

If the counter needs to count every 6 minutes then it needs a digital clock with a period of 6 minutes. However, 6 minutes is an aeon in digital terms, and it is actually quite difficult to make a clock that slow with any degree of accuracy (due to the component values involved), and since we hope to keep fairly accurate time, it needs a faster clock. The easiest way around this is to divide the clock period by 256, since this can be done by using a second counter as shown later. So, the new clock has a period of 360/256 = 1.40625 seconds.

In order to generate the clock a '555 timer' is used. This is a common chip used to generate clocks. The clock period is determined by the values of two resistors and one capacitor hooked up to the chip. The equation is

frequency = 1.44 / ((R1 + (2 * R2)) * C)

From the equation we can work out the needed resistance and capacitance values, which are R1 = 1 kilo-ohm, R2 = 200 kilo-ohm and C = 10 micro-farad. These are not the exact values required, but since component values are never exact (you can't buy a precisely 1 ohm resistor for example, there's always a % accuracy) we will use a variable R2 resistor to fine tune the timer to exactly the right period. Furthermore, since you can only tune a resistor in 'steps' of a certain amount, R2 will be made up of a large variable resistor and a small variable resistor in series, which will allow us to set R2 to a sufficient degree of accuracy.

It turns out that 240 is a very convenient number to reset the clock at, since in binary 240 = 11110000. The reset is implemented with a simple 4 input AND gate on the first 4 bits of the number. When these are all 1 then the AND gate generates a 1 at its output which resets the counters.

The LEDs to show the output number are connected in series with 1 kilo-ohm resistors. Since the output voltage for a '1' in this circuit is 5 volts, this limits the current flowing through the LEDs to 5 milli-amps in accordance with Ohm's Law which says that:

Volatage = Current * Resistance

The only other thing the circuit needs now is power. For convenience and size a 9 volt battery is used to power the circuit. Unfortunately, the logic chips (counters and AND gate) in the circuit need a 5 volt power supply. The voltage from the battery is reduced to a stable 5 volts using a voltage regulator chip. This is a good idea since the chip will keep the power at a steady 5 volts even as the voltage from the battery drops as it runs down.

So, that's the theory. Below are some photos of the clock being built! Also, a dodgy photo of the schematic until I get around to drawing up a nice web version.


Oooh, prototypical!

Prototyping

Here's a shot of the circuit in progress on a breadboard, checking that everything works the way I think it should...

Slice and Dice

On the Slab

Getting ready to build the circuit on some veroboard.

Virgin territory

Virgin Board

This is the board all the components are soldered onto. Veroboard is very handy stuff for simple, once-off projects like this, that don't warrant the time and expense of making up printed circuit boards.

Sweet.

Done

Here's one I made earlier.

Wanna see my tracks?

Seamy Underbelly

The underside of the completed board, showing off my dodgy soldering.

Shoddy work Ted.

Schematic

Pretty self explanatory. This schematic shows how the components fit onto the veroboard grid.