Reading Punch Cards With An Arduino And Digital Camera

[digitaltrails] wanted the data on a few old IBM 80-column punch cards he had lying around, but didn’t have decades old computer hardware in his garage. He decided to build his own out of LEGO, an Arduino, a digital camera, and a bit of Python.

The hardware portion of [digitaltrails] build includes a crank-operated feed mechanism made entirely out of LEGO. For each turn of the crank, the feed mechanism sends one card down a chute where a photodetector wired into an Arduino tells a camera to take a picture. After that, a servo is activated, sending the card into the ‘already scanned’ bin.

On the software side of the build, [digitatrails] used the Python Imaging Library to scan one row of pixels where each column is expected to be. The software outputs the code and data contained on the 80-column card as well as a very cool ASCII art version of each card.

Considering you just can’t go down to Fry’s and buy an IBM 80-column punch card reader, we’re loving [digitatrails]’ clever way of getting data off an otherwise unreadable storage medium. Check out the video of the card reader in action after the break.


27 thoughts on “Reading Punch Cards With An Arduino And Digital Camera

  1. Since he has built it out of lego, and is using an arduino, why isn’t the crank motorized?

    Yet another completely useless use of an arduino sneaks into hackaday because it means they can put “arduino” in the title.

    1. …You honestly believe that they put an arduino in there to get more page views? You don’t think it has something to do with the fact that it’s the easiest prototyping tool released in years? :)

      1. Not. True. At. All.
        Picaxe, Basic Stamp and Mindstorm – just to name a few.
        Actually it’s this sort of hyperbole/hubris that breeds (at least some of) the dissent.

        The remarkable/key thing here is the python. The feed mechanism was unremarkable and certainly did not READ the punchcard as the title (dishonestly) implies. If it had then it would be remarkable. Further, the maker does not express this hubris.

  2. Arduino is definitely pointless in this build. Since the user has to sit there the whole time in order to operate the crank (which is kind of odd to begin with), he could just as easily press a button to take the image rather than having the Arduino play around with a photosensor.

    Unless the idea is to eventually automate it completely? That’s the only thing that would make sense.

    1. That was my thought, but in that case this should not have been sent in, nor published since it’s a half finished build.

      The guy building it should have waited until he was finished before sending it to HaD.

  3. I’m really struggling to see the value in this one. I don’t really have much. An example of, “if you have an Arduino, look what you can do?” Maybe the Python code that reads the cards… I did mine using Perl and Tesseract but to each their own I guess.

    A few days a go, a MAME controller concept and “parts list” and today this? I know HaD wants us to ease back on the negative posts but it’s a tough sell when even the introductory stuff has so little meat. If I didn’t know any better, I would say some of the projects are being created just to make an appearance, the same kind of gaming that prompted me to stop visiting sites like Digg.

  4. Wow. Sounds like some people have a bad case of the Monday’s…

    I find this an interesting project, with exemplary documentation and presentation. Here’s someone who not only applied the tools he had (and wanted to use) to fulfill a function, but also went to the trouble of documenting the whole process and making it available to everyone.

    If there’s nothing you can take from the project itself, then at least take some notes on presentation. (What’s that? You don’t actually make anything or present it? Thought so…)

    Also, I think this is the ideal use for an Arduino. It is the microcontroller equivalent to the Lego. On my projects, I use bare AVR’s, first test everything on a breadboard, then make a PCB (usually perfboard). But those are for dedicated applications, and see prolonged use. For having something flexible, that can you quickly set up, the arduino seems more useful.

    Lastly, I don’t know how stiff those cards are, but I have an office-type printer/scanner with automatic paper feed. I think that might do away with the whole set-up, and only require the image recognition ;)

    1. Those cards will go through a scanner quite readily. They were designed to go through card readers at a rate of several per second. They are ‘card stock’. The odd size can be problematic for some scanners.

      The problem with using a scanner would likely be issues with false readings since the holes would show ‘black’ and could be confused with ink, blotches… on the cards.

      Most cards have the text of what the holes say at the top of the card. Might be easier to OCR that, though there were special control characters that wouldn’t be ‘readable’.

      Nice solution for low volume needs.

  5. Good for low volume readins. I have seen entire boxes of cards being shoved into a CDC reader (about a 4ft track of cards). For that… (if that kind of data/sw is remotely useful anymore) I would think about… a motor :)

  6. I like the build, but was blown away that cards hold not only code but also the comments; seems like a waste of space on so low density medium – at fisrt… But after so much time the comments make it legible.

  7. I like how he took the result of the conversion and loaded it in a compiler/simulator for a full end-to-end result. He actually used the cards to get a 32 year old program running again.

    This shows one of the advantages of physical media (as opposed to magnetic media) for durability. You probably couldn’t take a 32 year old disk pack and read it with a handful of LEGOs, an Arduino, a camera and some Python script. (I wonder if I have any of that punch paper tape around somewhere…)

  8. I have several boxes of IBM punch cards that I would like to convert to files for CD storage.

    I’ve thought about it for a while – how to do it.

    I thought I could use IR detectors – one per row – and drop the card through a chute.

    Sample the 10 or so light detectors, storing values in RAM.

    I would measure the time from start of card to end of card as it fell through the chute.

    Then I would calculate the time per column – 80 columns (ignoring the header/trailer, and sample the stored light presence/absence polled values in RAM.

    I believe that would work – but I haven’t gotten around to implementing/testing my plan.

  9. Once, while at DEC, I tried to stop the Sorcerer’s Apprentice that was the Columbia Record Club. Finally, I took their punch card, which was NOT printed and read it to find only my address and account. I stepped it through a card punch to a blank space, punched “Cancel me, Asshole!” and sent it in.

    I never heard from them again.

  10. Jesus christ people…what if he already owned an Arduino before the project started. He shouldn’t NOT USE IT because of HaD critics. I know when I build something I don’t NOT use something because its too powerful. I’m not sitting here playing solitaire and suddenly stop, go to a 486 laptop and then feel better about myself like some people on here apparently must.

  11. Uhm, excuse me? Do any of you remember this?

    If you don’t have something constructive to say about this post, DO NOT POST. Your criticism is absolutely not welcomed here.

    Sven, Cyril, MS3FGX, and SavannahLion should be the first to be added to the official Hackaday Hall of Douchebaggery. Now, take your severe case of douchebaggery somewhere else, and let us hack in peace.

  12. I have 15,000 IBM 80 column punched cards with only numeric data. I would like the data to be digitized (to, say, Excel format). Please contact me if you know of anyone doing this. has gone out of business. Contact

Leave a Reply

Please be kind and respectful to help make the comments section excellent. (Comment Policy)

This site uses Akismet to reduce spam. Learn how your comment data is processed.