The easiest way to pair your Raspberry Pi 4 with any Bluetooth-enabled device is by using the desktop version of the Raspberry Pi OS, which comes with a graphical user interface (GUI). If your board is running on the latest version, Bluetooth is already enabled by default.
Follow these steps to connect your Raspberry Pi 4 with your other Bluetooth device.
- Turn on your external Bluetooth device (e.g., speaker, headset, phone).
- Make sure the device is discoverable.
- Boot your Raspberry Pi board.
- On the home screen, click on the Bluetooth icon on the top right of the screen.
- Select “Add Device” from the drop-down menu.
- In the “Add New Device” screen, click on your external Bluetooth device.
- Select the Pair button.
- A pop-up should appear momentarily indicating that the pairing was successful. If you are paired with a Bluetooth speaker or any other audio device, you need to right-click on the speaker icon at the top of the screen and choose your audio device from the list. Otherwise, you’re good to go.
How to enable and pair Bluetooth using the command line
If you have the Raspberry Pi OS Lite that doesn’t come with a GUI, you can still use the command line to connect your Raspberry Pi 4 with an external Bluetooth device. Here’s how to do so:
- Verify that the device you want your board to connect to is powered on and discoverable.
- On the command line, type sudo bluetoothctl to enter the Bluetooth command-line tool.
- Type agent on.
- Start scanning for nearby devices by typing scan on. This will give you a list of all the discoverable external Bluetooth devices.
- Take note of the MAC address of the device you want to connect to. This is in the format of XX:XX:XX:XX:XX:XX, found in the third column of the list. If multiple external devices showed up on the list, you will usually see the name of the device next to its MAC address to help you pinpoint your device of interest.
- To pair with the device, type pair (e.g., pair 52:A8:17:6C:5G:C6).
neilgl/Raspberry Pi Forums
- To exit the Bluetooth command-line tool, type exit.
This will automatically connect you to your external Bluetooth device. However, once you disconnect from the device, you will have to reconnect by typing “connect.” To avoid typing this command every time you lose connection, you can replace “connect” with “trust.”