Pairing a Bluetooth controller to the Raspberry Pi #138
stephane-caron
started this conversation in
Tips and tricks
Replies: 1 comment
-
TroubleshootingIf the connection fails with errors that look like this: [bluetooth]# connect AC:FD:93:FD:68:0F
Attempting to connect to AC:FD:93:FD:68:0F
[CHG] Device AC:FD:93:FD:68:0F Connected: yes
Failed to connect: org.bluez.Error.Failed
[CHG] Device AC:FD:93:FD:68:0F Connected: no Check out for the following error messages in Apr 12 23:33:25 raspi bluetoothd[471]: Can't get HIDP connection info
Apr 12 23:33:26 raspi bluetoothd[471]: connect error: Invalid exchange (52) What worked in this case is to unpair first: [bluetooth]# paired-devices
Device AC:FD:93:FD:68:0F Wireless Controller
[bluetooth]# remove AC:FD:93:FD:68:0F
[DEL] Device AC:FD:93:FD:68:0F Wireless Controller Then connect again: [bluetooth]# scan on
Discovery started
[CHG] Controller DC:A6:32:D6:AA:D7 Discovering: yes
...
[NEW] Device AC:FD:93:FD:68:0F Wireless Controller
[bluetooth]# connect AC:FD:93:FD:68:0F
Attempting to connect to AC:FD:93:FD:68:0F
[CHG] Device AC:FD:93:FD:68:0F Connected: yes
[CHG] Device AC:FD:93:FD:68:0F UUIDs: 00001124-0000-1000-8000-00805f9b34fb
[CHG] Device AC:FD:93:FD:68:0F UUIDs: 00001200-0000-1000-8000-00805f9b34fb
[CHG] Device AC:FD:93:FD:68:0F ServicesResolved: yes
[CHG] Device 76:63:59:CE:8E:69 RSSI: -90
[CHG] Device AC:FD:93:FD:68:0F Paired: yes
[CHG] Device FA:0D:AC:BF:8E:C9 RSSI: -97
Connection successful |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
This is not specific to Upkie, but these instructions can come in handy to pair e.g. a PS4 controller to control the robot. Start with:
sudo bluetoothctl
Enable the Bluetooth agent:
Then start scanning for devices. The terminal should start listing scan results with all the Bluetooth devices around you, so keep a sharp eye on the output as we need to find the controller:
scan on
While the command tool is scanning, press and hold both your Share and PS buttons on your controller. Keep holding the buttons at the same time until your controller starts flashing light (fast burst followed by long pauses, not the regular flashing indicating that the controller is looking for a known device to pair to).
Remember, the command tool is still scanning and your controller just entered pairing mode, so you should very soon see a new record on your terminal showing the MAC address of the controller. For instance:
[NEW] Device AC:FD:93:14:25:D3 Wireless Controller
Check that the controller is still flashing and do:
connect CONTROLLER_MAC_ADDRESS
And we are done 😃 If everything went well you should see a connection successful message appear on your terminal like so
Finally, trust the controller so that it can reconnect after a reboot of the Raspberry Pi:
[bluetooth]# trust AC:FD:93:FD:68:0F
These instructions are adapted from Connecting PS4 controller to Raspberry Pi via Bluetooth.
Beta Was this translation helpful? Give feedback.
All reactions