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

Bonding only when client is close to server?

What's the proper way to implement bonding that depends on proximity (rather than a whitelist)? So when the client (phone) is close (say, five to ten centimeters) to the server (BTLE peripheral) then there is a bond created and the devices can now communicate over a larger range. I'm looking at the proximity example, but if there are other resources out there, please point them to me if possible. Thanks!

Parents
  • Hello @bad time simulator

    You can approximate this behavior using RSSI, but BLE doesn't provide a reliable way to enforce an exact distance of 5–10 cm.

    One approach is to advertise at reduced TX power and monitor RSSI after the connection is established. In the nRF5 SDK, you can use sd_ble_gap_rssi_start() to monitor the signal strength and only initiate bonding when the RSSI stays above a chosen threshold for several consecutive measurements.

    However, RSSI varies with phone models, antenna orientation, and the surrounding environment, so you'll need to calibrate the threshold and use some hysteresis to avoid unstable behavior.

    If you need to guarantee that the devices are physically close before bonding, NFC-based out-of-band pairing would be a more reliable solution than RSSI alone.

Reply
  • Hello @bad time simulator

    You can approximate this behavior using RSSI, but BLE doesn't provide a reliable way to enforce an exact distance of 5–10 cm.

    One approach is to advertise at reduced TX power and monitor RSSI after the connection is established. In the nRF5 SDK, you can use sd_ble_gap_rssi_start() to monitor the signal strength and only initiate bonding when the RSSI stays above a chosen threshold for several consecutive measurements.

    However, RSSI varies with phone models, antenna orientation, and the surrounding environment, so you'll need to calibrate the threshold and use some hysteresis to avoid unstable behavior.

    If you need to guarantee that the devices are physically close before bonding, NFC-based out-of-band pairing would be a more reliable solution than RSSI alone.

Children
No Data
Related