LED Control using Proximity on NRF52811 evaluation Board (ublox BMD 360)

Hello Everyone, 

I am using  NRF52811 evaluation board  for my development purpose using SDK 2.6.1 on visual studio code. 

My tasks involve LED control using Bluetooth as follows.

task 1: Turn on/off LEDs using button press on user device(NRF connect on android phone)

task 2: turn on/off LEDs using distance of 5 meter Exceed: for example LED should turn on in distance of 5 meter or less.

I have already  implemented task 1 but can anyone guide me how I can connect and control LEDs  in accordance with the distance. 

Id there any example available which I can use to connect to my  nrf52811 BLE board  and control LED   using distance. 

  • Calculating distance can be done two ways.

    1. Use the Distance Measurement lib which is a proprietary way to calculate the distance. You can try this using the sample provided here and some discussions in this forum like this one can be found.
    2. Use obtained RSSI value to evaluate a very rough estimate of the distance and change the LED status at whichever RSSI you find is the proper range for a given distance.
  • Hello Thank For your response. I am trying to implement the solution suggest by you using DM library. I am using bmd360 evaultion kit which has nRF52811 soc and  using build configuration nRF52840 DK nRF52811 . and i am  getting following error.  Can you help me to solve it. i have set necessary flag in proj.conf same as mentioned in sample.am i missing some more flag to set or reset ?

    -- west build: generating a build system
    Loading Zephyr default modules (Zephyr base).
    -- Application: C:/gd_ws/keyless-access-system-ble/ble_application
    -- CMake version: 3.21.0
    -- Found Python3: C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe (found suitable version "3.9.13", minimum required is "3.8") found components: Interpreter
    -- Cache files will be written to: C:/ncs/v2.6.1/zephyr/.cache
    -- Zephyr version: 3.5.99 (C:/ncs/v2.6.1/zephyr)
    -- Found west (found suitable version "1.2.0", minimum required is "0.14.0")
    -- Board: nrf52840dk_nrf52811
    -- Found host-tools: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.5 (C:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk)
    -- Found Dtc: C:/ncs/toolchains/cf2149caf2/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found BOARD.dts: C:/ncs/v2.6.1/zephyr/boards/arm/nrf52840dk_nrf52811/nrf52840dk_nrf52811.dts
    -- Generated zephyr.dts: C:/gd_ws/keyless-access-system-ble/ble_application/build/zephyr/zephyr.dts
    -- Generated devicetree_generated.h: C:/gd_ws/keyless-access-system-ble/ble_application/build/zephyr/include/generated/devicetree_generated.h
    -- Including generated dts.cmake file: C:/gd_ws/keyless-access-system-ble/ble_application/build/zephyr/dts.cmake

    warning: Deprecated symbol BT_DEBUG_LOG is enabled.


    warning: Deprecated symbol BT_DEBUG_LOG is enabled.


    warning: Experimental symbol BT_DDFS is enabled.


    warning: Experimental symbol DM_MODULE is enabled.


    warning: Experimental symbol NRF_DM is enabled.


    warning: FPU (defined at soc/arm/nxp_imx/mcimx6x_m4/Kconfig.defconfig.mcimx6x_m4:11, soc/arm/nxp_s32/s32k3\Kconfig.defconfig.s32k344:11, soc/arm/nxp_s32\s32ze\Kconfig.defconfig.series:15, soc/arm\renesas_rzt2m\Kconfig.defconfig:15, arch/Kconfig:847) has direct dependencies (SOC_MCIMX6X_M4 && SOC_SERIES_IMX_6X_M4) || (SOC_S32K344 && SOC_SERIES_S32K3XX) || SOC_SERIES_S32ZE_R52 || SOC_RENESAS_RZT2M || CPU_HAS_FPU with value n, but is currently being y-selected by the following symbols:
    - NRF_DM (defined at C:/ncs/v2.6.1/nrfxlib\nrf_dm/Kconfig:7), with value y, direct dependencies y (value: y), and select condition !SOC_NRF5340_CPUNET (value: y)

    error: Aborting due to Kconfig warnings

    Parsing C:/ncs/v2.6.1/zephyr/Kconfig
    Loaded configuration 'C:/ncs/v2.6.1/zephyr/boards/arm/nrf52840dk_nrf52811/nrf52840dk_nrf52811_defconfig'
    Merged configuration 'C:/gd_ws/keyless-access-system-ble/ble_application/prj.conf'
    CMake Error at C:/ncs/v2.6.1/zephyr/cmake/modules/kconfig.cmake:358 (message):
    command failed with return code: 1
    Call Stack (most recent call first):
    C:/ncs/v2.6.1/nrf/cmake/modules/kconfig.cmake:29 (include)
    C:/ncs/v2.6.1/zephyr/cmake/modules/zephyr_default.cmake:129 (include)
    C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
    C:/ncs/v2.6.1/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
    CMakeLists.txt:2 (find_package)


    -- Configuring incomplete, errors occurred!
    FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\cf2149caf2\opt\bin\cmake.EXE' -DWEST_PYTHON=C:/ncs/toolchains/cf2149caf2/opt/bin/python.exe '-Bc:\gd_ws\keyless-access-system-ble\ble_application\build' -GNinja -DBOARD=nrf52840dk_nrf52811 -DNCS_TOOLCHAIN_VERSION=NONE '-Sc:\gd_ws\keyless-access-system-ble\ble_application'

    * The terminal process terminated with exit code: 1.
    * Terminal will be reused by tasks, press any key to close it.

  • Hi

    I'm sorry, but the nRF Distance Measurement sample and library won't be possible to use on the nRF52811. One because the application won't fit onto the limited RAM and Flash memory of the nRF52811 and two because the application requires FPU, which the nRF52811 doesn't have, and is the reason you're seeing this build error I think.

    Also, the Android phones won't be able to do Distance Measurement I'm afraid, as it is a Nordic proprietary protocol, so then you're left with using plain old RSSI for determining the distance between the two, which is not very accurate I'm afraid.

    Best regards,

    Simon

  • Hello Simon, 

    Thanks for the response.  My plain idea is to control LED (on/off) using NRF connect app based  on input from app which I am able to successfully. Now i want to to extend it using some kind of proximity (does not matter rssi or angle or arrival or something similar) can you tell me how can i do it.  Here  is my sample implementation for you reference. .

    My nrF52811 evl. kit act as a peripheral and advertise data. with the nrf connect app  I  make to connection to it and controls the LED.  works fine. Now I want to extend it such way that  once the  nrf connect app (on my andrio phone) comes in a close proximity of my nRF52811 kit, It should autometiclly  turn on the LED.7345.ble_application.zip

  • Hi Bhavin

    This is a question asked countless times on DevZone already, and you can check out this ticket where Edvin suggests how to get it over advertising reports. You can also look at various DevZone tickets on RSSI here

    Best regards,

    Simon

Related