Those old enough to have encountered punch cards in their lifetime are probably glad to be rid of their extremely low data density and the propensity of tall stacks to tip over. But obsolete as they may be, they’re a great tool to show the basics of binary data storage: the bits are easily visible and can even be manipulated with simple tools. As an experiment to re-create those features in a more modern system, [Michael Kohn] made a punch card-like system based on LEGO bricks that stores machine code instructions for a 65C816 CPU, the 16-bit successor to the venerable 6502.
Bits are stored on a white 8×20 stud board, onto which small black pieces are placed. A white background stud encodes a logic “zero”, while a black stud encodes a logic “one”. The bits are read out by an array of reflectance sensors, which conveniently has the same 8 mm pitch as standard LEGO studs. A big wheel driven by a stepper motor slides the data card under the readout circuit along a short stretch of LEGO train tracks.
The optical sensors are read out by an MSP430 series microcontroller, which also drives the motor through a stepper motor driver. Once the data is read out, the bytes are transferred into a WDC W65C265SXB board, which executes them as machine code instructions on its 65C816 CPU. In the video below, you can see a program being loaded that blinks an LED.
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 reading out, check out this Arduino-powered readout system.
This post just comes in time for me. Thank you.
I was experimenting with using 4 LDRs and a 4011 to grab data displayed as black and white squares on my monitor.
This is definitely an extension to try out. And shows what is going on. A nice demo.
Could be used for programming our TPS
https://www.facebook.com/groups/269499491046124
Many of the demo programs would fit on there in 4 bit
Now, add some lego to detect height of the bits and do multi dimensional storage.
Wonder how large the bricks would be to store the private key to a crypto wallet.
I’m not into crypto, but assuming a 256-bit key, 256/8=32 of the columns from this vid, so about half again as long as the current trolley.
256-bit is a good length for a symmetric key (for instance AES), fo a private key at least 2048-bit is recommended and you would need a second card for the public key.
Ah punch cards. I remember those days. The best (maybe only good thing) about them was that if you dropped a card deck you sometimes had the “opportunity” forced on you to rewrite your program. And it usually came out better the second time.
I seem to remember one would draw a diagonal mark across the top of the deck so you could get them back in order.
Also, in the university’s terminal room, they had a vending machine set up so one could buy unpunched cards.
” they’re a great tool to show the basics of binary data storage:”
especially when they are base 10 !
https://en.wikipedia.org/wiki/Punch_cards
okay not all of them, but the classic IBM had rows 0-9 and a +10 (X) or +20 (Y) row.
and then it uses the 0 row as a +30 and …. well yea.
-G
Why not try Lego QR codes?
We may have now recreated the Os running the multiverse.