Building Rasp Pi into Mindstorms projects with BrickPi

Lead Image © sahua,


BrickPi lets you build a Raspberry Pi into your Lego Mindstorms projects – you can even connect your Pi to Mindstorms sensors and motors.

It would be a mistake to dismiss Mindstorms as a child's toy just because it is made by Lego. When he was in college, Google co-founder Larry Page built a functioning ink jet printer out of Mindstorms parts and related accessories. All over the world, tinkerers are expanding the capabilities of Lego robots by hooking several Lego NXT control modules together or connecting them to a PC via Bluetooth to access PC storage space. A doctoral student from London has even combined Mindstorms elements with other modules and other components produced by a 3D printer to make a functioning atomic microscope.

Lego published the first version of Mindstorms in 1998. At that time, the only goal envisioned for the product was to better acquaint young people with the subject of robotics. However, the system quickly became so popular that the manufacturers began to include it in their general product line. These build-it-yourself robots have now become a part of the curriculum at many universities.

The benefit of Mindstorms is in the hardware. Even in the absence of extensive background knowledge, a user can experience success simply by plugging the parts together. Mindstorms parts from the Lego Technic and Lego System series aren't the large blocks you remember from preschool. In addition to the blocks and moving parts, servo motors and numerous sensors deal with sound, color, ultrasound, touch, and temperature. The goal is to dock all of these components onto other building blocks and connect them via cable to the socket of a large, central control module that makes CPU, memory, and interfaces available.

From 2006 to 2013, the NXT module was Lego's control module for Mindstorms robots. The technology for NXT is getting a bit long in the tooth, but it nonetheless enjoys a wide distribution. The successor to NXT is called EV3, and it appeared in September 2013. I will discuss EV3 at the end of this article.

The BrickPi lets you use the Raspberry Pi as something similar to the NXT module – a central processor that attaches to Mindstorms bricks and controls motors, sensors, and other programmable components.

Rasp Pi as a Brain

The BrickPi lets you mount your Raspberry Pi directly onto your Mindstorms robot creations. In addition to providing a space for the Pi itself, BrickPi offers a power supply for the Pi. You can attach up to five NXT sensors and up to four NXT or EV3 motors. And, Lego Technics bricks attach easily to the BrickPi case.

The Rasp Pi has considerably more computing capacity, RAM, and disk space than Lego's own NXT module. Additionally, you can log in to the Pi via WiFi and integrate arbitrary software packages and libraries offered by Raspbian or another Pi distro.

According to the American manufacturer of BrickPi, Dexter Industries [1], European users can order the BrickPi via the French online shop Génération Robots [2].

The delivery set (Figure 1) contains two acrylic disks, one circuit board that is based on Arduino with connectors for sensors and motors, and various screws and battery cables. The Raspberry Pi, which you will also need, is not part of the delivery package. You'll need a Revision 2 Raspberry Pi board, because Rev 2 is the only one that has two drill holes, which you will need to screw the mini computer onto the acrylic disks that belong underneath.

Figure 1: The BrickPi comes disassembled.

Mounting the Arduino circuit board is not complicated. All you need to do is plug it into the GPIO port on top of the Rasp Pi like a shield. Although the fit is a bit crooked, tests have shown that there are no stability problems. The finishing step is to screw in the second acrylic disk to function as the top part of the housing. As you can see from the finished block (Figure 2), the disks have holes that are Mindstorms compatible.

Figure 2: The assembled building block. At the bottom is a Pi and at the top is an Arduino.

Software Setup

The BrickPi needs a specially adapted version of Raspbian as an operating system. You can make the necessary adaptations [3] yourself; however, the Dexter Industries website provides a link to an appropriately prepared image file.

A word of caution is in order. The image specifies as the network, and, for the Rasp Pi, it assigns a static IP address of To modify this address, you need to briefly plug the monitor and keyboard into the mini computer. Then, you can change the IP addresses with the text editor in the /etc/network/interfaces and /etc/resolv.conf files. At the same time, you can enter the SSID and password for your WiFi network into /etc/network/interfaces.

After you power down, remove all of the cables. You can then attach a battery to the top circuit board of the BrickPi building block to serve as the power supply. To create access to the wireless network for this block, just plug a mini WiFi stick into the USB port of the Rasp Pi. The BrickPi has now become a central brain you can build into any robot. (Make sure you leave room in your additional Mindstorms projects for a case that can carry the battery.)

The BrickPi homepage offers instructions for several example projects, including a gripper arm with a joint, as well as a small car. I tested the instructions for building portions of the car.

Two servo motors control the front wheels, as shown in Figure 3. In the back is a smaller wheel, as shown in Figure 4, that pivots as the car is steered. Additionally, the robot carries an ultrasound sensor on the front so that it can recognize obstacles and introduce evasive maneuvers by means of programmed actions.

Figure 3: The BrickPi can autonomously control a car …
Figure 4: … that can identify obstacles with an ultrasound sensor attached to the front.

Buy this article as PDF

Express-Checkout as PDF

Pages: 4

Price $2.95
(incl. VAT)

Buy Raspberry Pi Geek

Get it on Google Play

US / Canada

Get it on Google Play

UK / Australia

Related content