Digital Clock

The game Minecraft has an item called redstone, a current-carrying substance that is used for wiring. The way that redstone interacts with other blocks and things called redstone torches allows for the construction of logic gates within the game.

Using these basic logic gates, you can build some pretty cool things. At the end of my Sophomore year of high school, I applied what I had learned about circuitry from my Computer Science II class to build a functional digital clock in the game. Although I used the minecraft wiki for the basic logic gates, the schematics, design, and construction of the circuitry in the clock are all mine.

This post is going to be hard to follow if you don't have a background in electrical engineering. I'll define a couple of terms here:
D flip-flop: a type of memory gate. It stores what ever data is in the input when the clock signal changes, and outputs the data that is stored.
Multiplexer: a logic gate that chooses between two inputs based on a selector input. These can be strung together successively to create a larger multiplexer that chooses between many inputs.
Other non-basic gates will be explained later in the post.

Minecraft time works on a 20-minute cycle. This allowed for an easy division into two ten minute periods, AM and PM. The current time can thus be represented with a single digit and an AM/PM indicator (on the right hand side in the image below, top light is AM and bottom light is PM (the sign text did not render correctly in the screenshot)).

Here's the interface:

And here's the circuitry:


The design is as follows: a 4-bit full adder is combined with 4 D flip-flops and to create a 4-bit incrementer. The output of this incrementer is used as the selector bits for a 10-input 8-bit multiplexer. The multiplexer chooses from stored presets of 8-bit memory which represent the LED segments to be on or off for the current clock state. The output of the multiplexer is connected to the LED segments in the display. The incrementer is wired to reset upon reaching "10". An additional D flip-flop stores the AM/PM state and alternates when the incrementer output is "0". The internal clock is set to release a pulse every minute.

In laymen's terms, the circuit stores the current time in a counter and adds 1 to this counter every minute. The number in the counter is used to select from stored presets of on and off signals for the individual segments of the LED clock display. 

The layout is color coded as follows: gold is the incrementer, sandstone(tan) is the 10-input multiplexer  iron(grey, left side) is the connection of the circuit to the LED, diamond(blue) is the AM/PM state control, wood(white rectangle on the far right) is the clock.

Here are the parts in more detail:



The Incrementer. The bottom image is of the memory cells, 4 D flip-flops. The top image is the 4-bit adder. The output of each adder is the input for each flip-flop. The inputs of each adder part are the output of each flip-flop and a carry bit. The adder part for the first flip-flop, which stores the least significant bit, also has a constant "1" being added to it. Every time the clock changes state, the first bit has one added to it and any overflow is used as the carry bit for the next adder part; in this way, the addition cascades through the memory cells. The result is an incremeter which stores the binary representation of an integer. This integer is the current time.

At the bottom of each flip-flop is a golden cross; this is a multiplexer that chooses between the output of adder part and a constant 0 as the input for the flip-flop. The selector bit is set to 0 when the incremeter reaches "10", causing the 0 to be chosen as the input by the multiplexer  This allows the clock to reset to 0 after ten minutes.

The clock. This is the simplest part of the circuit. It is a pulse being sent along a loop of redstone repeaters. These are set to slow down the propagation speed of the pulse such that a full loop takes exactly one minute.  It is not a traditional circuit clock in that it sends a pulse rather than alternating states at a constant rate. The output of the clock is hooked up to every D flip-flop.

The multiplexers  This is a stack of 8, 10-input multiplexers  They use the output of the incrementer for the selector bits. Each choice in the multiplexer's inputs is a permanent on or off signal, as shown below.
When the incrementer state is 0, the leftmost column of switches will be chosen. When it is 9, the rightmost column of switches will be chosen. Each row of the column (meaning each layer of multiplexer in the stack of 8)  is connected to a segment of the LED display. These store the states of what to display for what time.

The AM/PM state control. This is a simple D flip-flop. The output is wired back to the input with an intermediate NOT gate to invert it. It is not hooked up to the main clock. When the clock state is 0, wiring elsewhere sets the "clock" input to turn on. This causes a few things to occur: first the piston pushes a block that cuts off the signal, turning the signal into a shorter pulse (after the clock state advances to 1, this piston will no longer receive power and be reset); second the flip-flop alternates state. When the output is 0, the indicator for AM is on. When the output is 1, the indicator for PM is on.

There is some intermediate wiring and logic gates in between these parts, as well. I won't go into detail about all of those. 


This project took about three weeks, including design, redesign, construction, more redesign, and the finishing touches. I had set out with the goal of applying my knowledge of computer science to a real and challenging project, and feel I accomplished that goal. I also achieved my secondary objectives of having a design that was compact and aesthetically pleasing. I researched the circuitry of real digital clocks after I had finished and found that my design was largely similar.

To end: here is a video of the clock in action. It is about 3/4 of a full day, sped up 16x. (Unfortunately, some of the game aspects of Minecraft came up while I was recording, and there are bats that fly on the screen and a distant lightning storm.)







The link I put on MIT takes you to this post and not the main blog. Please check out this post too!