2

Background

I'm using a couple of different hobbyist BLE devices (HM-10). This particular one is an example of one of them.

It's a simple 4-pin device and I've set all the parameters on it using an Arduino Nano and I can see the data coming into it live since it is connected to USB of my computer and I'm monitoring serial data using Arduino Serial Monitor.

hm-10 ble device

The device works great. I have it set to Type 3 which forces it to pair/bond (so iphone or ipad will force you to enter the 6-digit PASS code, which I've set on the device.

iPhone App Works

I have written a simple Single-View iOS app which runs on my iphone / ipad and finds local BLE peripherals.
Everything works great. When I select the item (HM-10) shown above by name I see the iOS pairing dialog & successfully pair the item.

I can send data and everything works fine. If I go out of distance or turn off bluetooth on my device then come back into proximity or turn the device back on, then the iphone can send data again and I see it in the Serial Monitor. Works great.

** The Problem ** The problem occurs if I then pair this device with any other iphone or ipad. After that, the new iphone / ipad can send data to the device with no problem.

However, if I then go back to my original iphone and attempt to send data again, I see the following error raised by the CBCentralManager: "Peer removed pairing information."

After that, I cannot send data from the original iphone to the device again, unless I go to Bluetooth settings on the phone and say, "Forget this device".

Android & HC-06 Bluetooth Devices

I've developed simple Android apps which use a similar Bluetooth classic device (HC-06) and I could pair multiple devices.

Questions

Does BLE 4.0 Allow multiple devices to be paired & bonded?

Do you know why the Peripheral would remove the pairing info? (again, this only occurs if I pair the device with a new iphone / ipad).

Is there a way to send something via iOS app that would tell it to renew the pairing information?

Do you have any suggestions (code to try or other) that would allow me to definitively know that this device does or does not allow multiple phones to pair with it? (I've contacted the manufacturer also.)

Note: I also have a another BLE device here and it seems to exhibit the same behavior. This seems odd though, because I have a BLE speaker that will pair with multiple devices so it must be possible. And I understand that could depend upon the BLE hardware.

raddevus
  • 8,142
  • 7
  • 66
  • 87

1 Answers1

3

Does BLE 4.0 Allow multiple devices to be paired & bonded?

Sure. But that doesn't mean that the device does. It needs to allocate memory for it, and smaller devices often don't.

Do you know why the Peripheral would remove the pairing info? (again, this only occurs if I pair the device with a new iphone / ipad).

It doesn't remove the pairing info. It's telling you the device has removed the pairing info. Pairing info includes a shared secret, so if one side throws away their secret, there's no point in you keeping yours. You have to create a new one.

Is there a way to send something via iOS app that would tell it to renew the pairing information?

Unfortunately no. Apple doesn't give any access to the pairing experience.

There isn't any standardized way to ask devices this kind of information. Some devices support a single pairing Some support two. Some support "a few." But it's really up to the device.

It is very possible that you will get a better overall experience with a Bluetooth 4.1 or 4.2 device, because they've added better security protocols. With iOS 13, the phone also supports cross-transport key derivation, which possibly will help here (if the device also supports it). But I don't think you can improve things with a Bluetooth 4.0 device.

Rob Napier
  • 286,113
  • 34
  • 456
  • 610
  • Great info, thanks for posting & helping to confirm some things, especially, "...need to allocate memory for it, and smaller devices often don't". I will wait a bit and mark this as answer in a day or two. Thanks again. – raddevus Jul 12 '22 at 18:22
  • Also, would you happen to be able to point me to a BLE 5.0 device that I could use instead of this one? Have you used any of these components to connect multiple devices? – raddevus Jul 12 '22 at 18:38
  • yes…but you won't like the answer :D The Qualcomm QCC512x series is quite nice, and can handle several pairings (I think it even supports 2 simultaneous connections). It's what I've worked with the most. (https://www.qualcomm.com/content/dam/qcomm-martech/dm-assets/documents/qcc5100-series-product-brief_87-cf482-1-i.pdf) But it certainly wouldn't be a replacement for an HC-06 :D (I'm kidding; it's completely inappropriate for your problem). I've generally used ESP32s for my smaller projects, but even that is outrageous for something you'd use an HC-06 in. – Rob Napier Jul 12 '22 at 18:59
  • 1
    Sorry, but most of my experience is in high-end earbuds. I don't have a lot of experience in low-cost Bluetooth modules. I would personally probably look at Nordic's nRF5 series (https://www.nordicsemi.com/Products/Bluetooth-Low-Energy). Nordic makes very nice chips, but they may still be a bit pricey, depending on your goals. If cost doesn't really matter, I'd look at Adafruit or SparkFun's nRF52 shields (that's what I'd actually buy myself if I were building a little Arduino thing). Last time I built something like this, I skipped the module and just used an ESP32 which as BLE built in. – Rob Napier Jul 12 '22 at 19:03
  • Thanks for taking your time to reply. I figured that might be the situation. Good to have it confirmed. – raddevus Jul 12 '22 at 20:57