Send a Copy of Your Photos and Videos in Your Android Phone to Raspberry Pi Using Bluetooth
by mirza irwan osman in Circuits > Linux
24362 Views, 22 Favorites, 0 Comments
Send a Copy of Your Photos and Videos in Your Android Phone to Raspberry Pi Using Bluetooth
Introduction
This instructable built upon an earlier instructable "Turn Raspberry Pi into a Bluetooth Device" that I created.
The photos and videos on my Android phone are backed up automatically to Google+ Photo cloud. However, I want to store a copy in my own computer, close to me. I was looking for a way to copy them to my Linux-Debian computer or "Raspbian OS Raspberry Pi". I learned that I could use Bluetooth.
The good thing about using Bluetooth is that it does not require any cable. Besides, I already owned a Bluetooth Radio USB Adaptor and I already paid for the damn bluetooth radio that's built into the Android phone. So let's put these to useful work.
Target Readers
This instructable will mostly benefit Linux users, especially Debian and its derivatives like Raspberry Pi running Raspbian OS.
System Environment
Raspberry Pi with the following specification:
- Model B
- Debian 7.6
- Bluetooth Radio USB Adaptor
- Mains-Powered USB Hub
Android Phone with the following specification:
- Bluetooth interface
- Running KitKat
- Google Photos App
Turn the Raspberry Pi Into a Bluetooth Device
Complete the steps of my earlier Turn the Raspberry Pi into a Bluetooth Device instructable to complete this step.
Make Raspberry Pi Device Become a Bluetooth Object Push Profile (OPP) Server
Complete all the steps in "Make Raspberry Pi device become a Bluetooth Object Push Profile (OPP) Server" instructables.
Run the Bluetooth OBEX Push Service
On the Raspberry Pi
Open a Terminal Emulator program
Create a special directory to store the photos if desired. This directory can be anywhere as long as write permission exist for user who executed the obexpushd program:
$mkdir /home/pi/photos_from_phone
Close running OBEX Push Deamon Program if any:
ps aux | grep -i obexpushd
Output of Terminal Emulator
pi 2852 0.1 0.1 11940 800 pts/0 Sl+ 18:49 0:00 obexpushd -B -n
pi 2863 0.0 0.1 3552 820 pts/1 S+ 18:50 0:00 grep --color=auto -i obexpushd
kill -9 2852
Type the following to run the OBEX Push Daemon:
obexpushd -B -n -o '/home/pi/photos_from_phone'
Output of Terminal Emulator
obexpushd 0.11.2 Copyright (C) 2006-2010 Hendrik Sattler
This software comes with ABSOLUTELY NO WARRANTY.
This is free software, and you are welcome to redistribute it
under certain conditions.
Listening on bluetooth/[00:00:00:00:00:00]:9
Check that the SDP server is advertising the OBEX Push service that was installed and just started to Bluetooth clients:
sdptool browse local | grep obexpushd
Output of Terminal Emulator
Service Provider: obexpushd
Transfer a Photo in Android Phone to Raspberry Pi Using Bluetooth
On Android Phone
Open Photos App
Tap a photo to load it
Tap on share icon at bottom. It is the icon located at the middle.
Tap on Bluetooth icon
On the 'Bluetooth Device Chooser' screen, make sure that Raspberry Pi is listed in 'Available Devices' box. If Raspberry Pi not listed , tap on 'Scan for devices' button and wait for the Raspberry Pi to be listed. You may need to repeat 'Scan for devices' more than once.
Tap on the Raspberry Pi device found in 'Available Devices' box.
The Android Phone immediately sent the photo to Raspberry Pi.
Swipe from top screen using one finger to display status screen. The top row indicated a Bluetooth share event has occurred and file(s) has been sent.
Tap on the the row to display a detailed status message. The status message gave a detail information:
- file name sent (IMG_20141029_232956332.jpg),
- the Bluetooth device recipient (rpipro-0),
- the file size and
- "Sent complete" outcome.
On the Raspberry Pi
Open a new terminal window.
Change directory to same directory where obexpushd daemon was executed:
cd /home/pi/photos_from_phone
Locate the file:
ls -l IMG_20141029_232956332.jpg
Output of Terminal Emulator
-rw-r--r-- 1 pi pi 1241019 Oct 30 00:17 IMG_20141029_232956332.jpg
Status
The file was successfully transferred via Bluetooth to Raspberry Pi.
P.S. Sending a video from Android Phone involve the same sequence of tasks.
Shutdown the Bluetooth OBEX Push Service Running on Raspberry Pi
To prevent evil-doers from sending nasty stuff to Raspberry Pi. I advise that you end the OBEX pushd program when it is not in use:
Go to terminal window that runs obex pushd as the foreground process.
Press Ctlr + C keys .