I have a Raspberry Pi unit connected to a sensor. Sensor is writing measurements to the sd card of the Raspberry Pi unit every 10 hrs. Now I want to copy this data to a android phone to plot the graphs every month.

As of now I am able to pair the Raspberry Pi and the android phone using the application I am writing for plotting the graphs. The problem I am facing is with file transfer. Can anyone guide me on what are the steps to programmatically transfer the file/data from Raspberry Pi to android phone. I don't have a WiFi adaptor and I have a Bluetooth adaptor.

  • 1
    Programming language, which one using you are?
    – Piotr Kula
    Commented Sep 3, 2015 at 15:02
  • @ppumkin On android, its java. Sensor readings are written using python in Raspberry Pi. Has not set anything specific to communication between devices yet on Rapberry Pi. Commented Sep 3, 2015 at 15:54
  • FTP transfer then. Both Linux and Android do that simply with tons of examples everywhere
    – Piotr Kula
    Commented Sep 3, 2015 at 16:41
  • @ppumkin Can you point at any of them. I hope you realize that the Raspberry Pi unit would have no UI associated with it when deployed to the field. So the transfer has to be initiated from the android application (please correct me, if wrong). Commented Sep 3, 2015 at 16:45
  • 1
    Oh bluetooth..... OBEX commander on abdroid
    – Piotr Kula
    Commented Sep 3, 2015 at 16:47

1 Answer 1


As for me, the simplest solution for such a task would be using OBEX profile as ppumkin suggested. Then you can write a simple bash script for doing the task(making the file transfer). If you want all to be automated you can launch the bash script as a Subprocess inside your main program(Python) so everything will be in one program.

Here is a explanatory tutorial for making both RPi and Android device a Bluetooth FTP : RPi to Android BT FTP

Outline of tutorial :

-Install Bluetooth software bluez.

-Make Android phone a BT FTP server.

-Make RPi a BT FTP client.

-Find phone's BT address(I suggest you do the scan (hcitool -i hciX scan) with root privileges since otherwise address might not show up.

-Pair devices.

-Send the file(in the tutorial it send an .mp3 extension file but you can send any file in any location with permissions provided of course)

After following the tutorial by Mirza, test the commands you have executed in order to transfer the file a few times and after finding a good pattern put them all in a shell script. Then arrange the changes in your main program to call that script as a subprocess.

  • @AmanDeepGautam you can delete your first comment.
    – Human
    Commented Sep 10, 2015 at 2:00
  • Is there a way in which I could detect an event in case of connection from phone is received so that I can start the file transfer to the phone. Commented Sep 10, 2015 at 2:31
  • @AmanDeepGautam As explained in 6th step of tutorial, after running a pairing agent(bluez-simple-agent) and after Android phone issues a "Bluetooth Pairing Request" and entering pin number in terminal of Raspberry Pi, there should be an "Enter a pin for pairing:" query. So again you could write a script to take screen output to a temporary file like a buffer in the background and check if the script "Enter a pin.." is inside that file as a background process then it would trigger. But I'm sure there must be loads of other solutions to this but this is the only one I could think of atm. Commented Sep 10, 2015 at 12:00

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.