Can anybody tell me exactly what I need to do in order to get my android phone to communicate to the Raspberry Pi via Bluetooth? I am new to this and I have made an Android app that has 2 buttons that will hopefully turn on and off an Led.
-
Are you talking about turning an LED on the Raspberry Pi on and off? Is that via GPIO pins or one of the LEDs on the Pi? Have you checked out the list of Raspberry Pi verified peripherals (including Bluetooth) at?– HeatfanJohnMar 9, 2013 at 2:13
-
Yes I am talking about turning an LED via GPIO pins. I have checked out a few sites but as I said before, but i find it hard to understand. I am new to all this– CluckMar 9, 2013 at 8:55
2 Answers
Firstly you need to make sure you use a Bluetooth module that supports the SPP Profile.
It can either be a USB (With SPP [most have this]) one or one that has UART break out like this.
With a USB you will get a new Serial port listed under /dev/. Then you can use Python or C# Mono to run and read UART and do things you want.
On the Android side you need to create a BlueTooth Socket
The most common type of Bluetooth socket is RFCOMM, which is the type supported by the Android APIs. RFCOMM is a connection-oriented, streaming transport over Bluetooth. It is also known as the Serial Port Profile (SPP).
- You have to connect to the BlueTooth device manually via the Settings panel.
- Programmatic BlueTooth hopping or device pairing is a nightmare and sometimes not even possible.
- Be careful - Not all models of phones support SPP. For example NOT A SINGLE IPHONE has SPP. Sometimes jailbreaking and doing a lot of hacking you can do some clever stuff. There is expensive hardware that is Apple approved that enables a new Serial port to send vie BlueTooth SPP
Good Luck
For hardware check out this list of working Bluetooth adapters for the Pi.
My Pi is down right now (my SD card died and guess who didn't make a backup copy of it!) otherwise I would try to install the Bluetooth packages listed in this article. To pair your Pi with your phone you can use the bluetooth-agent
command of the bluez
package.