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,

    I think instead of using the nRF51-multi-role-conn-observer-advertiser example on github, which is made for SDK 9.0, it would be worth having a look at the SDK 10.0 examples\ble_peripheral\experimental_ble_app_multiactivity_beacon_hrs_advertiser example.

    It is an extension on top of the hrs example, which originally used app_timer (and it still does). The example advertises as a beacon when connected, but it should be relatively easy to invert this behaviour. Also, in advertiser_beacon.c you can see the m_beacon struct, which contains a ble_gap_adv_params_t struct with the advertising parameters.

    I have not had time to look deeply into the example, but I do hope it proves helpful.

    Regards, Terje

  • Many thanks. That solves my problem. Using app_beacon_timeslot.c as a template I was able to implement my coustom beacon format and use it in my project.

Reply
  • Many thanks. That solves my problem. Using app_beacon_timeslot.c as a template I was able to implement my coustom beacon format and use it in my project.

Children
No Data