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

Connecting the BLE device to a phone/App with highest signal strength

Dear Sir,

I am working on the following scenario.

I have BLE device ( SDK 15 and softdevice s132). It is advertising for specific duration.

There are different phones at different distances from the BLE device.

There will be multiple requests coming to the BLE device to establish connection. I want the BLE device to connect the phone with highest signal strength?

Is it possible to do handle such a scenario with SDK15 and softdevice s132?

Please guide me on this.

Thanking you.

  • Hi

    I don't see any reasons for why it shouldn't be possible. You can try fhe following:

    1. Advertise in NON-CONNECTABLE mode, with scan response and advertise until a phone asks for a scan request

    2. The p_ble_evt->evt.gap_evt.params.scan_req_report.rssi variable gets populated with the RSSI once the phone has sent a scan request package. 

    3. Repeat Step 1-2 until you have covered all relevant phones. Make a Whitelist that contain only the phone with the highest RSSI

    4. Set the phone in connectable mode and scan only for devices in your whitelist with a filter policy

    I reccomend that you read our tutorials on advertising and central: 

    Central: https://devzone.nordicsemi.com/tutorials/b/bluetooth-low-energy/posts/ble-central-tutorial

    Advertising: https://devzone.nordicsemi.com/tutorials/b/bluetooth-low-energy/posts/ble-advertising-a-beginners-tutorial

    Good Luck

    Jared 

  • Hi, Thank you for your susggestion.

    I will check it.

  • Hi,

    You mentioned the following .

    2. The _ble_evt->evt.gap_evt.params.adv_report.rssi variable gets populated with the RSSI once the phone has sent a scan request package. 

    So is this means the following.

    The variable "_ble_evt->evt.gap_evt.params.adv_report.rssi " (which is in the peripheral side)  will get populated with the rssi of the phone which responded to advertiser(which is the peripheral device itself).?

    PLease correct me if i am wrong.

  • Hi 

    I'm sorry but the correct variable is p_ble_evt->evt.gap_evt.params.scan_req_report.rssi not p_ble_evt->evt.gap_evt.params.adv_report.rssi

    You're understanding is correct otherwise. You enable a BLE_GAP_EVT_SCAN_REQ_REPORT by setting p_advertising->adv_params.scan_req_notification = 1 in ble_advertising.c

    I've included a modified version of the template example where a BLE_GAP_EVT_SCAN_REQ_REPORT is made when a scan request package is requested to the peripheral. The Peripheral prints out the  RSSI to the central that requested the scan request package to a terminal

    Cheers

    Jared

    Scan_example.zip

  • Hi,

    In the code  you have written the code as follows.

    rssi = p_ble_evt->evt.gap_evt.params.adv_report.rssi;
    // rssi = p_ble_evt->evt.gap_evt.params.scan_req_report.rssi;

    So as you mentioned above, I need to comment out first line and uncomment the second one. right?

    Thank you.

    It is showing the values  now,

    (after enabling the variable   " p_ble_evt->evt.gap_evt.params.scan_req_report.rssi"  ). as folllows

    <info> app: SCAN REPORT SENT
    <info> app: RSSI:-42
    <info> app: SCAN REPORT

    <info> app: SCAN REPORT SENT
    <info> app: RSSI:-41
    <info> app: SCAN REPORT

    <info> app: SCAN REPORT SENT
    <info> app: RSSI:-72
    <info> app: SCAN REPORT

    <info> app: SCAN REPORT SENT
    <info> app: RSSI:-83

    But the value is continuously varying...Is that an expected behaviour?

    And how can I print the peer address (using NRF_LOG_INFO()) also along with rssi?

    Please share your ideas.

    Thanking you

Related