Home / Tutorials / Raspberry Pi Tutorial / Setting Up Raspberry Pi Zero Bluetooth
Raspberry Pi Zero Bluetooth

Setting Up Raspberry Pi Zero Bluetooth

The Raspberry Pi Zero W comes with both WiFi and Bluetooth connectivity. I have already covered how to turn on WiFi on my previous tutorial. Now, let’s look at how to set up a Raspberry Pi Zero bluetooth connection without a GUI.


The small-body version of the Raspberry Pi supports Bluetooth 4.1 which also means it’s Bluetooth Low Energy (BLE) compatible. This increases the number of possible devices we can interface with the Raspberry Pi Zero W.

My aim for this tutorial is to establish a connection between the Raspberry Pi Zero and my HC-05 bluetooth module. If this is possible, then I could control my RPi Zero via Bluetooth.

Bluetooth via GUI

As I've said, I'll exclusively be using the terminal here. Setting up Bluetooth via GUI requires blueman which can be installed using

When blueman is installed, Bluetooth Manager is now accessible in Preferences.

Raspberry Pi Zero Terminal Bluetooth Control

Bluetooth options via terminal is accessible by issuing this command

Once you enter this command, the Bluetooth MAC Address of your Pi will be shown as well as the addresses of nearby devices.

Next, you need to turn on the Bluetooth agent which is a program that will manage the pairing between devices

Press enter. You can then use custom agents or the default agent. For now, let’s use the default bluetooth agent. Type:

And press enter.

To scan available bluetooth devices, type

The list of available devices will appear like this:

To pair with a specific device, like the HC-05 in this example, use this command

That’s it for the pairing. But we can’t send data from and to these devices yet.

Creating a Serial Port Profile

Since Bluetooth is essentially a wireless serial port, we need to create a serial port profile first. This is done by editing the following file:

Locate the line which says:

and add -C at the end. Then on the line immediately after, add

So basically this is what it should look like:

Save the file and reboot. Then go to bluetoothctl again and pair the RPi and the HC-05.

Sending Messages via Bluetooth

To send and receive message via Bluetooth, we can use minicom just like how we could send and receive messages through the serial port. But first use the command

Then install minicom

To open minicom and connect to the HC-05 bluetooth serial port, type

That’s it! The HC-05 will be receiving anything you type on the minicom terminal. Of course, to make that data on the HC-05 side useful, you still need a microcontroller.

Let’s say you use this diagram from my serial bluetooth tutorial:

Arduino Bluetooth HC-05

And then use this sketch which makes the Arduino UNO a dummy TTL-to-USB device:

Open the serial monitor on the Arduino IDE and start typing messages. They should appear on the Raspberry Pi terminal!

Check Also

Uploading Camera Images from Raspberry Pi to Website

For those who are looking to work with images on their projects, the Raspberry Pi …

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.