Techno Dabbler

Trying out new technology.



November 2014

BrickPi - Raspberry Lego

by Alexandre Denault, on Toys, Linux, Lego, Robots

A few years ago, I was lucky enough to receive a Lego NXT Mindstorm kit as a gift from my wife. With it, one can build a robot using technical legos, motors and sensors. A special programmable brick is used to control the behavior of the robot. As a programmer, I was scepticale about Lego's icon-based programming language. Something like Linux and Python would be much more flexible, but flashing the NXT with an alternative firmware seemed very complicated. I jumped at the opportunity when Dexter Industry accounced their BrickPi kickstarter.

The idea is good: create a module that will use the Raspberry's GPIO interface to provide an interface between the Pi and the Mindstorm sensors and motors. The Kickstarter was sucessful and I received my BrickPi pretty much on schedule. Then came time for the experimentation.

Building Robots

The first robot built was a similar to the BrickPi Tank, although with a few more sensors. The goal was to build a robot that could build a map of a room. I regret not taking more pictures. Regardless, the first iteration of the robot could sucessfully around a room. Unfortunately, it would also get stuck very easily.

Avoiding obstacle was a lot more complicated than anticipated, as blocking objects come in two variety: lower than the sensor and higher than the sensor. If the robot can not detect the obstacle, it can not avoid it. Tracking position of the robot was also a lot more complicated than anticipated, as the motors are not precise enough to translate movement into absolute position. Not being able to track the position of the robot made it impossible to write any kind of mapping software.

Having learned that a rover robot is a lot more complicated than anticipated, I decided to scale down to something simpler, a ball shooter. The design was similar to the BrickPi ball shooter, but allowed the cannon to rotate left/right and up/down. Allowing for cannon rotation was complicated, and made the design very complicated.

Controlling the ball shooter required the addition of a USB wireless network adapter an a USB camera. Unfortunately, the Raspberry Pi could not power both the BrickPI and the USB components. This, and other complications, proved that the project was again a lot more complicated than anticipated.

BrickPi Itself

The BrickPi itself is a wonderful product. Installation is easy if you follow the instructions. Pay special attention to the prep instructions if you are a standard Raspberry Pi distro, as quite a bit of setup is needed to get the UART and GPIO working the way the BrickPi expect it. Working with the board and the Python libraries was very straighforward.

When working with the BrickPi, Sparkfun has one of the best suggestion out there : simply label the ports. Here is a good example from their website:

If you have Lego NXT hardware that you want to hook up to a Linux computer, than I highly recommend you purchase a BrickPi. If you have little experience with Linux, then this is not a product for you. Those shopping for a Mindstorm kit are encouraged in skip ahead to the EV3 Mindstorm kit, which features a controller brick already running Linux. A good article comparing the different Mindstorm kit can be found here.

Lesson Learned

It is surprising that with 15 years of experiences in the computer industry, I still make the mistake of under-estimating the scope of projects. If your project requires something like a BrickPi, it is most likely very elaborate. The next time I play with my Lego Mindstorm, I will most likely stick to something simple with the NXT brick. Maybe something like a toilet flushing robot.

comments powered by Disqus