Data storage

How to Use LEGO Bricks for Data Storage

Those old enough to have encountered punched cards in their lifetime are probably happy to be rid of their extremely low data density and the propensity of large stacks to topple over. But as outdated as they are, they’re a great tool for showing the basics of binary data storage: the bits are easily visible and can even be manipulated with simple tools. As an experiment to recreate these features in a more modern system, [Michael Kohn] created a punch-card-like system based on LEGO bricks that stores machine code instructions for a 65C816 processor, the 16-bit successor to the venerable 6502.

The bits are stored on an 8×20 white nailboard, on which small black pieces are placed. A white background stud encodes a logical “zero”, while a black stud encodes a logical “one”. The bits are read by a set of reflective sensors, which have the same 8mm pitch as standard LEGO studs. A large wheel driven by a stepper motor slides the data card under the reading circuit along a short stretch of LEGO train tracks.

The optical sensors are read by an MSP430 series microcontroller, which also drives the motor via a stepper motor driver. After the data is read, the bytes are transferred to a WDC W65C265SXB card, which executes them as machine code instructions on its 65C816 processor. In the video below, you can see a program loading that causes an LED to flash.

We’ve featured educational punch card systems before, like this Raspberry Pi-based model. If you’ve got a bunch of actual punch cards that need to be read, check out this Arduino-powered reading system.