The newest device from the Raspberry Pi Foundation, Raspberry Pi 3 Model B, comes with both built-in Wi-Fi and Bluetooth 4.1. Like with most things Raspberry Pi, it doesn't come working out of the box, though. Even after you install NOOBS or Raspbian, you still have to do some work to get Bluetooth up and running.
Fortunately, it's not very difficult or time consuming, but it will take minimal knowledge of the console (Terminal). Here's how it's done.
(If you don't yet have one yet, back up and read why.)
First, why would you even need Bluetooth on Raspberry Pi?
By default, it can't be used for audio. The Raspberry Pi is set to use either HDMI or 3.5mm output for audio. In order to get Bluetooth audio working, you will need to do a considerable amount of additional work.
Namely, the biggest reason for using Bluetooth is to free up ports on the board. Out of the box, you will need a wired mouse and keyboard, or wireless peripherals with dongles that plug into the USB ports. This means that right out of the gate, you're taking up two out of your four precious USB ports that you'd probably rather be using for USB drives or other important peripherals.
Bluetooth also gives you some additional range. A lot of people like to use the Raspberry Pi as a media hub, which means they're sitting on the couch, across the room from the TV, where their Raspberry Pi is plugged in. You no longer need to stretch a cable across the room to control your media hub (or deal with finicky Bluetooth adapter dongles).
Additionally, you might want to quickly transfer files between your Pi and other devices. Bluetooth will work for this case, but only for transferring files from the Raspberry Pi to another device, unless you go through the effort of setting up an OPP Server.
The quickest way to get your Bluetooth devices paired to your Raspberry Pi is through Terminal.
- From the Raspberry Pi desktop, open a new Terminal window.
- Type sudo bluetoothctl then press enter and input the administrator password (the default password is raspberry).
- Next, enter agent on and press enter. Then type default-agent and press enter.
- Type scan on and press enter one more time. The unique addresses of all the Bluetooth devices around the Raspberry Pi will appear and look something like an alphanumeric XX:XX:XX:XX:XX:XX. If you make the device you want to pair discoverable (or put it into pairing mode), the device nickname may appear to the right of the address. If not, you will have to do a little trial and error or waiting to find the correct device.
- To pair the device, type pair [device Bluetooth address]. The command will look something like pair XX:XX:XX:XX:XX:XX.
If you're pairing a keyboard, you will need to enter a six-digit string of numbers. You will see that the device has been paired, but it may not have connected. To connect the device, type connect XX:XX:XX:XX:XX:XX.
Now you can toss that ancient wired keyboard in the junk drawer of your desk until you reflash your Raspberry Pi tomorrow.
When it comes to Bluetooth, I've had a lot more success with the Terminal commands. However, having a graphical user interface for Bluetooth settings is certainly very helpful in various situations.
By default, there is no graphical settings menu for Bluetooth. Here's what you'll need to do to install it.
- Open Terminal and type sudo apt-get install bluetooth bluez blueman. Press enter.
- Once the packages have downloaded and installed, type sudo reboot.
- To access this menu, on the Raspberry Pi desktop click Menu, located in the upper left corner of the screen, scroll down to Preferences with your cursor and click Bluetooth Manager. From there, you can pair to any nearby devices, or you can make your Raspberry Pi discoverable so you can pair your phone to it from your phone's Bluetooth settings.
Pairing devices like my Android smartphone or other non-keyboard devices has worked quite well using this method. However, pairing a keyboard fails while entering the six-digit passcode. That said, if you use the Terminal commands to pair the keyboard, you can easily connect it later using the graphical Bluetooth menu just fine.