Bluetooth is a wireless technology that allows two devices to communicate with each other over short distances. It is a popular technology for connecting devices such as headphones, keyboards, and mice to computers, tablets, and smartphones. The Raspberry Pi is a small, affordable computer that can be used for a variety of projects. It also has built-in Bluetooth capabilities, making it easy to connect to other Bluetooth devices. In this guide, we’ll show you how to use Bluetooth on Raspberry Pi with both the graphical user interface (GUI) and the command line.
Using Bluetooth on Raspberry Pi with the GUI
1. Open the Raspberry Pi Configuration window by clicking the Raspberry icon in the top-left corner of the desktop.
2. Select “Interfaces” from the list of options.
3. Enable the “Bluetooth” option.
4. Click “OK” to save your changes.
5. Open the Bluetooth Manager window by clicking the Bluetooth icon in the top-right corner of the desktop.
6. Select “Add Device” from the list of options.
7. Select the device you want to connect to and click “Connect”.
8. Enter the passkey (if required) and click “OK”.
9. The device should now be connected.
Using Bluetooth on Raspberry Pi with the Command Line
1. Open a terminal window by clicking the Terminal icon in the top-left corner of the desktop.
2. Type the following command to enable the Bluetooth adapter:
sudo hciconfig hci0 up
3. Type the following command to start the Bluetooth daemon:
sudo service bluetooth start
4. Type the following command to scan for nearby Bluetooth devices:
sudo hcitool scan
5. Note the address of the device you want to connect to.
6. Type the following command to pair with the device:
sudo bluez-simple-agent hci0
7. Enter the passkey (if required) and press “Enter”.
8. The device should now be connected.
Conclusion
Using Bluetooth on Raspberry Pi is a great way to connect to other devices wirelessly. With the graphical user interface (GUI) and the command line, it’s easy to set up and use Bluetooth on Raspberry Pi.
More and more devices can be used with Bluetooth, and interestingly, it’s not that complicated to use these Bluetooth devices with a Raspberry Pi (even without a desktop environment). So, if you have a Bluetooth mouse or speaker you’d like to use with your Pi, keep reading, and I’ll show you everything.
On Raspberry Pi OS with Desktop, there is a tool to configure Bluetooth devices in the top-right corner, and most distributions have similar options. From a terminal, the tool “bluetoothctl” can be used to scan, pair and configure Bluetooth devices in command lines.
Let’s start with a desktop environment, using the tool on Raspberry Pi OS with Desktop, and I’ll then give you the commands to do it from a terminal (or Lite edition). I’ll finish with a few examples of devices you can use to improve your Pi experience.
If you’re looking to quickly progress on Raspberry Pi, you can check out my e-book here. It’s a 30-day challenge where you learn one new thing every day until you become a Raspberry Pi expert. The first third of the book teaches you the basics, but the following chapters include projects you can try on your own.
Set up Bluetooth with the GUI
If you use the default Raspberry Pi OS environment (PiXeL), there is a Bluetooth icon in the top-right corner, near the clock, that can be used to enable or disable the Bluetooth adapter and pair new devices.
Turn on Bluetooth
By default, Bluetooth is enabled on a fresh installation of Raspberry Pi OS with Desktop, so you can probably skip this step.
But if for any reason the Bluetooth is disabled on your Pi (grayed icon), click on it and select “Turn On Bluetooth” in the dropdown menu. It looks like this:
The Bluetooth is now enabled, and you can move on to detecting your Bluetooth devices.
Pair a new device
The Raspberry Pi will only detect Bluetooth devices in pairing mode. Refer to your device’s user guide to learn how to do this. Generally, there is a Bluetooth button on it that you need to press once or for a few seconds to make it discoverable.
Also, some devices can’t be paired to more than one device, so you may need to disconnect it from your other computer, for example. As it’s different with all accessories, it’s better to check the official documentation.
- Click on the Bluetooth icon in the top-right corner.
- Click on “Add device…”
- The Raspberry Pi will start listing all of the detected devices in a window. It should look like this:
- Click on the one you want to associate, then click “Pair”.
- A few seconds later, you’ll get a confirmation message that the pairing was successful:
Once the device is connected, there might be additional steps to configure it. This will depend on the type of device. I’ll give you more details at the end of this article (Bluetooth usage examples).
For example, a mouse or keyboard should work directly, while a speaker or phone will require additional configuration steps.
Unpair a connected device
Once a device is paired with the Raspberry Pi, it will be listed in the dropdown menu when you click on the Bluetooth icon. You can find at least two actions in this menu: disconnect (remove temporarily) and remove (forget this device, unpair completely).
Set up Bluetooth using the terminal
Whether you use SSH, a server distribution without GUI or want to do the same thing from a terminal, it’s possible.
In command lines, the main tool to use is “bluetoothctl”. It opens a different prompt, where you can type specific actions to manage everything related to your Bluetooth adapter and devices.
Turn on Bluetooth in the command lines
Even on Raspberry Pi OS Lite, Bluetooth is enabled by default on a fresh installation. I’ll give you the instructions just in case you use another distribution or disabled it previously, but in theory, you won’t have to do this:
- Start the main tool with:
bluetoothctl
- Enable Bluetooth:
power on
- And to close the tool:
exit
You’ll most likely continue with the pairing procedure first, but at least you know how to quit :-).
That’s it, Bluetooth is enabled (even if it was already on your system), and you can move to the next step.
Pair a new Bluetooth device from the terminal
Theory
The procedure has almost the same steps as with a GUI:
- Put the device in pairing mode.
- Search for devices.
- Pair with the one you want to associate it with.
- Connect to it if you want to use it directly.
This step is automatic with a GUI, but there is an extra command in a terminal.
As mentioned earlier, we’ll do everything with “bluetoothctl”.
There are many commands you can use, but luckily they are pretty intuitive (with logical names and not that many options).
Here are the most important ones to know:
- power on – Turns on Bluetooth.
- power off – Turns off Bluetooth.
- scan on – Starts scanning for Bluetooth devices.
- scan off – Stops scanning for Bluetooth devices.
- pair <address> – Pairs with a Bluetooth device.
- remove <address> – Unpair a Bluetooth device.
- connect <address> – Connects to a Bluetooth device.
- disconnect <address> – Disconnects from a Bluetooth device.
- devices – List paired devices.
Use help to see all the options available, but these should be enough in most cases.
Example
Let’s take a concrete example. I have a Bluetooth keyboard I want to associate with Raspberry Pi OS Lite (I’m doing this via SSH for my comfort, but it doesn’t change anything).
Here are the main steps to pair a keyboard to Raspberry Pi OS Lite:
That’s it, my keyboard works directly and I didn’t have any extra steps to configure it. But as mentioned for the GUI procedure, depending on the type of device, additional configuration might be required (change the default audio output for example).
Want to chat with other Raspberry Pi enthusiasts? Join the community, share your current projects and ask for help directly in the forums.
Bluetooth usage examples on Raspberry Pi
You now know how to pair any Bluetooth device with your Raspberry Pi, here are a few ideas on how you can use Bluetooth devices to improve your experience with your Pi.
Audio
I’m a bit picky about sound quality, and I can’t bear the sound from the monitor’s speakers when I listen to music, so I don’t use the HDMI output for sound. You can plug fancy speakers into the Jack port, but I generally find using Bluetooth speakers is the easiest way.
I tried it with two of my Bluetooth speakers, and it worked pretty well, so I recommend testing it, especially if you use your Pi for desktop usage, media center or as a Spotify player.
There is an extra step after pairing the speaker, you need to click on the sound icon and choose the new device in the dropdown menu, it looks like this:
You can then go to “Device Profiles” to adjust the settings if needed (volume, etc.), but it isn’t mandatory.
If you don’t have a GUI, it’s the same thing, but remember that some dependencies may be required (ex: audio packages to use a Bluetooth speaker).
Mouse/keyboard
Another great way to take advantage of the Bluetooth feature is to use a wireless mouse and keyboard with your Raspberry Pi. In my comparisons of the main keyboards for Raspberry Pi, I had a great one that works via USB or Bluetooth (so you can still do the installation with the cable).
I tested it for this article, and it worked directly, just press the Bluetooth button and follow the instructions given above.
If needed, you can then go to “Preferences” > “Mouse & keyboard settings” to configure advanced options (mouse speed, for example).
Game controller
If you are into retro-gaming and play Retropie on your Raspberry Pi, keep in mind that it’s definitely possible to use a wireless controller with it, even in Bluetooth (like the PS4 controllers).
I have several tutorials about this on this website, I’ll let you check them for more detail if you are interested:
Connect to the Pi from another computer
Side note: If for any reason you need to connect to your Raspberry Pi from another device, you need to make it discoverable first. And you’ll probably have to use a PIN code to confirm the connection.discoverable on
You also have the option from the desktop interface (“Make discoverable” in the dropdown menu when you click the Bluetooth icon).
I connected it to my laptop, but I didn’t have much success in terms of applications I could use with this connection, so I don’t know how useful this can be (I guess you should be able to transfer files, but it didn’t work for me).
Additional Resources
Not sure where to start?
Understand everything about the Raspberry Pi, stop searching for help all the time, and finally enjoy completing your projects.
Watch the Raspberry Pi Bootcamp course now.
Master your Raspberry Pi in 30 days
Don’t want the basic stuff only? If you are looking for the best tips to become an expert on Raspberry Pi, this book is for you. Learn useful Linux skills and practice multiple projects with step-by-step guides.
Download the e-book.
VIP Community
If you just want to hang out with me and other Raspberry Pi fans, you can also join the community. I share exclusive tutorials and behind-the-scenes content there. Premium members can also visit the website without ads.
More details here.
Need help building something with Python?
Create, understand, and improve any Python script for your Raspberry Pi.
Learn the essentials step-by-step without losing time understanding useless concepts.
Get the e-book now.
You can also find all my recommendations for tools and hardware on this page.
How to Use Bluetooth on Raspberry Pi: GUI & Command Guide
Bluetooth is a wireless technology that allows two devices to communicate with each other. It is a popular technology for connecting devices to the internet, and it is also used for connecting devices to each other. The Raspberry Pi is a small computer that can be used to control a variety of devices, and it can also be used to connect to Bluetooth devices. In this guide, we will show you how to use Bluetooth on Raspberry Pi, both through the graphical user interface (GUI) and through the command line.
Using Bluetooth on Raspberry Pi with the GUI
The Raspberry Pi has a graphical user interface (GUI) that can be used to control the Bluetooth settings. To access the Bluetooth settings, open the main menu and select “Preferences”. Then select “Bluetooth Manager”. This will open the Bluetooth Manager window.
In the Bluetooth Manager window, you can see a list of available Bluetooth devices. To connect to a device, select it from the list and click the “Connect” button. You may be asked to enter a PIN code to complete the connection. Once the connection is established, you can use the device with your Raspberry Pi.
Using Bluetooth on Raspberry Pi with the Command Line
The Raspberry Pi can also be used to control Bluetooth devices through the command line. To access the command line, open a terminal window. Then type the following command to list all available Bluetooth devices:
hcitool scan
This will list all available Bluetooth devices. To connect to a device, type the following command, replacing “XX:XX:XX:XX:XX:XX” with the address of the device you want to connect to:
sudo bluez-simple-agent XX:XX:XX:XX:XX:XX
You may be asked to enter a PIN code to complete the connection. Once the connection is established, you can use the device with your Raspberry Pi.
Conclusion
In this guide, we have shown you how to use Bluetooth on Raspberry Pi, both through the graphical user interface (GUI) and through the command line. With the GUI, you can easily connect to Bluetooth devices, while the command line allows you to control Bluetooth devices with more precision. We hope you have found this guide helpful.