Distance Measurement Mesh Client + Server Sample Wanted

Hi there. I'm attempting to do trilateration between 3 nRF Devices. A1, A2, and A3.

A1 - A2 I can get using the nRF Distance Measurement toolbox

A1 - A3 I can get using the nRF Distance Measurement toolbox

A2 - A3 I can get using the nRF Distance Measurement toolbox.

However, I need all the data to be stored on A1.

I need some way to get the data from A2 or A3 onto A1.
I've spent a few hours with the AI, and digging into documentation, and stumbled upon a 2 day old document on Distance Measurement Client and Server.

Service Attributes don't work reliably, and since the distance measurement toolbox takes up all the packet bandwidth, I can't do it via advertisements.

I was hoping the author of that might get in touch, or that nordic could provide a simple sample that demonstrates the mesh.

https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/libraries/bluetooth/mesh/vnd/dm_srv.html

Furthermore, I wanted to ask if it might be possible to have the DM CLI run on the server 1?

I don't want to have to get a second chip just to send my whole network CLI commands.

Happy New Year, and Thank you!

Parents
  • After 4 days of struggling and a ton of assistance from Claude (Anthropic's AI chat bot) and nRF's own AI, I finally got it.

    My approach involved using a shorter UUID (appropriate for my application), which gave space to transmit the data from other nrf_dm devices to the primary one.

    I'm including the source files here for anyone else. This is the starting point for doing trilateration.

    To use them, copy the nordic dm sample in visual studio (https://github.com/nrfconnect/sdk-nrf/tree/main/samples/bluetooth/nrf_dm)

    Then just replace all the files with these ones.

    I was able to get this working on 3 x nRF52840 dongles.

    nrfMultiDistance.zip

    CmakeLists.txt:

    #
    # Copyright (c) 2021 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    cmake_minimum_required(VERSION 3.20)
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(nrf_dm)
    
    # NORDIC SDK APP START
    target_sources(app PRIVATE
      src/main.c
      src/pwm_led.c
      src/peer.c
      src/service.c
      src/claude.c
      )
    # NORDIC SDK APP END
    
    zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR})

    prj.conf:

    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # BT
    CONFIG_BT=y
    
    CONFIG_BT_CENTRAL=y
    CONFIG_BT_PERIPHERAL=y
    
    CONFIG_BT_SCAN=y
    CONFIG_BT_SCAN_FILTER_ENABLE=y
    CONFIG_BT_SCAN_NAME_CNT=1
    CONFIG_BT_SCAN_MANUFACTURER_DATA_CNT=1
    CONFIG_BT_SCAN_WITH_IDENTITY=y
    CONFIG_BT_ID_MAX=1
    
    CONFIG_BT_EXT_ADV=y
    
    CONFIG_BT_DDFS=y
    
    # Distance Measurement
    CONFIG_DM_MODULE=y
    
    CONFIG_MPSL=y
    CONFIG_MPSL_TIMESLOT_SESSION_COUNT=1
    
    CONFIG_DM_MODULE_LOG_LEVEL_DBG=n
    CONFIG_DM_GPIO_DEBUG=y
    CONFIG_PWM=y
    
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    CONFIG_DK_LIBRARY=y
    
    CONFIG_DM_HIGH_PRECISION_CALC=y
    

    , once I finish with a solid implementation, would nordic be interested in the source code to publish it?

    I feel this is something a lot of aspiring engineers think is something trivial, only to get stuck in the nitty gritty of ble. Would have helped me a lot.

Reply
  • After 4 days of struggling and a ton of assistance from Claude (Anthropic's AI chat bot) and nRF's own AI, I finally got it.

    My approach involved using a shorter UUID (appropriate for my application), which gave space to transmit the data from other nrf_dm devices to the primary one.

    I'm including the source files here for anyone else. This is the starting point for doing trilateration.

    To use them, copy the nordic dm sample in visual studio (https://github.com/nrfconnect/sdk-nrf/tree/main/samples/bluetooth/nrf_dm)

    Then just replace all the files with these ones.

    I was able to get this working on 3 x nRF52840 dongles.

    nrfMultiDistance.zip

    CmakeLists.txt:

    #
    # Copyright (c) 2021 Nordic Semiconductor
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    cmake_minimum_required(VERSION 3.20)
    
    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
    project(nrf_dm)
    
    # NORDIC SDK APP START
    target_sources(app PRIVATE
      src/main.c
      src/pwm_led.c
      src/peer.c
      src/service.c
      src/claude.c
      )
    # NORDIC SDK APP END
    
    zephyr_library_include_directories(${CMAKE_CURRENT_SOURCE_DIR})

    prj.conf:

    #
    # Copyright (c) 2021 Nordic Semiconductor ASA
    #
    # SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
    #
    
    # BT
    CONFIG_BT=y
    
    CONFIG_BT_CENTRAL=y
    CONFIG_BT_PERIPHERAL=y
    
    CONFIG_BT_SCAN=y
    CONFIG_BT_SCAN_FILTER_ENABLE=y
    CONFIG_BT_SCAN_NAME_CNT=1
    CONFIG_BT_SCAN_MANUFACTURER_DATA_CNT=1
    CONFIG_BT_SCAN_WITH_IDENTITY=y
    CONFIG_BT_ID_MAX=1
    
    CONFIG_BT_EXT_ADV=y
    
    CONFIG_BT_DDFS=y
    
    # Distance Measurement
    CONFIG_DM_MODULE=y
    
    CONFIG_MPSL=y
    CONFIG_MPSL_TIMESLOT_SESSION_COUNT=1
    
    CONFIG_DM_MODULE_LOG_LEVEL_DBG=n
    CONFIG_DM_GPIO_DEBUG=y
    CONFIG_PWM=y
    
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    CONFIG_DK_LIBRARY=y
    
    CONFIG_DM_HIGH_PRECISION_CALC=y
    

    , once I finish with a solid implementation, would nordic be interested in the source code to publish it?

    I feel this is something a lot of aspiring engineers think is something trivial, only to get stuck in the nitty gritty of ble. Would have helped me a lot.

Children
No Data
Related