In this tutorial, we will discuss how you can set up Bluetooth on your Raspberry Pi device.
How to Setup Bluetooth on a Raspberry Pi?
There are two methods to set up Bluetooth on Raspberry Pi, which are:
We will see each of these in detail.
Method 1: Setup Bluetooth Through GUI
The GUI method is the simplest method to set up Bluetooth on Raspberry Pi and you do it using the following steps:
Step 1: Click on the Bluetooth icon on the right of the screen after which a drop-down list will appear on the screen. Choose Add Device option from the list:
Step 2: All the available devices will appear on the screen. From the list choose the device you want to pair with:
Note: In the image below two available Bluetooth devices are shown, your available devices could be less or more in number.
Step 3: Select the desired device and click on the Pair option to pair the device with Raspberry Pi.
Step 4: A code along with the pairing request will be sent to the device you want to pair with and a same request will appear on your Raspberry Pi desktop as well. Click on the OK button to accept pairing.
Wait for the response from the other device too.
The code that will be sent to the device will look something like this. The user of the device should click on Pair too to allow to connect to the Raspberry Pi:
Step 5: When the devices get paired a pairing successful prompt will appear on the screen, click OK here:
And that’s all the Raspberry Pi paired to your device which means Bluetooth connection has been set up successfully between the devices.
Method 2: Setup Bluetooth Through Terminal
The second method to set up Bluetooth is the terminal method. If you are accessing Raspberry Pi through an SSH connection or using Raspberry Pi lite OS, this method will be more feasible for you. Just follow the below-mentioned steps to successfully set up the Bluetooth connection.
Step 1: Use the below-mentioned command to run Bluetooth agent:
Step 2: Then use the below-mentioned command to scan the available Bluetooth devices, make sure the Bluetooth of the device you want to pair with Raspberry Pi is turned on:
The output will display the available device along with their device address:
Here, I want to connect with DESKTOP-FS29SFK.
Step 3: Now use the pair command along with the device address to connect the device using Bluetooth.
It will ask for a permission to connect, type Yes here to allow:
At the same time a notification will be sent to the other device as a pairing request, click Yes from that device to pair successfully:
Step 4: After accepting the pairing request on the terminal and from the other device, the connection successful dialogue box will appear on the screen to inform that the devices are paired successfully; click OK here:
And that’s all the Bluetooth connection between the two devices has been set up successfully.
Note: The Bluetooth device could be your mobile phone, speakers, keyboard, mouse, or game controller. All devices can easily be set up through the above methods.
Conclusion
You can set up Bluetooth on Raspberry Pi through GUI and terminal. For GUI, the users just have to click on the Bluetooth icon on the right of the screen then add the desired device and connect to it. For the terminal, use the bluetoothctl command to register the agent. Then with the scan on command, scan the available devices. Afterward, you can use the device address along with the pair command to connect it with Raspberry through Bluetooth.