Connecting Xbox One Controller to EV3 (EV3DEV or LEGO MicroPython) - hugbug/ev3 GitHub Wiki

This article explains how to connect Xbox One Controller to LEGO EV3 running EV3DEV firmware image. This applies to LEGO Micropython firmware image as well since it is based on EV3DEV. In fact I did this on LEGO MicroPython firmware but assume it works on native EV3DEV just as good.

Connect to the EV3 brick

From your PC start a terminal connection to the EV3 brick. Please see Connecting to Ev3dev Using SSH for details.

Configuring Bluetooth

First we need to disable Enhanced Retransmission Mode (ERTM). This is achieved by creating a text file /sys/module/bluetooth/parameters/disable_ertm containing just one character 1. This file has to be created every time the brick boots. Since we don't want to do that manually every time we can use tool sysfsutils to automate creating of the file on system boot.

Install package sysfsutils:

sudo apt-get update
sudo apt-get install sysfsutils

Update /etc/sysfs.conf with the following command:

sudo sh -c 'echo module/bluetooth/parameters/disable_ertm = 1 >> /etc/sysfs.conf'

Restart sysfsutils service:

sudo service sysfsutils restart 

Pairing and connecting

Power on the Xbox controller, then push the connect-button on the controller (the very small button on the front side, between RB and LB buttons) for two seconds. The LED on the controller should start blinking very quickly.

Using terminal connection to EV3-brick start tool bluetoothctl and issue a couple of commands:

$ bluetoothctl
[bluetooth]# power off
[bluetooth]# power on
[bluetooth]# scan on

Once the system has found the controller you get a message like:

[NEW] Device 98:7A:14:0B:0A:E4 Xbox Wireless Controller

You'll have a different ID of the device, use this ID in further commands:

[bluetooth]# trust 98:7A:14:0B:0A:E4
[bluetooth]# pair 98:7A:14:0B:0A:E4
[bluetooth]# connect 98:7A:14:0B:0A:E4

The LED on the controller should stop blinking and should now light permanently meaning the controller is connected. You can verify this on the brick. Go to "Wireless and Networks -> Bluetooth" and check that "Xbox Wireless Controller" is in the list and has a checkmark.

Now check if the controller connects on its own when it is switched on. For that test power off the controller and then power on it again. It should connect automatically and the LED should light on permanently.

And the last test: shutdown the brick, switch off the controller. Boot up the brick, switch on the controller. The connection should be established automatically.

NOTE: Do not attempt to pair the controller with EV3 using menu of the brick. That may work the first time but the controller will not connect when you switch it off and on. Use the described method with bluetoothctl instead.

Further reading

Using Xbox One Controller with MicroPython on EV3