Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I make Raspberry Pi 3 discoverable for iOS and CoreBluetooth?

I have a Raspberry Pi 3 and I am trying to make it discoverable for iOS devices. I ran sudo hciconfig hci0 piscan to make it discoverable. I can see it with my iMac.

On iOS, I am using CoreBluetooth and running a scan for nearby devices. I can discover several FitBit devices and my iMac, but the Raspberry Pi is not showing up.

Is there another setting that I have to enable for Bluetooth LE discoverability? Is the Raspberry Pi 3 compatible with iOS for bluetooth connectivity?

Thanks in advance. I appreciate any help with this.

like image 944
Jeremiah Jessel Avatar asked Jun 20 '16 16:06

Jeremiah Jessel


People also ask

How do I make my Raspberry Pi discoverable?

On your Raspberry Pi: Click Bluetooth ‣ Turn On Bluetooth (if it's off) Click Bluetooth ‣ Make Discoverable.

How do I get my Raspberry Pi to show on my iPhone?

You can do so by ssh over usb. You need to plug the iphone into the raspberry pi via the lightning cable and turn USB Tethering on. For the first time, you need a monitor to be connected to the raspberry pi or use VNC/SSH in your home network to get the ip details for the interface between raspberry pi and the iphone.

Does Raspberry Pi 3 have Wi-Fi and Bluetooth?

The Raspberry Pi 3 is the first version of the computer to have on-board wireless and Bluetooth.


3 Answers

After much research and some help from a Twitter friend, to enable the LE broadcast you have to use one of the following commands.

sudo hciconfig hci0 leadv 0
sudo hciconfig hci0 leadv 3

The 0 indicates connectable.

The 3 indicates non connectable.

like image 55
Jeremiah Jessel Avatar answered Oct 07 '22 00:10

Jeremiah Jessel


For those having issue connection to Iphone, the only way I found to make the RPi visible in the Bluetooth Scanning screen is to set the raspberry PI role/profile as audio sink as per below in addition to the posted in @Jeremiah Jessel answer:

sudo /bin/hciconfighci0 inqdata "0c097261737062657272797069020a00091002006b1d460217050d03001801180e110c1115110b1100"

all in one line, the long string is the enquiry data, in this string we are setting the bluetooth name and the profiles supported by our raspberry PI

like image 22
Jonathan Ruiz Avatar answered Oct 07 '22 01:10

Jonathan Ruiz


For anyone that was helped by HubuN and was wondering the same thing as Manuel Otto, you can change the name by editing the hex data after 0c09 and before 020a. I don't have the reputation to add a comment, which is why I'm adding a separate answer.

Using HubuN's example:

sudo /bin/hciconfig hci0 inqdata "0c097261737062657272797069020a00091002006b1d460217050d03001801180e110c1115110b1100"

"raspberrypi" is 7261737062657272797069

So let's say you wanted to change it to "MyName"

You would get the hex for "MyName" and fill the remaining empty data with 0's

4d794e616d65 = "MyName"

7261737062657272797069 = "raspberrypi"

4d794e616d650000000000 = "MyName     "

Which gives you:

sudo /bin/hciconfig hci0 inqdata "0c094d794e616d650000000000020a00091002006b1d460217050d03001801180e110c1115110b1100"

I'm not super familiar with the rest of the hex code, so if someone else wants to explain it, or even provide an easier solution, feel free.

(Note: you can use a tool like this one to convert from text to HEX)

like image 36
Nick M Avatar answered Oct 07 '22 01:10

Nick M