Raspberry Pi Bluetooth Data Transfer to the Smartphone

In addition to some wireless connections such as 433Mhz, infrared and NFC, Bluetooth is probably the most common and popular mode of data transmission between smartphones, which is why the Raspberry Pi Bluetooth data transfer is interesting. Meanwhile, pretty much all devices support Bluetooth and can not only be paired with it but of course, you can also transfer data, which is interesting for projects such as a Car PC.

This tutorial will show you how to exchange files between Raspberry Pi and a Bluetooth-enabled mobile phone/smartphone.


Required Hardware Parts

In this tutorial, I used the following hardware parts:

The Bluetooth adapter can have a significant impact on the range. Cheap devices often do not recognize the connection after a few meters or obstacles, whereas higher-quality dongles also work up to a distance of 30 meters (outdoors).


Setting up the Software

First, some packages have to be installed:

sudo apt-get install bluez-utils libopenobex1 obexftp obexpushd --yes


After the USB Bluetooth dongle is connected, we check if it has been recognized correctly:

lsusb | grep Bluetooth

If a device has been detected, it will look like this:

raspberry pi bluetooth console


Now we check if the Bluetooth service has already been started (it is automatically loaded every time you restart).

sudo service bluetooth status
If the service is not running, you can also restart it with: sudo service bluetooth restart


For the device to be connected, it (smart phone) must be searched for. It starts a scan, which should find all devices in the immediate vicinity.

hcitool scan

The mobile phone should be found directly. If not, wait a few seconds as the last result is cached. If it’s detected, it will look like this:

pi@raspberrypi ~ $ hcitool scan
Scanning ...
        C4:42:02:41:B2:06       SM-G901F

This address of the device is important and will continuously be needed. In the following step, it must be changed according to your device address.

In order to connect the Pi and your mobile phone, this address must be specified (adjust it!):

sudo bluez-simple-agent hci0 C4:42:02:41:B2:06 yes

Then you will be asked for a code which you also have to enter on the mobile phone (for example 1234).
After that, the devices should be connected.



Send Files with the Raspberry Pi Bluetooth Module

Files can be sent on different channels. To find out which OBEX channel your smartphone uses, you can use the following command:

browse C4:42:02:41:B2:06 | egrep "Service Name:|Channel:"

Now you have to see which channel is under “OBEX Object Push”. For me, that is Channel 12.

To transfer a file (here ~/TEST.txt) you have to specify the following command (do not forget to change it):

obexftp --nopath --noconn --uuid none --bluetooth C4:42:02:41:B2:06 --channel 12 -p ~/TEST.txt

Subsequently, a request will pop up on the smartphone, which must be confirmed.

A number of other examples of obexftp can be found here.



Receive Files using Raspberry Pi Bluetooth

To receive files, we start an FTP server on the Raspberry Pi, which is waiting for files. With screen, the server can also be run in the background.

sudo obexpushd -B -n

Now you can select the file to be sent on the smartphone and send it to the connected Pi. Of course, depending on the size, it can take a bit. The file is created in the directory from which the server was started.


Finally, it should be said that the connected devices remain stored and no reconnecting is necessary, as long as both devices (Raspberry Pi Bluetooth Module and a terminal device such as a smartphone) are within reach of each other.

6 Responses

  1. Hello:
    This is what I got:

    pi@raspberrypi:~ $ sudo apt-get install bluez-utils libopenobex1 obexftp obexpushd –yes
    Reading package lists… Done
    Building dependency tree
    Reading state information… Done
    Package bluez-utils is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source
    However the following packages replace it:

    Package libopenobex1 is not available, but is referred to by another package.
    This may mean that the package is missing, has been obsoleted, or
    is only available from another source

    E: Package ‘bluez-utils’ has no installation candidate
    E: Package ‘libopenobex1’ has no installation candidate

    My data:
    Static hostname: raspberrypi
    Icon name: computer
    Machine ID:
    Boot ID:
    Operating System: Raspbian GNU/Linux 10 (buster)
    Kernel: Linux 4.19.75-v7+
    Architecture: arm

  2. Try
    sudo apt-get update
    sudo apt-get upgrade
    NO effect, same problem as Timon Yoder

  3. In this example, it will be in whatever folder you were running the command from. Other examples on the web tell you to create a folder, and then specify the file transfer location using the -o option. Here’s what I was using on my old setup. sudo obexpushd -B -o /home/pi/Documents/file_transfer -n


Leave a Comment

Your email address will not be published.