Program LEGO Mindstorms robots over WiFi with BrickPi

Program LEGO Mindstorms robots over WiFi with BrickPi

Program LEGO Mindstorms robots over WiFi with BrickPi
Image credits : 

Don Watkins. CC BY-SA 4.0.

For the past year, I've been teaching students how to build and program robots using the LEGO Mindstorms EV3 platform. From the outset, I wanted to find a way to use Scratch and other open source programming languages to extend the capabilities of the platform. That search led me to BrickPi, a Raspberry Pi add-on board from Dexter Industries that easily interfaces with Mindstorms sensors and motors. I requested a teacher trial to see what it could do.


The US $99 base kit includes:

  • BrickPi add-on board
  • Battery pack that holds eight AA batteries
  • Acrylic case

There's also a US $179 starter kit that comes with everything above, plus:

  • Raspberry Pi 3
  • 8GB microSD card with Raspbian for Robots preloaded
  • Mini WiFi dongle
  • Power supply wall adapter
  • Ethernet cable

Getting started

I soon received a small white box in the mail. The Dexter Industries website has extremely well-produced documentation and tutorials to guide a person through every step of setup, including interfacing with the add-on board, downloading and installing Raspbian for Robots (a Raspbian image maintained by Dexter Industries), assembling the case, and booting the unit. In very little time, I had a functioning BrickPi that I was ready to begin programming.

"In very little time, I had a functioning BrickPi that I was ready to begin programming."

On first boot, I connected the BrickPi to an LCD display with an HDMI cable. There were instructions in the documentation demonstrating how to update the firmware on the unit, which I did. I then began to explore the included Scratch program, which contains the necessary extensions to interface with all the motors and sensors of my LEGO Mindstorms EV3 robot. Like the EV3 brick, the BrickPi has four motor ports and four sensor ports. I made a small platform for the BrickPi to rest on top of my robot and fit the included battery pack, which supplies the power for the unit, underneath.

Programming the robot

As I explored the documentation, I learned I could interact with the robot and the program using VNC, which is a real boon. I learned from the documentation that I only needed to point my browser to the IP address of my BrickPi and would be presented with a link to the VNC software. Once I entered the default password for the devices (robots1234), I was ready to program the robot. Dexter Industries provides a number of programming examples along with extremely adequate additional documentation to help the new user to learn the Scratch-specific language necessary to program the robot.

You can see from looking at the desktop of the BrickPi that it is a typical Raspberry Pi graphical user interface.

In no time I had logged into the BrickPi with VNC and was programming the motors and sensors. Controlling the motors is very easy with the "broadcast" programming block. In the example below, I have entered MA 30 ON, which tells the large motor on port A to turn ON at 30%.

I also could have entered "MotorA 30% ON." The syntax is quite forgiving, and that makes it easier for teachers and students who are new to programming. I used the education edition LEGO Mindstorms kit, but BrickPi supports all Mindstorms motors and sensors. The video tutorial below demonstrates the ease of programming the BrickPi.

Additional resources

Dexter Industries provides a forum for users to ask questions and share code and ideas. Raspbian for Robots is open source and is available on GitHub with an MIT License.

Thank you to Dexter Industries for providing me with an evaluation kit. Using BrickPi is a great way to extend a LEGO Mindstorms EV3 while at the same time introducing students to Raspberry Pi and open source programming languages.

Comment now