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.
On your Raspberry Pi: Click Bluetooth ‣ Turn On Bluetooth (if it's off) Click Bluetooth ‣ Make Discoverable.
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.
The Raspberry Pi 3 is the first version of the computer to have on-board wireless and Bluetooth.
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.
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
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)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With