Bluetooth is one of the most common wireless communication protocols, and is available in almost all modern devices. In this article, we will learn about Bluetooth technology and how to use Bluetooth on a Raspberry Pi.

What is Bluetooth?

Bluetooth is a wireless technology standard that is used for short-distance communication between devices. It was developed initially as a wireless alternative to RS-232 data cables.

There are a lot of devices that are Bluetooth-capable, like mobile phones, tablets, laptops, desktop computers, headsets, and even watches. Bluetooth has become a staple in modern devices that it has become a standard feature on most devices that needs a way to send and receive data wirelessly over short distances.

How does it work?

In simple terms, Bluetooth works by splitting data into packets and sending these packets wirelessly via UHF. The Bluetooth standard uses the frequencies between 2.402 and 2.480 GHz, or 2.400 and 2.4835 GHz.

Bluetooth acts according to a master/slave architecture. One Bluetooth device acts as a master, and it can communicate with up to seven slave devices in a piconet (a small ad-hoc network). The master role of a Bluetooth device can transfer from one device to another, depending on the circumstances. For example, a Bluetooth headset can initially be a master in a network to initiate a connection with a phone. After which, it acts as a slave, and the phone acts as the master.

Bluetooth on the Raspberry Pi

Not all Raspberry Pi models have built-in Bluetooth. The table below summarizes which models have built-in Bluetooth capabilities and which don’t have them.

ModelBluetooth Version
Raspberry Pi 4 Model B5.0
Raspberry Pi 3 Model A+4.2
Raspberry Pi 3 Model B+4.2
Raspberry Pi 3 Model B4.1
Raspberry Pi 2 Model BNone
Raspberry Pi 1 Model A+None
Raspberry Pi 1 Model B+None
Raspberry Pi Zero W4.1
Raspberry Pi ZeroNone

Adding Bluetooth Capability to the Raspberry Pi

Adding a Bluetooth dongle is the easiest way if your version of Raspberry Pi doesn’t have built-in Bluetooth or your project needs a higher Bluetooth version.

Remember that not all Bluetooth dongles work with the Raspberry Pi. Please do your own research and verify first if what you are buying will work with the Raspberry Pi model you have. This Wireless Bluetooth CSR 4.0 USB Adapter Dongle is a popular choice.

We can set up and use Bluetooth with Raspberry Pi via the desktop graphical user interface (GUI) or via the command-line interface (CLI).

How to Setup Bluetooth from the Desktop

Setting up Bluetooth via desktop is the easiest way for beginners. To do this, we do the following:

  1. Click the Bluetooth icon on the taskbar.
    bluetooth-icon-on-taskbar
  2. In the sub-menu that appears, select “Add Device…
    bt-icon-add-device
  3. It will now search for discoverable Bluetooth devices available for pairing. Select the device you want to pair and click OK to confirm. You also need to confirm on the other device for the paring to be completed.
    bt-pairing
  4. After successfully pairing, both devices are now connected via Bluetooth interface.

How to Setup Bluetooth from the Command Line

  1. Open a new Terminal window.
  2. Type sudo bluetoothctl and press Enter. It will ask for your administrator password. Input it and press Enter.
  3. Type scan on and press Enter. A list of all Bluetooth device addresses will show.
  4. To pair a device, type pair [bluetooth device address].
  5. You will see the message “Pairing Successful” in the terminal window if the connection is successful.

I hope this article has given you a basic understanding of how to discover, pair, and connect Bluetooth devices in your Raspberry Pi. Please leave a comment below if you have any questions.