Getting Started

LEGO BattleBots… It’s robot fightin’ time!

My son is approaching the end of 5th grade, and he started participating in FIRST Lego League (FLL) this year. Like many over-eager parents we bought him a Mindstorms EV3 kit because there is no faster way to separate parents from their money than a child who exhibits the slightest interest in something. But while there are many very positive aspects to FLL (problem solving, teamwork, etc.), the bots and tasks they build are kind of, well… boring. 

We’re also big fans of BattleBots (Faruq is the man!). Some time ago I had the idea that he and I could each build LEGO Mindstorms robots for battle. Then, we could go head to head and have lots of family-friendly fun destroying each others’ robots (then rebuild them and repeat).

You’d think that LEGO, with its Mindstorms kits (and associated accessories), would be all over this, but it turns out that it’s much more difficult to set up a workable, reasonably performing remote control for Mindstorms bots than it sounds.

Yes, the EV3 comes with an infrared remote, but it’s basically useless for this setting. It can only control two motors at a time, so you have to flip a switch to mode-switch to control additional motors. Plus, you need to keep it pointed at your robot, which is not always easy in the heat of battle. We tried this for about a minute and realized that it wasn’t workable. And don’t get me started on the EV3 mobile app… what a piece of hot garbage. Plus, anyone will tell you a multitouch screen is not a good game controller.

We started with the one LEGO Mindstroms EV3 basic kit as well as an ancient Mindstorms NXT kit I had from long ago. Here’s the list of our desired features and constraints going into this project:

  • Real-time, wireless, responsive remote control of each robot (movement and any additional features, e.g., weapons)
  • A game system-like controller (with thumbsticks or at least a D-pad, plus buttons)
  • Limited computer intervention (I’d initially hoped that we could do this with built-in software, the iOS apps, or if needed, a Mac)
  • A major constraint was that I wanted to do this with official LEGO firmware.
    • I didn’t want to mess around with other development firmware to maintain compatibility with LEGO apps and any prior Mindstorms programs.

Naively, I thought there might be an off-the-shelf solution that would “just work” (and I was willing to spend some money for this) or require minimal hacking. And that there might even be one solution that would work for both the NXT (old) and EV3 (current) systems. At the minimum, I figured there would be numerous detailed guides and examples out there on the interwebs describing how to do this… Turns out, none of those are true; no off-the shelf solution, nothing that works for both NXT and EV3, and only a few, largely outdated guides detailing how to make something like this work that (in true internet fashion) relied on quite a bit of prior/external knowledge.

So here I’ve tried to collect all the necessary information and processes together here in a way that works (as of June 2019). This is not a zero cost solution… I had to spend some money to buy the right game controllers and even an EV3 WiFi network adapter. But as of now, we have two LEGO bots (EV3 and NXT), each controllable using a PlayStation 3 (PS3) DualShock “six axis”-style controller via Bluetooth. This setup also requires a computer, in my case a MacBook Pro (running the latest version of macOS 10.14 “Mojave”), which will be the primary platform for our software tools. 

  • 1 Lego Mindstroms EV3 basic kit
  • 1 ancient Lego Mindstorms NXT kit
  • 1 Netgear WiFi USB dongle
    • Yes, this specific model is needed to easily enable local network connections on the EV3.
  • 2 PS3 DualShock 3 Wireless controllers
    • One (for NXT) can be a generic knockoff, but at least one (for EV3) should be an authentic PS3 controller
    • A mini-USB cable to connect the controllers to your computer (and potentially to charge them)
  • 1 macOS computer running macOS 10.14 Mojave
    • Plus, a little familiarity with the macOS Terminal, the Unix command-line, and common open source software package managers:
      • Anaconda (Python / pip)
      • Homebrew (see below)

Setting up Homebrew

Setting up either an NXT or EV3 bot for remote control will require some additional software, most easily installed via Homebrew (the “missing package manager for macOS”), which is pretty much the standard way to access tons of open source software and tools for macOS. At that link, you’ll find information and simple instructions to install Homebrew (brew, for short). Working with brew requires some familiarity with the macOS Terminal app (located in your computer’s /Applications/Utilities/ folder), or at least a willingness to type commands very precisely and wait for things to happen (sometimes without any indication of progress). Installation boils down to precisely typing (or better yet, copying and pasting) the following into your Terminal prompt.

In our examples throughout this site, we use $ to denote the command-line prompt (it’s usually something longer, like computer_name: username $). The commands to type are those that follow the prompt (type everything after the $).

$ /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

This will take a while (it needs to download a bunch of stuff and then compile and install quite a lot of code). But once it’s done, you can install many open source packages quite easily.

Next Steps

Apologies in advance… things are going to get a bit complicated, often requiring multiple steps. Below, I’ve tried to split things into multiple, non-redundant, pieces:

There are probably easier ways to do this, but as far as I know, none of them are super easy. I really wish LEGO would just do the following:

  1. Enable a modern Bluetooth HID stack on Mindstorms bricks that would connect to common game controllers.
  2. Add ways (on the brick itself or via the iOS app) to easily map game controller input to motor controls.

Then people could just focus on the most important part: building awesome robots and smashing each other to bits!  Until then, I hope the methods and procedures detailed on this site help some of you out there enjoy busting up each others’ robots. 😀