Article
   Software
   Operations
   Hardware
   Cooking
Blog
   Wiredoll
   Tim
   Oskar
   Jens
   FlowersFX
   Adde
Comic
   JWW2
Blog -> Oskar

SBrick LEGO control using Xbox360 gamepads

Note: This is just an interesting hack, not meant for consumer use.

Today I got my hands on a couple of SBrick bricks for controlling LEGO Power Functions using the Bluetooth Low Energy protocol.

alt text

As I'm not a fan of touchscreen controls and the only official way to control these things are using smartphones - I spent a night to whip up a desktop app to bridge actual physical gamepads.

Requirements:

  • .NET Framework 4.5
  • Windows Runtime (tested on Windows 8.1) (for Bluetooth LE API)
  • Xbox360 Wireless Controller paired and connected
  • Vengit SBrick firmware 4.1 or later paired and connected using Bluetooth 4.0

Screenshot

As it's just a hack the app simply maps the two analogue sticks to the four motor ports on the SBrick. If you have more than one SBrick it will map up to four of them to the four Xbox360 controllers possible - enabling four-person LEGO Robot Wars with superb control.

The SBricks needs to be paired and connected using ControlPanel before the app is started. The gamepads can be connected at any time. No disconnect handling exists yet.

The resulting control I got over my LEGO Power Functions when sent over these two different wireless protocols is astonishingly stable, quick and very low-latency in nature. It's an impressive brick.

  • Firmware 4.0 support (easy)
  • Configurable axis - output mapping
  • Configurable button - output mapping

This has not been tested on any other PC and will probably not start on yours unless you're lucky ;)

> download build and source code (1 MB zip)

Developer note and credit: Xbox360 gamepads are probed using XInput with XInputDotNetPure - a great little library that is just as easy to use as the XNA Gamepad was.

by Oskar Duveborn - 18 revisions
Published 2015-07-16, updated 2015-09-25