1

I have 5 strips of LEDs that are linked up to 5 transistors, nothing special. I want to be able to create an android app that when I press a button it sends a command via Bluetooth to the Raspberry Pi telling a specific GPIO pin to turn on. (I am using GPIO pins to turn transistors on and off)

The issue I have is I have no experience with Bluetooth on a Raspberry Pi. I have a £5 bluetooth dongle, it is all installed and I can pair the Pi to my phone no problem.....that is as far as I have got.

Is there a way of doing this?

2

Bluetooth is a communication protocol. Or, as better described by Wikipedia:

Bluetooth is a wireless technology standard for exchanging data over short distances (using short-wavelength UHF radio waves in the ISM band from 2.4 to 2.485 GHz[2]) from fixed and mobile devices, and building personal area networks (PANs). Invented by telecom vendor Ericsson in 1994,[3] it was originally conceived as a wireless alternative to RS-232 data cables. It can connect several devices, overcoming problems of synchronization.

There are a number of protocols that stack on top of Bluetooth for specific applications, such as Human Interface Devices (mouse/keyboard etc.), Audio Headsets and others. They are called "profiles" in bluetooth-terminology. Wikipedia has a comprehensive list of bluetooth profiles that is interesting to know.

Many of these profiles have driver implementations for Linux, and, as an extension, for the Raspberry Pi. Choosing one of those existing profiles would be, thus, the best option for such a project.

Linux machines use the BlueZ Bluetooth stack, and you can check which Bluetooth profiles it supports in the supported profiles link.

For your particular application I would suggest using the Serial Port Profile - SPP that should be simple to implement and will transmit and receive short messages like the ones you probably need to get your project done. Sometimes it is called RFCOMM, like in the Android Bluetooth Documentation.

Given that there is a BlueZ version for Android (I don't know if it is the default stack on the Android, but I suspect so), you have the two sides of the channel supporting SPP.

Other profiles you might take a look that could get your project done, even if in a hackish way, are:

You can begin your Bluetooth development reading An Introduction to Bluetooth Programming by Albert Huang, chapter 4 deals specifically with BlueZ. Also, take a look at BlueZ less then optimal development page.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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