Distance Measurement Sample Code

Is there a way to modify the distance measurement sample code to where it is intended for one transmitter and multiple receivers versus between just two devices? I am trying to attempt this using the nrf5340 DK. Or would it be better to use any of the peripheral and central sample code to do this?

  • Hi,

    I assume that you refer to the Distance Measurement module and the Nordic Distance Measurement library.

    The distance measurement library works for two devices at a time. (The algorithm itself is one-to-one only. It is not one-to-many, many-to-one, nor many-to-many.)

    What you can do at the application level, is to do multiple distance measurements with different devices, one after each other. In the Bluetooth: nRF Distance Measurement with Bluetooth LE discovery sample, each device both scans and advertises. Instead, you could modify that sample (possibly into two different samples) so that you have one device scan only, and the other devices advertise only, and then let the scanning device do a distance measurement session with each of the advertisers in turn.

    Regards,
    Terje

  • Thank you. Would this mean I would only have to modify the main.c file or other files as well?

  • Hi,

    It would most likely be mostly main.c, yes. Please note that some samples may have functionality in other files in the src folder of the sample as well, so depending on what you want to do you might have to do changes to those as well. You should not change other files (outside of the samples folder), though, as those are the files and libraries distributed with the SDK.

    Regards,
    Terje