This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Ranging of connectable device based on nRF51822

Hi,

I'm developing nRF51 proximity based device using nRF51822 that acts as BLE peripheral. It advertises continuously using connectable indirect mode. User has Android smartphone with dedicated application. When user comes closer to the device than some given distance (i.e. 2 meters) smartphone app should connect to it and exchange some data. Distance measurement is based on RSSI.

Problem is that in Android during BLE scan most phones report each device only once if it's using connectable advertisements. Only for beacons (non connectable, indirect slow advertisement) RSSI is reported for each advert. packet. I want to be able to measure RSSI of multiple advertising packets and be able to connect to the device.

What I've tried so far:

  1. searching Android documentation for a way to modify default behavior of BLE scanner. I've found it for iOS but not for Android.
  2. various modifications to Android scan process (i.e. starting BLE scan for 1s, aborting it and restarting after short delay) - this works for some devices but ranging data are very unreliable and I get very little advertising packets compared to beacon and continuous scan.
  3. change advertisement parameters of nRF51 to those used by SDK beacon example while keeping BLE services set up. Ranging works fine but during connection attempt board reboots.

Last idea I have is to set up nRF51 to advertise as 2 devices - beacon and connectable device at the same time. Is it possible and if yes could you point me to some example code / documentation of how to do it?

Alternatively - is there other way to achieve my goal - forcing Android to report given device multiple times in single BLE scan while retaining ability to connect to it?

Parents
  • Hi,

    As you say some phones will only report each device once. This can be circumvented by stopping and starting scanning on the android device.

    Alternately you can have your device in multibroadcast mode where it is both a beacon and connectable, then when the beacon is within 2m range you can connect to the connectable advertiser and turn off the beacon. In SDK 11 we have a multiprotocol example that explains how concurrent protocols work in our stack.

    The multiprotocol example runs BLE concurrently with gazell, what you want is two BLE services concurrently. We have an example available on github that demonstrates this functionality. It can be found here.

    I also recommend having a look at the proximity application example from SDK11.

    Hopefully this answers your question. Best regards,

    Øyvind

Reply
  • Hi,

    As you say some phones will only report each device once. This can be circumvented by stopping and starting scanning on the android device.

    Alternately you can have your device in multibroadcast mode where it is both a beacon and connectable, then when the beacon is within 2m range you can connect to the connectable advertiser and turn off the beacon. In SDK 11 we have a multiprotocol example that explains how concurrent protocols work in our stack.

    The multiprotocol example runs BLE concurrently with gazell, what you want is two BLE services concurrently. We have an example available on github that demonstrates this functionality. It can be found here.

    I also recommend having a look at the proximity application example from SDK11.

    Hopefully this answers your question. Best regards,

    Øyvind

Children
No Data
Related