Binary clock circuit: BCD hours and minutes, live
A binary clock shows the time in binary-coded decimal: each decimal digit of HH:MM gets its own column of bits, so 13:47 reads 01, 0011, 100, 0111. This live clock counts real BCD hours and minutes from 00:00 to 23:59 and back to 00:00, one minute per tick of its clock.
To read it, take each column on its own and add up the weights of its lit bits, 8, 4, 2 and 1 from the top: HT (hours tens, 2 bits, 0 to 2), HO (hours ones, 4 bits, 0 to 9), MT (minutes tens, 3 bits, 0 to 5) and MO (minutes ones, 4 bits, 0 to 9). Inside, four BCD digit counters share one clock, so every digit changes on the same edge: MO counts every tick and wraps from 9 to 0; MT moves on when MO is 9 and wraps from 5 to 0; and the hours move on when the minutes read 59. The hours have to be one counter, not two, because their ones digit normally wraps at 9 but at 23 both hour digits go back to 0 together. Each flip-flop's next value is a minimal sum of products of its digit's enable and bits, found with the Quine-McCluskey method using the codes a digit never shows (MO above 9, MT above 5, hours past 23) as don't-cares, each digit a close relative of the decade counter. A real binary clock adds a seconds pair (another 0 to 5 and 0 to 9 digit) and divides a crystal down to one tick per second, for example with a CD4060, whose 14 stages turn 32,768 Hz into 2 Hz. Here each tick is a minute, so you can watch the hours change. The live clock opens with CLR high (00:00); set CLR to 0 and it starts counting. Before the page is built, 130 minutes are checked on all 13 outputs on the running clock, and the whole day, every minute from 00:00 through 23:59 and back to 00:00, has been checked with the clock stepped by hand.
Open this circuit in the lab →
What you need
- 13× D flip-flop with clear: the BCD digits: hours tens (2 bits), hours ones (4), minutes tens (3) and minutes ones (4), all on one clock
- 3× AND + 2 NOT: the carries: minutes ones at 9 (MO3 MO0), and minutes at 59 (that AND MT2 MT0)
- 52× AND + 23 OR: the 13 next-state functions, one minimal sum of products per flip-flop, with the unused codes as don't-cares
Step by step
- Place a clock
CLK, an inputCLR, and probesHT1HT0,HO3toHO0,MT2toMT0andMO3toMO0. - Build the minutes ones as a BCD counter on CLK: 0 to 9 and back to 0.
- Build the minutes tens as a 0-to-5 counter that only moves when the ones digit is 9.
- Build the hours as one counter from 00 to 23 that moves when the minutes read 59. Clear, then let it run: 00:59 is followed by 01:00, and 23:59 by 00:00.
Reading the time
| Time | HT | HO | MT | MO |
|---|---|---|---|---|
| 00:00 | 00 | 0000 | 000 | 0000 |
| 09:59 | 00 | 1001 | 101 | 1001 |
| 10:00 | 01 | 0000 | 000 | 0000 |
| 13:47 | 01 | 0011 | 100 | 0111 |
| 23:59 | 10 | 0011 | 101 | 1001 |
Each column is one decimal digit in BCD, most significant bit first. Because every digit has its own column, a binary clock is read digit by digit rather than as one big binary number.
You can also read the full theory in the lesson on BCD. Prefer to build it yourself from scratch? Open the digiwleea lab and place the gates on the canvas, or start from the logic gate simulator.
Build more parts from gates
Each of these is one step from a transistor to a working CPU. Build every gate from CMOS transistors and work all the way up in the free digiwleea lab, with the free theory reference alongside.
Open the binary clock circuit in the lab →Frequently asked
How do you read a binary clock?
Each column is one digit of the time in binary-coded decimal. Add the values of the lit bits in a column (8, 4, 2, 1 from the top) to get that digit, then read the digits left to right as HH:MM, or HH:MM:SS if the clock shows seconds.
How does a binary clock work inside?
A chain of BCD counters, one per digit, all on one clock. Each digit counts up when every digit to its right is at its maximum (9, or 5 for the tens of minutes and seconds), and the hours wrap from 23 to 00 together.
Why does a binary clock use BCD instead of plain binary?
So each decimal digit can be read on its own. In plain binary the minutes 0 to 59 would need one 6-bit number, which is harder to read at a glance.
How many LEDs does a binary clock need?
For HH:MM in BCD, 13: 2 for the hours tens, 4 for the hours ones, 3 for the minutes tens and 4 for the minutes ones. Showing seconds adds 7 more.