8 projects with LEGO: plastic bricks meet open source

No readers like this yet.
open source button on keyboard


LEGO bricks: To a parent, they're a virtual minefield, hidden away in the carpet to inflict unimaginable pain from a seemly innocent barefoot step. But to a child, they are a tool for creatively engineering anything the mind can imagine. And for many, they are our first foray into open source. The instructions with a LEGO set start out as rigid rules, and become merely guidelines as children learn to remix, adapt, and extend the "code" which defines the object being built, and then be shared with anyone nearby.

Those of us who grew up with LEGO kits remember the joy we felt building our own creations from tiny pieces, taking nothing and molding it into something. And you know what? Forget the code analogies: LEGO sets are still just plain fun to play with as an adult, reengaging our creative side and letting us make even cooler and more intricate objects as our patience matures. They may be a toy, but those little bricks let us engineer some pretty awesome things.

For serious LEGO aficionados, the fun doesn't end as we age. There's a huge community out there of LEGO builders, many of whom have open sourced their creations, like the instructions for this cool looking phone dock on GitHub. Others have created whole new tools for working with LEGO projects so others can share in the fun. Even LEGO itself has gotten in on the open source game, releasing the code to their Android application for LEGO Mindstorms under the GPL.

Here are some of the best open source LEGO projects I've come across, great for kids and adults alike.

Create custom decals for your LEGO Minifigs

MinifigFirst up, let's talk about minifigs. Minifigs, for the uninitiated, are the LEGO "people" which come with most sets, typically sporting a yellow face and a variety of accessories. In the olden days, minifigs didn't come with much variety. There were a few different faces, and a few different looks for different themes (space, pirates, castles, etc.) in the LEGO universe. Today, there are many more, but for the particularly avid fan, why not print your own? Check out this collection of SVG files designed to be used to create your own minifigs, with faces, costumes, and more. You can adapt and edit to make them truly yours, as they are available under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 license.

Show off your LEGO collection with Wordpress

Acquired a huge LEGO collection that you want to show off to the world? Want to list every set you've got so you can compare and make trades? This LEGO Wordpress plugin is for you. By making use of the Brickset API, the plugin grabs information about your selected LEGO sets from an unofficial database and displays them in nice formatted tables on your Wordpress blog, either as summaries or detailed information about a particular set. You'll need a Brickset API key to use it, but the code itself is open source under the GPL version 2.

Draw a LEGO model in a CAD program

Whether you're detailing instructions to keep a record of a custom LEGO creation you've already built, or planning out your next idea, a CAD program can be a useful tool for modeling your real-world constructions in a virtual environment. LDraw is an open standard for CAD programs designed specifically for working with LEGO bricks, and there are a number of projects available which make use of the LDraw library for import and export of LEGO builds, available for Windows, Mac, and Linux. LeoCAD and Konstruktor are two open source implementions worth checking out, made available under the GPL version 2 and version 3, respectively.

Legofy your images to look like they're made of bricks

Ever wonder how to make a picture-perfect recreation of your favorite image with LEGO bricks? Or skip the building step altogether, and just make LEGO-style image? Legofy is here to help. Legofy is a simple program written in Python which makes use of the Imagemagick library to make a reasonable estimation of any image with LEGO bricks. It's not an exact science, and works best with simple images where a little fuzziness is okay. But it can make a pretty good approximation, as you can see with our friend tux. Legofy is made available under an MIT license.

Design the perfect combination of LEGO gears

Advanced builders make use of LEGO gears to give their models motion and interactivity. But lining up gears across bricks can be challenging: finding the right spacing between pieces, setting the right gear ratio, and figuring out which gear piece to use are at their core mathematical problems. And even if you don't feel like breaking out a calculator and recalling your advanced geometry, you can still solve LEGO gear problems quickly and easily with lego-gears, a project which tells you exactly which gear to use to make your project turn smoothly. The code is available as open source under an MIT license.

Make beats with your bricks

Are you an aspiring musician? Forget the guitar, play your LEGO bricks as an instrument! Beat Bricks is a LEGO-based sequencer. Using a 32x32 LEGO plate, you can set up your computer's webcam to "read" the beats you compose with bricks. Written in Python and released as open source under an MIT license, Beat Bricks takes your LEGO pattern and translates the input into a repeating MIDI sequence which you can adjust in real-time.

Check out the video below for a demo.

Make art with LEGO textures

While many bricks might share the same shape, it's the art printed on the plastic which sets them apart. If you've ever wanted to make use of the textures from the LEGO bricks of your youth, either to modify and create your own bricks or use them in another creation, here's the repository you've been looking for. After the author meticulously scanned and traced original LEGO pieces, saving them as SVGs, these textures are ready to be imported into Inkscape or another vector editor of your choice. Licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0, these pieces are ready to be used in your next project.

Analyze the LEGO corpus with R

There are a lot of LEGO sets out there: 6,172 to be precise, made over the past 35 years. The universe is so large, to understand them all takes some analytical snooping. Licensed under Creative Commons CC0 1.0 (public domain), this data set for the R programming language categorizes every LEGO set ever made by item number, name, year, theme, number of pieces, price, and more. Ever wonder how LEGO set prices have trended over time, or how the number of pieces per set has changed year to year? With this data set, a few quick calculations bring answers to these questions and more.

There are plenty of other amazing open source LEGO projects out there. For more, check out this curated list on GitHub of LEGO resources, and if you know of a cool project that should have been listed here, let us know in the comments below.

User profile image.
Jason was an Opensource.com staff member and Red Hatter from 2013 to 2022. This profile contains his work-related articles from that time. Other contributions can be found on his personal account.


Going to share this with my son for sure, especially the custom decals. Great post!

Great article. I shared this widely. :)

Great article, thanks.
Maybe a nice 9th Project would be ev3dev. Open Source your LEGO Mindstorms.

This is a Debian Linux-based operating system that runs on several LEGO® MINDSTORMS compatible platforms including the LEGO® MINDSTORMS EV3 and Raspberry Pi-powered BrickPi.

Just like you can take apart your LEGO® models and build something completely different, we have reversed-engineered the EV3 and created a new software platform for programming your robots.

Enjoy reading and playing!

This is my new favourite article.

Creative Commons LicenseThis work is licensed under a Creative Commons Attribution-Share Alike 4.0 International License.