Configuring Bluetooth

User can choose the device with Bluetooth version, and the Bluetooth function is enabled by default, You need to finish related configurations such as adding devices, scanning devices and device pairing before using Bluetooth.

Raspberry Pi OS(Desktop)

In the Desktop version of the operating system, you can use the desktop icon to configure Bluetooth.

Steps:

  1. Left-click the icon image in the upper right corner of the desktop and select “Add Device” in the pop-up menu.
image-20240603165721892
  1. In the pop-up "Add New Device" pane, view the scanned Bluetooth devices. Then you can select a Bluetooth device, and click “Pair” to start pairing.
image-20240603165740253
  1. Select “OK” in the pop-up prompt box to confirm the pairing request.
image-20240603165759990

TIP

You need confirm the pairing request on connected Bluetooth device, otherwise the pairing will fail.

  1. After successful Bluetooth pairing, click “OK” in the pop-up prompt to close the page.
  2. Left-click the icon image in the upper right corner of the desktop to view the connected Bluetooth device.
image-20240603165909680

Raspberry Pi OS(Lite)

In the Lite version of the operating system, you can use the command line to configure Bluetooth.

Basic Configuration Command

CommandFunction Description
bluetoothctl scan onEnable Bluetooth scanning
bluetoothctl scan offDisable Bluetooth scanning
bluetoothctl discoverable onEnable Bluetooth discovery (which can be discovered by the other party)
bluetoothctl discoverable offDisable Bluetooth discovery
bluetoothctl trust *device_MAC*Trust device
bluetoothctl connect *device_MAC*Connect device
bluetoothctl disconnect *device_MAC*Disconnect device

Configuration Example

This chapter introduces how to configure Bluetooth through a configuration example.

Preparation:

The Bluetooth to be paired has been enabled and its name has been determined.

Steps:

  1. Enter the Bluetooth view.
sudo bluetoothctl
  1. Enable bluetooth.
power on
  1. Scan Bluetooth device.
scan on

​Returned display information: ​Discovery started ​[CHG] Controller B8:27:EB:85:04:8B Discovering: yes ​[NEW] Device 4A:39:CF:30:B3:11 4A-39-CF-30-B3-11

  1. Find the name of the turned-on Bluetooth device.
devices

​Returned display information: ​Device 6A:7F:60:69:8B:79 6A-7F-60-69-8B-79 ​Device 67:64:5A:A3:2C:A2 67-64-5A-A3-2C-A2 ​Device 56:6A:59:B0:1C:D1 Lefun ​Device 34:12:F9:91:FF:68 test

  1. Pairing target devices.
pair 34:12:F9:91:FF:68

34:12:F9:91:FF:68 is target device’s device_MAC

​Returned display information: ​Attempting to pair with 34:12:F9:91:FF:68 ​[CHG] Device 34:12:F9:91:FF:68 ServicesResolved: yes ​[CHG] Device 34:12:F9:91:FF:68 Paired: yes ​Pairing successful Pairing successful

TIP

The Bluetooth device to be connected also needs to confirm the pairing request, otherwise the pairing will fail.

  1. Add as trusted device.
trust 34:12:F9:91:FF:68

34:12:F9:91:FF:68 is target device’s device_MAC

​Returned display information: ​[CHG] Device 34:12:F9:91:FF:68 Trusted: yes ​Changing 34:12:F9:91:FF:68 trust succeeded