You should already know by now that the new LEGO collectible minifigs have all different, identifiable barcodes. (If you don’t, you may want to check Brickset or any other LEGO-related site more regularly.)

But if you’re willing to spoil the fun of getting a random minifig, then you’re probably the kind of person who would find cumbersome to compare tiny strips of black bars to find the one you want. A barcode scanner might help, and if you think a barcode scanner is not an everyday device, think again: most smartphones have a built-in camera that can do just that. Well, android smartphones do, in any case, and it’s also quite simple to program one just for that purpose.

What do you need?

An android smartphone
That’s actually the difficult step, and I don’t suppose you’d want to buy one just for this. And if you’re considering buying one, well, there are a lot of other sites devoted to help you pick the one most suitable for you.
The Barcode Scanner application from the ZXing project
This is an excellent application by itself and you should already have installed it. If not, just search for ZXing in the Market.
The android scripting engine
This allows you to program simple scripts on android in a variety of languages. Note that now that you have installed the barcode scanner, you just need to run it and scan the strange picture on homepage of the android scripting engine to install it.
The python interpreter for the Android Scripting Engine.
I’m not particularly devoted to python, it’s just the one in the list of abailable interpreters with which I’m the least unfamiliar.

Granted, that’s a long list of ingredients for such a simple task, but hopefully these will help you for other thing as well. At this point, the only missing thing is a python script which will scan the barcode, identify the minifig, and tell you which it is. And of course that’s the whole point of this article, so here it is:

scan_minifig.png

Well, it’s not the script itself, but now you have everything to scan it anyway. Launch the Android Scripting Engine, which by now should show you a bunch of python samples, hit the menu, then add, and pick Scan Barcode. Scan the image above, and the script minifig_scan.py should have been added to the list of scripts.

To use it, simply click on it. Assuming you have been patient enough to resist opening that minifig bag until now, scan its barcode. I’ve heard there are two barcodes, pick the good one. Sadly, I have none of these minifigs yet, so I had to test on the PDF file.

Feel free to send me one!