Connecting raspberry pi 3 to android via Blueterm

Just got a raspberry pi model 3 and planned out to do something that was related to Bluetooth as never implemented it while working with Arduino. And with raspberry pi it comes built in.

The blog will further describe upon, how we can achieve data transfers between android and raspberry pi. Here data specifically represents text.

The very first thing to do is to provide internet connection to the pi. It can be done by connecting RJ45 directly from router to the pi. This will assign it an IP using DHCP. Then using any Linux distro ssh into the raspberry using default login/password of raspbian ( While installing raspbian, ssh might not be open. Therefore, create a file named ssh (without extension) in the place where the OS is installed. In the pi reboot the created file will automatically enable ssh in it)

First, update and upgrade the raspbian using following commands:

# apt-get update

# apt-get upgrade

Now we need to install the required packages for establishing the Bluetooth connectivity. Bluez offers a command line utility bluetoothctl to manage Bluetooth devices.

# sudo apt-get install bluetooth blueman bluez

Then reboot the raspberry pi using a command

# sudo reboot

Now SSH again and run this command to make sure that bluetooth is active

# sudo hciconfig hci0 up

Type in

# bluetoothctl

Now type in the following commands in order

[bluetooth]# power on
[bluetooth]# agent on
[bluetooth]# discoverable on
[bluetooth]# pairable on
[bluetooth]# scan on

The scan on command lists the devices with Bluetooth on along with the device MAC address.

# pair { device MAC address }

# connect { device MAC address }

For most of the devices, there might be an error in connecting with the Bluetooth. To rectify it just add a line at the end in main.conf of Bluetooth, and run the above 2 commands again. 

DisablePlugins = pnat

This is kind of a bug……..

Now to communicate with raspberry using android we need a Bluetooth Terminal App which supports communication via RFCOMM socket. For this tutorial, I used Blueterm app( available on play store ).

Next, we set up the serial port and RFCOMM channel to listen to the bluetooth.

# sdptool add sp

# sudo rfcomm listen hci0&

The second command opens up a rfcomm connection and ‘&’ implies that even if we have to wait for the connection, we can get back our terminal. Now go to your blueterm app and at the bottom of the phone, click connect. As and when the app gets connected, we can see the MAC of the Bluetooth device connected along with the connection port i.e. /dev/rfcomm0 in this case.

To see anything that is being transmitted from phone to terminal, use the cat command on /dev/rfcomm0  and kudos! you will be able to see all the transmitted messages.


I also write tech and security related blogs on My personal website


1 thought on “Connecting raspberry pi 3 to android via Blueterm”

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s