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:
- Left-click the icon in the upper right corner of the desktop and select “Add Device” in the pop-up menu.
- 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.
- Select “OK” in the pop-up prompt box to confirm the pairing request.
TIP
You need confirm the pairing request on connected Bluetooth device, otherwise the pairing will fail.
- After successful Bluetooth pairing, click “OK” in the pop-up prompt to close the page.
- Left-click the icon in the upper right corner of the desktop to view the connected Bluetooth device.
Raspberry Pi OS(Lite)
In the Lite version of the operating system, you can use the command line to configure Bluetooth.
Basic Configuration Command
Command | Function Description |
---|---|
bluetoothctl scan on | Enable Bluetooth scanning |
bluetoothctl scan off | Disable Bluetooth scanning |
bluetoothctl discoverable on | Enable Bluetooth discovery (which can be discovered by the other party) |
bluetoothctl discoverable off | Disable 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:
- Enter the Bluetooth view.
sudo bluetoothctl
- Enable bluetooth.
power on
- 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
- 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
- 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.
- 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