Physically Visualizing Lego with Lego

Scroll down to content

Lego has always been one of my favourite building materials. Growing up, I would often spend hours at a time piecing together new creations. In an information visualization course at the University of Calgary, I had the opportunity to create a dynamic physical data visualization from Lego. The visualization has the ability to show the popularity of Lego colour by year, the colours of bricks in different Lego sets, and connect to other data in the future through a simple Python script.

I was inspired by a group of simple pie charts found on Brickset Form.


Since it’s initial release, Lego parts and colours have come and gone. While a collection of simple pie chart provides a basic understanding of Lego part colour changes, I wanted to create a better representation with a wider range of data, such as part numbers, using Rebrickable’s API. An effective visualization would help understand how Lego has evolved over the years and identify specific trends within the company.

The project began by investigating Lego data sets online. I found Rebrickable has an API that provides quick and easy access to a plethora of Lego data. To better understand the data, I visually explored different data sets using Tableau. Some of the initial data assessments can be seen in the gallery below.

Next, it was time to create a more complete visualization. I spent a couple of days creating low fidelity mockups in Sketch. While I learned a lot about different approaches for visualizing Lego, none of the mockups communicated the data in an engaging enough manner.

Finally I had this crazy idea. Why not visualize Lego data with Lego?

Physical Lego Visualization Sketch
Created with Paper 53

Towers Lego bricks would be arranged in a grid, and each tower would contain bricks of a particular colour. Underneath the grid, each tower would be connected to a piston to raise or lower each tower. Using a computer, or other interface, a user would select a Lego set to visualize. After choosing the set, each piston would raise or lower, correlating on the percentage of each piece colour used in the set. While a digital version of this visualization would be difficult to read due to issues with 3D interfaces on a 2D display, a real world version would allow viewers to walk around the device and explore the data.

After discussing the idea with many experts on campus, Lego Store employees, and local inventors I decided to of forward with the design using an 8 servo Phidgets micro controller.  With only 3 weeks until the end of the semester, implementing the full 16 towers felt like an unreachable target. Next I needed a rack and pinion design to control each colour tower. I downloaded an object from Thingverse and edited the design in OpenSCAD to fit into my custom vis. Next, I began printing the parts and building the enclosure of the visualization. Fortunately, a Lego Store had a large supply of white lego bricks to build from. I purchased as many bricks as possible and spent a couple of days building.

The final step was connecting the controller to code. I used Rebrickable’s API to get current Lego Colour data and Part data. I then created a Python script to connect the data to the servos in the tower. In the video below you can see the visualization iterate through the popularity of Lego set colours by year the colours of various Lego sets.


In the future, I would like to add a better interface on the digital side of the project. Right now the code runs through a simple script with no interaction for users. While this is fine for showing off the device, code must be changed every time a user wants to explore a new Lego set. The project also does not show users an image of the set when it is visualized with the device. Comparing the set image with the Lego tower vis would provide a better understanding of what the visualization is showing. Perhaps an image could appear on a computer monitor, or be projected onto the front of the device like in the video. Finally, device could actually be used as a platform for visualizing data other than Lego. For example, a program could analyze an image and display the percentage of pixels by colour using a similar process.

Leave a Reply