Introduction: Make Raspberry Pi Device Become a Bluetooth Object Push Profile (OPP) Server

About: Systems Administrator and Software Programmer.

Introduction

Android Phone runs a bluetooth protocol stack. Raspbian OS, the popular OS for Raspberry Pi also runs an implementation of the Bluetooth protocol stack. This suggest that the Raspberry Pi and the Android Phone are able to communicate remotely using Bluetooth Object Push protocol as depicted in the first picture. However, for these 2 devices to do useful task, a Bluetooth profile must be defined and implemented for each device. A useful Bluetooth profile for these 2 devices to have is the Object Push Profile (OPP).

Android OS has a built-in OPP client. In order for Android's OPP client to communicate with Raspberry Pi, we must make Raspberry Pi become a OPP server. This interaction is depicted in the second diagram.

This instructable will demonstrate my attempt to make Raspberry Pi and a notebook computer become a OPP server so that a device like an Android Phone can communicate with it remotely.

Scope

This instructable will cover the following:

  • Add Bluetooth interface to Raspberry Pi
  • Install OPP Server in Raspberry Pi that can only receive files
  • Test that Raspberry Pi is advertising its OPP service

This instructable will NOT show how to make OPP client send file to Raspberry Pi. You can read my "Send a copy of your photos and videos in your Android Phone to Raspberry Pi using Bluetooth" instructable for an example of that.

Target Readers

This instructable will mostly benefit Linux users, especially Debian and its derivatives like Raspberry Pi running Raspbian OS.

System Environment

A notebook computer with the following specification:

  • Intel® Core™2 Duo Processor
  • Debian 7.4
  • Bluetooth Radio Built-in

Raspberry Pi with the following specification:

  • Model B
  • Debian 7.6
  • Bluetooth Radio USB Adaptor
  • Mains-Powered USB Hub

Credits

The pictures of the Bluetooth protocol stack is copied from bluetooth.org

Step 1: Turn the Raspberry Pi Into a Bluetooth Device

Complete the steps in the "Turn the Raspberry Pi into a Bluetooth Device" instructable if you have not done so.

Step 2: Install OPP Server in Raspberry Pi

Open your favourite terminal emulator, like LXTerminal.

Install the OPP Server:

sudo apt-get update
sudo apt-get install obexpushd
sudo apt-cache show obexpushd

Output of Raspberry Pi

Package: obexpushd

Version: 0.11.2-1

Architecture: armhf

Maintainer: Gabriele Giacone <1o5g4r8o@gmail.com>

Installed-Size: 143

Depends: libbluetooth3 (>= 4.91), libc6 (>= 2.13-28), libopenobex1

Suggests: bluez-utils, irda-utils

Homepage: http://www.gitorious.org/obexpushd/

Priority: optional

Section: comm

Filename: pool/main/o/obexpushd/obexpushd_0.11.2-1_armhf.deb

Size: 57482

SHA256: d693d1aa9c2de4f504712472e2e792216ce7a5b58f54806c342419919e89f6d2

SHA1: 72e10aeff7d1457cae510d4807363a941454b79c

MD5sum: 5d86bd3cc554e15fd54d79c6cd447d17

Description: program for receiving files via Bluetooth or IRDA

This program can be used to receive files with OBEX protocol

over Bluetooth or IrDA (infrared) connection. This program

should work with many mobile devices like PDA's and mobile

phones.

Step 3: Run the OPP Server

Raspbian based on Wheezy:

Open Terminal Emulator program like LXTerminal

Run the FTP Server:

obexpushd -B -n

Output of Raspberry Pi

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

Raspbian based on Jessie:

obexpushd must be run as a root.

sudo obexpushd -B -n

Optional: Alternatively the obexpushd can be run as a system service.

Step 4: Test That Raspberry Pi Is Advertising Its OPP Service

Open Terminal Emulator

Raspbian based on Wheezy:

sdptool browse local | grep obexpushd

Raspbian based on Jessie:

sudo sdptool browse local | grep obexpushd

Output of Terminal Emulator

Service Provider: obexpushd

Status

Raspberry Pi is now advertising Bluetooth's File Transfer Profile service to remote Bluetooth client

Step 5: Shutdown the Bluetooth OBEX Push Service Running on Raspberry Pi

I advise that you end the OBEX pushd program when it is not in use to prevent evil-doers from sending nasty stuff that will clog up the disk space of your Raspberry Pi:

Go to terminal window that runs obex pushd as the foreground process.

Kill the OBEX pushd program:

Press Ctlr + C keys