I want to be able to send code files to my Raspberry Pi Zero W from my Mac or Android phone, without needing to go do anything on the Pi itself.

I was able to pair and connect to my devices with bluetoothctl, but the problem seems to be that my devices don't recognize the Pi as a device that can receive files via Bluetooth. My headless Raspi is running a Raspberry Pi OS Lite and I access it (for now) by sshing to it via USB cable.

Please let me know in the comments section down below what other information you want me to provide.

  • Have you tried to make a Bluetooth PAN connection with the pi? Once you do that, you'll have a simplified interface to transferring files between your pi and Mac.
    – PHimmel
    Commented Jan 4, 2021 at 1:26
  • No, I haven't. Is it possible to also use this trick on a phone (either Android or iOS)? Because my final goal is to create an app that occasionally talks and sends files to the Pi via bluetooth.
    – SepSol
    Commented Jan 4, 2021 at 1:49
  • Well if you have wifi - you could run a Flask server on the pi and have it run on localhost as a background daemon. Then you build your app to make specific url requests to the Flask server, using its routing capabilities. . . There's so much existing web infrastructure to build off of (Flask in this example), that I would navigate away from BT and embrace the powerful tools that are available for web/networking.
    – PHimmel
    Commented Jan 4, 2021 at 4:07
  • The app I'm creating is a companion for a custom device that has the Raspberry Pi in it. How would I connect the Raspi to the router for the first time if I want the end-user to not interact with Raspi at all and only interact with the companion app on his/her mobile phone? I'm asking this because I assume in order for Flask to work correctly, Raspi needs to be connected to the router of the end-user.
    – SepSol
    Commented Jan 4, 2021 at 5:58

2 Answers 2


Bluetooth is interoperable by having common ways to interact defined by the Bluetooth SIG. There is a list of these profiles at: https://www.bluetooth.com/specifications/profiles-overview/

The list of profiles supported by BlueZ (the official Bluetooth stack on Linux) is documented at: http://www.bluez.org/profiles/

I suspect from your question, one of the two following profiles are most likely to do what you want:

  • OPP Object Push Profile
  • PAN Personal Area Networking Profile

There first one is probably most likely to be helpful. Often referred to as OBEX

The daemon doesn't seem to be installed by default so you would need to install it with:

sudo apt install bluez-obexd

And you will have to start it. You can get the full options with:

/usr/lib/bluetooth/obexd -h

I used the following for my test:

/usr/lib/bluetooth/obexd -- --root=/tmp/bluetooth-inbox -l -d

If you do bluetoothctl show there should be an extra UUID added e.g:

UUID: OBEX Object Push          (00001105-0000-1000-8000-00805f9b34fb)

There is a command line client called obexctl that might be useful to help explore the functionality.

The BlueZ API for this functionality is documented at the following depending if you want a server or client:

https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/obex-agent-api.txt https://git.kernel.org/pub/scm/bluetooth/bluez.git/tree/doc/obex-api.txt

If you wanted to use personal area network profile, then that API is documented at:


As a footnote, when using Raspberry Pi OS lite it has been found that user pi is not necessarily a member of the bluetooth group. This can be cured as follows:

$ sudo usermod -G bluetooth -a pi

Adding pi to this group means that your Bluetooth program doesn't need to be run as root.

  • 1
    I am trying to follow your solution but when I enter /usr/lib/bluetooth/obexd -- --root=/tmp/bluetooth-inbox -l -d at the terminal, I get this back: Unable to autolaunch a dbus-daemon without a $DISPLAY for X11. I've did a little bit of Googling but I couldn't find an appropriate solution. Would mark this as a solution if it works out!
    – SepSol
    Commented Jan 5, 2021 at 20:17
  • Did you run that command as root or with sudo? There used to be a problem starting DBus services on older versions of the RPi Lite OS but I thought that had been resolved. I don't have a Pi setup with lite to test. Maybe try it with a full OS and see if works there. If it does, then see what is missing from the Lite version for your needs.
    – ukBaz
    Commented Jan 6, 2021 at 6:57
  • 1
    Yes, that didn't work with sudo as well
    – SepSol
    Commented Jan 6, 2021 at 7:42

AFAIK the Pi Bluetooth stack only supports HID & audio so this is not possible.

There are many protocols which allow file transfer over an IP connection.

I normally use ftp - which works out of the box.

I also use Samba (and have used afp and nfs) but these all require setting up shares on the Pi.

You can use scp to copy files over ssh.

You will find documentation on https://www.raspberrypi.org/documentation/remote-access/

  • Thanks! My final goal is to create an app that occasionally talks and sends files to the Pi. Can you walk me through the other methods (other than Bluetooth) I can use for staying connected to the Pi and send files to it from time to time?
    – SepSol
    Commented Jan 4, 2021 at 1:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.