Raspberry Pi

How to Pair Raspberry Pi with Android Phone

Raspberry Pi is a credit card size single board computer tucked in with Bluetooth and Wi-Fi modules. These modules will help users perform a wide range of tasks, including transferring files, creating web servers and home automation. The Bluetooth module on Raspberry Pi allows you to pair different electronic devices to your system. These devices include connecting Bluetooth speakers, smart watches, other Raspberry Pi devices, ESP32, computer or Android phone.

If you are an Android user, you will definitely want to pair it with your Raspberry Pi device. Pairing your Raspberry Pi device with the Android phone will help you in file transferring, or speaking on the mic directly from the using Raspberry Pi.

In this guide, you will learn:

How to Pair Raspberry Pi with Android Phone

How to Use Raspberry Pi Speakers with Android Phone

How to Share Files from Raspberry Pi to Android Phone Through Bluetooth

How to Share Files from Android Phone to Raspberry Pi Through Bluetooth

Bonus Method: How to Pair Raspberry Pi with Android Phone Using Bluedot App

Conclusion

How to Pair Raspberry Pi with Android Phone

You can pair Raspberry Pi with Android phone by:

How to Pair Raspberry Pi with Android Phone Using GUI

You can pair Raspberry Pi with Android using GUI from the following steps:

Step 1: Turn on Bluetooth on Android

First, you should turn on Bluetooth on your Android phone, you can turn it on from the Control Panel of your phone or from the settings.

Step 2: Open Bluetooth on Raspberry Pi

Then, go to Raspberry Pi Taskbar, click on the Bluetooth icon and select Add Device:

Step 3: Pair a Device

If the Bluetooth on your Android phone is turned on, it will appear in the Add New Device list, select the device and click on the Pair option:

Step 4: Confirm Code for Pairing

You must confirm the code that appears on your screen both on Raspberry Pi and Android phone:

After successfully pairing an Android phone to Raspberry Pi, you will be able to see your phone is connected to your Raspberry Pi device, with the green icon:

 

How to Pair Raspberry Pi with Android Phone Using Terminal

Beside using the GUI, you can also use the Raspberry Pi terminal to pair your Raspberry Pi device with the Android phone. This can be done using the bluetoothctl command line-utility that is preinstalled on Raspberry Pi. It provides an easy way to connect any Bluetooth device to Raspberry Pi directly from the terminal. Thus, it is an effective choice for those users who are using lite version of Raspberry Pi OS.

You can pair Raspberry Pi with Android phone using terminal through the following steps:

Step 1: Run bluetoothctl Command

First, open Raspberry Pi terminal using CTRL+ALT+T from keyboard and then run the bluetoothctl command with sudo user:

sudo bluetoothctl

Step 2: Make Raspberry Pi Discoverable

You have to make your Raspberry Pi device discoverable so that other Bluetooth devices will see your device. You can make your device discoverable using the following command:

discoverable on

Step 3: Enable Bluetooth Pairing

You have to enable Bluetooth pairing on your Raspberry Pi device through terminal using the following command:

pairable on

Step 4: Turn on Bluetooth Agent

The Bluetooth agent is responsible for starting pairing the Bluetooth device through pairing code so you must ensure it is turned on. You can turn on Bluetooth agent on Raspberry Pi from the following command:

agent on

Step 5: Ensure the Default Bluetooth Agent is Enabled

You must ensure the default Bluetooth agent is turned on successfully. The following command will inform you about the success of the request you initially done in the previous step:

default agent

Step 6: Scan for Bluetooth Devices

After completing the above steps, you can now scan Bluetooth devices on Raspberry Pi terminal using the following command:

scan on

The scan on command will list your Bluetooth devices with the Bluetooth MAC address including your Android phone’s Bluetooth as well. If your Android phone’s Bluetooth MAC address is not appearing in the list, turn off, then turn on your Bluetooth again on your Android phone.

Step 7: Pair Raspberry Pi with Android Phone

To pair Raspberry Pi with Android phone, you can use the pair command with the Bluetooth MAC address:

pair <Android phone’s Bluetooth MAC Address>

Confirm your pass key on the terminal as well as your Android phone:

This will pair your Raspberry Pi device with the Android phone:

Note: If you are facing a problem with the pairing, tap on the raspberry pi Bluetooth from your Bluetooth devices option on your Android phone to connect Raspberry Pi with the phone.

How to Use Raspberry Pi Speakers with Android Phone

Raspberry Pi doesn’t have built-in speakers. However, if you have connected external speakers with the Raspberry Pi device, you can listen to calls from your Android phone onto your Raspberry Pi speakers. You can also connect headphones with the Raspberry Pi device and communicate from your Raspberry Pi. You can do this by using the Speakers option from your Android phone when you have accepted someone’s call.

How to Share Files from Raspberry Pi to Android Phone Through Bluetooth

You cannot share files directly with Raspberry Pi to an Android phone through Bluetooth. However, you can do it easily by installing Bluetooth Manager on the Raspberry Pi system. Bluetooth Manager is a GUI utility that allows you to transfer files from one Bluetooth device to another. If you want to share files from Raspberry Pi to Android phone, you can follow the below-given steps:

Step 1: Install Bluetooth Manager on Raspberry Pi

First, install Bluetooth Manager on your Raspberry Pi system from the official system repository using the following command:

sudo apt-get install blueman -y

Step 2: Send File from Raspberry Pi to Android Phone

To send file from Raspberry Pi to Android phone, right-click on the Bluetooth Manager icon and select Send Files to Device option:

Step 3: Select the File

Select the file you want to send from Raspberry Pi to Android:

Step 4: Select the Bluetooth Device

Now, select your Bluetooth device from the list and choose OK button:

You will see a notification on your Android phone that asks for permission to allow the file transfer to your Android phone. You must give permission to successfully transfer file from Raspberry Pi device to your Android phone:

How to Share Files from Android Phone to Raspberry Pi Through Bluetooth

You can also share your files from Android phone to Raspberry Pi through Bluetooth, this can be done by selecting the file you want to send, choosing the Share option and selecting Bluetooth. Tap on the Raspberry Pi Bluetooth option in the devices list to share files from Android phone to Raspberry Pi successfully.

Bonus Method: How to Pair Raspberry Pi with Android Phone Using Bluedot App

Bluedot is a python application that allows users to pair your Bluetooth devices including Raspberry Pi. It uses the Bluetooth technology to quickly connect your Bluetooth device including your Android phone to your Raspberry Pi device. The following steps will help you pair Raspberry Pi with Android phone using the Bluetooth app:

Step 1: Install Bluedot on Raspberry Pi

First, you have to install Bluedot application on your Raspberry Pi system from the pip installation command, as given below:

pip3 install bluedot

Step 2: Create a Python File on Raspberry Pi

Now, you have to create a python file on your system using your favorite editor like nano or vim:

nano file_name.py

Ensure replacing the filename with the name of your choice in the above command.

Step 3: Add Code Inside the Python File

Inside the file, add the a few lines of code given below:

from bluedot import BlueDot

bd = BlueDot()

bd.wait_for_press()

print("Exit the process because Bluedot Button is Pressed on Android!")

Step 4: Save the File

After adding the code, you must save the file using CTRL+X, add Y and press Enter.

Step 5: Install Bluedot App on Android Phone

Before running the python file, you must install the Bluedot app on your Android phone from here.

Step 6: Run the Bluedot App on Android Phone

You must run the Bluedot app on your Android phone and turn on the Bluetooth as well because the app will use your Bluetooth technology.

Step 7: Run the File

You can now run the python file using python interpreter using the following command:

python3 filename.py

Tap on the raspberrypi device from the Bluetooth list that appears on your Bluedot app installed on your Android phone.

As soon as you tap on the device, you will see a notification being displayed on your terminal saying that your Android phone is connected:

You can close the connection by clicking on the Bluedot button, or press back to disconnect the device:

Conclusion

Pairing Raspberry Pi with an Android phone is a useful task that helps you in file transferring or voice calling directly from Raspberry Pi. You can pair Raspberry Pi with an Android phone either from GUI or terminal. The GUI method can be done by enabling the Bluetooth on an Android phone and connecting it from the Add Device option from the Bluetooth icon in the Raspberry Pi’s taskbar. To pair Raspberry Pi with an Android phone using the terminal, you can use the bluetoothctl command. However, for file transferring, you have to install Bluetooth Manager on the Raspberry Pi system whose setup guide is already provided in the above section of this article.

About the author

Awais Khan

I'm an Engineer and an academic researcher by profession. My interest for Raspberry Pi, embedded systems and blogging has brought me here to share my knowledge with others.