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

Distance detection with PCA20006 nRF51822 Bluetooth smart beacon kit

I need help sorting out a configuration.

What I want to accomplish:
phase 1: detect if any bluetooth phone/device is present, without connecting to it
phase 2: determine how far that bluetooth phone/device is from the beacon (far, near, close)
phase 3: detect if a specific phone/device is near
phase 4: connect with that phone/device.

phase 1,2 and 3 should run on the beacon (nRF51822) phase 4 is initiated by the phone.

My hardware development kit is a PCA20006 nRF51822 Bluetooth smart beacon kit.
My software development environment is GCC + makefiles + SDK 10.0.0 (I'm a command line junkie)
I have tried S110 version 7.3.0 and 8.0.0 and S120 version 2.1.0

So far I have tried the following links:
rssi-without-connection
getting-rssi-by-serial-communication-using-nrf51822
BLE Multi-link Example

I didn't get it to work and now I have gotten very confused.

So questions:

  1. Is it even possible, what I want?
  2. which softdevice do I need, to accomplish my goals? S110 or S120? Version?
  3. My starting point was this file (nRF51822_beacon_firmware_1.1.1.msi.zip). What do I need to add to accomplish my goals?
  4. which of all the explanations around can I best follow.

I have tried so many configurations and versions that I'm a bit lost at the moment. Any help in directions for at least phase 1 and 2 would be great.
Thanks

  • Hi,

    phase 1: detect if any bluetooth phone/device is present, without connecting to it

    You can detect centrals by advertising using advertising packets with the 'scannable' property, which means either ADV_IND (connectable) or ADV_SCAN_IND (not connectable). The central may choose to send a scan request when receiving the advertising packet, which means you will be able to detect it. Do note that you will only detect active scanners. Passive scanners do not send scan requests, and so it is impossible to tell they are there.

    You can detect peripherals by scanning.

    phase 2: determine how far that bluetooth phone/device is from the beacon (far, near, close)

    You can use the received RSSI value as a rough estimate for distance. As it measures signal strength (and not actual physical distance) it will be affected by the environment such as reflecting walls or objects blocking line of sight, but it can give a good approximation. While in a connection you can use sd_ble_gap_rssi_get() to read the received signal strength. If you need the value for non-connected devices then you can read this on BLE events as described in the RSSI without connection answer.

    phase 3: detect if a specific phone/device is near, phase 4: connect with that phone/device.

    Using Peer Manager (or the older Device Manager) you can keep track of bonded devices, that is devices which you have previously connected to and initiated a bond with. By using RSSI values found in phase 2 you can for instance initiate directed advertising to the closest device of the devices in the bonding table.

    Your questions:

    1. I think it should be possible to do what you want, but it depends a little on what exactly it is. At least something close to what you want should be possible. It will require som work, and I think it would be best to take one step at a time. Use some time to get to know BLE, the SDK and the SoftDevice before you begin (see also answer to 4.).

    2. I would recommend using the latest version of the SDK whenever starting a new project, as this would provide the most features and support the newest hardware. Check the compatibility matrix to see what SDK versions support your hardware revision. There should be some markings on the IC that you can use to read from one of the compatibility matrixes what revision it is. I suggest that you use the newest SDK/SoftDevice that is compatible with each other and with your IC revision.

    3. I would try to find an example from a recent SDK to start from. If the example is not for pca20006 then you should be able to make it work by changing the PCAxxxxxx preprocessor define to PCA20006. Depending on the usage of LEDs and buttons some other changes might be required as well (as the PCA20006 may have fewer LEDs and buttons). There are beacon examples for the PCA20006 in the SDKs as well.

    4. To get familiar with the nRF series, the SDK and the SoftDevice I suggest you have a look at our tutorials, in particular those listed under "Bluetooth Low Energy". Then you will also get more familiar with BLE and get some thoughts about how you can make the things you want to make. But before that, the "Getting Started" tutorials is a great place for starting.

    Regards, Terje

  • A bit late, sorry. Nevertheless many thanks for your answer. We need to redefine the project.

Related