-
Notifications
You must be signed in to change notification settings - Fork 716
BLE working with iPhone (LightBlue) #122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
Unfortunately my household is 100% android and I have no opportunity to test with an iPhone. I also don't know what "LightBlue" is? Is it an application or a product or something else? My testing so far has been against real/physical BLE devices, Android nRF Connect application and Linux Bluetoothctl. I'll be happy to partner with you at some mutually convenient time. We might be able to hop on a skype session and see if there is something special/needed in iPhone land. My ideal would be that you test with Linux Bluetoothctl and/or Android nRF Connect application and convince yourself that your ESP32 app runs well against those. If it doesn't then we have a common environment against which to examine. |
I'll continue testing this for an hour or two, but then I have to drive home (currently I'm in our electronics lab at work and it's 4:20pm here). I don't think, that I have a lot of time this weekend, but I'll continue working on this next week. I'll let you know, if I find out something new. |
I think I see the puzzle ... I think when I read your original post I understood it to mean that you are seeing your advertised service but are missing characteristics in that service. What I now understand is that you are not even seeing your advertised service (and hence not seeing ANY characteristics of that service). It takes one time to get ones head around the concepts of devices, services, characteristics and descriptors :-) I think we are suffering from the problem described here: We appear to have a "workaround" which is to switch on the diagnostics in the BLE C++ classes. Somehow (possibly a race condition) the classes work. We switch off debugging, we seem to loose services. Have a review of the problem (109) above and see if it makes sense. We are banging our heads trying to understand what different switching on/off debugging makes ... and still have a debt to get 109 fixed. |
Have you tried the nRf app(s) on iphone? I have used them with success with the ESP32 about a month ago. |
So... I read through #109 and changed the compiler optimization level from -Og to -Os and now it works perfectly! I can even use the same characteristics with the same UUIDs as I did with the Arduino + HC-08 bluetooth chip. So the app on the iPhone can stay as it is. |
I know this issue is closed but I wanted to ask @hsph what did he specifically do to make it work. I cannot see the Bluetooth from esp32 on iPad but see it only on android devices. I am not using any specific app. I am trying to look for Bluetooth devices on my iPad through the bluetooth settings section. I am using Gannett_master example from esp-off... Some feedback will be very helpful. |
Hi, iPhone and iPad is sensitive on a lot settings, try with intervals about 100ms |
@bhavenm BLE devices won't be visible sometimes on Bluetooth search in smartphones. Please use BLE scanner (android) or LightBlue(iOS) application, and search for Bluetooth devices using those apps |
@sanu-krishnan. I am using the Lightblue and I am able to see the ESP32. I am just wondering that if I am developing my own iOS app, is there something special that I need to do to make it work to find and connect the esp32 ? @bhavenm what esp32 board are you using? |
I have same issue. At first I couldn't even see the esp32 but that was because I was using an old version of BLE library without the fix for #109 which basically set the service id to be the primary service. Great find btw. Now I see it in light blue although the summary page says no services for the device but clicking on esp32 device shows the service and characteristics. I then played around changing the advertising max interval using the API @chegewara suggested , starting at 100ms and going up to 500ms in 50ms increments. That didn't work either. I'm assuming the compiler optimization work around mentioned earlier is not needed. On ardunio ide its already set to -Os anyway. Interestingly my Windows phone can connect now when previously it couldn't see esp32. I'll have a look at the apple development guide for ble to see if that sheds any light. |
Well after reading a lot about how apple ble works and finding out about ibeacons in the process (hadn't noticed that Neil added on a whole new class for data advertising, very cool), I then wondered why light blue and other scanners sees the device but not the iPhone Bluetooth settings. Well, if this post from 2014 is still true, iPhone Bluetooth settings only show 2.1/3.0 devices, keyboards and headsets and apps are used to connect to ble devices. https://stackoverflow.com/questions/27211573/bluetooth-low-energy-advertising-to-be-discoverable-in-ios-settings |
Hi @nkolban, I am using Linux Bluetoothctl and trying get notification data based on your code everything woks fine except notify. The only way I can get data via notify by connecting the ESP32 to iphone via BLE scanner, then use Node App using Bluetoothctl under the hood. I have to do this every time I turn off the ESP32. Thank you so much for your help. Best, |
You can add some code to esp32 example to make it works. This will be a workaround, just write value 0x01 or 0x02 to 0x2902 descriptor on characteristic that will send notify. I think it should works. |
@chegewara Thank you very much! you are absolutely correct. The main issue with descriptor 0x2902. after some investigations and tried to read descriptor value which was always 0, however when I connect BLE scanner via phone the value get chnaged to 1 and stay 1 until ESP32 unplugged or rebooted. I tried to send 0x01 or 0x02 to descriptor as you proposed using NOBLE but without any luck. would it possible to send the value on connect in the example "BLE_notify " `void loop() {
}` @nkolban |
You can set that descriptor value in setup or in onConnec/onDisconnect callbacks. |
Howdy! ;-) I want to send sensor values from a machine using an ESP32 and send it to an iPhone (7+) via BLE. At the moment I'm doing this with an Arduino and a HC-08 BT/BLE module.
I already tried out your cpp BLE examples, but I cannot see the characteristics via LightBlue. I can only see the device and I can also connect it, but that's it.
Do you have any experience using an iPhone in combination with the ESP?
Thanks in advance!

The text was updated successfully, but these errors were encountered: