acedev003@rand_bytes-earth1:~$

Within A Game - Building a 7 Segment Display

So after a long time, thought to dust off this little page over here. One of the very few games I have in my device is Minetest, which is an open-source voxel game engine similiar to the likes of Minecraft - albeit a 100 times faster (C++ > Java). Minecraft allows for building circuitry and electrical contraptions via a sort of pixie dust called as redstone. Likewise, in minetest we have mesecons - an even better circuity mod with built in logic gates such as AND, OR, NOT, NAND, FPGA’s etc along with controllers, sensors etc.


Starting off, what is a 7 segment display? As the name suggests, it is an electronic display device with 7 individual segments (labelled from a to g) of LED’s arranged as the letter 8. Lighting up specific segments of this display allows us to represent various letters such as the digits 1-9, certain alphabets etc.

Picture of 7 Segment display 7 Segment display pinout diagram

Building one within minetest is quite simple. Slap on a bunch of lamps, wire them appropriately, add switches and voila, you have a working 7 segment display. But what fun exists to turn on a bunch of light segments with 7 switches. What if we could let the digits change automatically, cycling through various digits and alphabets. Even better, what if we could run them without any hacks such as programmable controllers - just pure raw logic gates 🤠.

Picture of 7 Segment display in Minetest Picture of 7 Segment display wiring in Minetest


The heart of any computing device is it’s clock which sends pulses at regular intervals. It’s these pulses which prompt the various operations within the device, synchronizing its various components. A CPU, for example, relies on the clock to fetch and execute instructions, ensuring tasks are carried out in the correct sequence and timing. For us, this clock will be used to run a binary counter, which in turn will be used to drive the 7 segment display. Building a clock in minetest is relatively simple - you could just use the default built-in blinky plant, but it switches at an extremely high frequency of 0.3 Hz. As I didn’t have the patience to bear this speed, a simple contraption using delayers was built.

Clock implemented in Minetest

Now that we have a clock that is fast enough, the next step is to construct a counter that increments values and loops back to the initial value after reaching a certain count. Here we have settled for a 4-bit counter, which gives us a total of 24 = 16 values (0-9,A-F). The counter we have here is modelled as a asynchronous ripple counter built out of T flip-flops. This video gives a good overview on the working principle of these counters. Have to admit that I ended up using a microcontroller implementation contrary to just pure logic gates in implementing the flip-flop for want of space 😅. In the end we have the following:

Binary counter implemented in Minetest

With the counter completed, our next objective is to create a digital converter capable of receiving any 4-bit binary value and producing its corresponding 7-segment activation, indicating which segment should be turned on or off. This involves generating a table that lists the activations (0 or 1) of each segment for every possible 4-bit binary input. From this table, we construct a 4-variable Karnaugh Map for each segment, resulting in a Boolean expression with a 4-variable input for each of the 7 segments. The following online tool was used to create the K-Map for each segment. Along with the input-segment mapping table, a K-Map computed 4 variable mapping for segment ‘A’ is also given below.

Final output truth map Generated KMAP diagram

With all of this done, the final piece is to assemble this converter in minetest. After an hour of placing wires and blocks, this is what we finally end at:

Final Output


WorldEdit files for the above can be found at github.com/Acedev003/Minetest-Projects. Another amazing reference to check out is the amazing video series by Ben Eater in Youtube. Till then, cya’ll . . .

Jolly Exploring!