Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions samples/light_switch/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,10 @@ config LIGHT_SWITCH_TX_POWER
default 0
help
TX power level in dBm.

config LIGHT_SWITCH_LOW_POWER
bool "Low power mode"
default n
help
Enable low power mode for the Light Switch sample.
This enables sleepy behavior and disables LEDs for power savings.
32 changes: 25 additions & 7 deletions samples/light_switch/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ The light switch supports the :ref:`zigbee_ug_sed` that enables the sleepy behav
.. group-tab:: nRF54L15 DK

To enable the sleepy behavior, press **Button 2** while the light switch sample is booting.
.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

To enable the sleepy behavior, press **Button 3** while the light switch sample is booting.

Expand Down Expand Up @@ -145,6 +145,24 @@ For more information about configuration files in the |NCS|, see `Build and conf

.. include:: /includes/sample_fem_support.txt

Snippets
========

.. |snippet| replace:: :makevar:`light_switch_SNIPPET`

The following snippets are available:

* ``low_power`` - Enables low power consumption mode for the Light Switch sample.
This snippet disables serial communication, console output, enables sleepy end device behavior,
and disables LED indications to minimize power consumption.

To build with the low power snippet, use the following command:

.. parsed-literal::
:class: highlight

west build samples/light_switch -b *board_target* -- --snippet=low_power

Configurable transmission power
===============================

Expand Down Expand Up @@ -191,7 +209,7 @@ User interface
The length of the button press can be edited using the ``CONFIG_FACTORY_RESET_PRESS_TIME_SECONDS`` Kconfig option from :ref:`lib_zigbee_application_utilities`.
Releasing the button within this time does not trigger the factory reset procedure.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

LED 3:
Lit and solid when the device is connected to a Zigbee network.
Expand Down Expand Up @@ -230,7 +248,7 @@ FOTA behavior assignments
Indicates the OTA activity.
Used only if the FOTA support is enabled.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

LED 2:
Indicates the OTA activity.
Expand All @@ -246,7 +264,7 @@ Sleepy End Device behavior assignments
Button 2:
When pressed while resetting the kit, enables the :ref:`zigbee_ug_sed`.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

Button 3:
When pressed while resetting the kit, enables the :ref:`zigbee_ug_sed`.
Expand All @@ -262,7 +280,7 @@ Multiprotocol Bluetooth LE extension assignments
Lit and solid when a Bluetooth LE Central is connected to the NUS service.
Available when using `Nordic UART Service (NUS)`_ in the multiprotocol configuration.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

LED 1:
Lit and solid when a Bluetooth LE Central is connected to the NUS service.
Expand Down Expand Up @@ -319,7 +337,7 @@ After programming the sample to your development kits, complete the following st

This LED indicates that the light switch found a light bulb to control.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

1. Turn on the development kit that runs the Network coordinator sample.

Expand Down Expand Up @@ -396,7 +414,7 @@ Set up nRF Toolbox by completing the following steps:

Observe that **LED 0** on the light switch node is solid.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

Observe that **LED 1** on the light switch node is solid.

Expand Down
20 changes: 20 additions & 0 deletions samples/light_switch/sample.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,3 +93,23 @@ tests:
- smoke
- sysbuild
- ci_samples_zigbee
sample.zigbee.light_switch.low_power:
sysbuild: true
build_only: true
extra_args:
- light_switch_SNIPPET="low_power"
integration_platforms:
- nrf54l15dk/nrf54l15/cpuapp
- nrf54l15dk/nrf54l10/cpuapp
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
platform_allow:
- nrf54l15dk/nrf54l15/cpuapp
- nrf54l15dk/nrf54l10/cpuapp
- nrf52840dk/nrf52840
- nrf5340dk/nrf5340/cpuapp
tags:
- ci_build
- smoke
- sysbuild
- ci_samples_zigbee
24 changes: 24 additions & 0 deletions samples/light_switch/snippets/low_power/low_power.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#
# Copyright (c) 2025 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

# Low power configuration for Zigbee Light Switch
CONFIG_LIGHT_SWITCH_LOW_POWER=y

# Disable serial and console for power savings
CONFIG_SERIAL=n
CONFIG_CONSOLE=n

# Disable logging for additional power savings
CONFIG_LOG=n

# Set TX power to 0 dBm
CONFIG_LIGHT_SWITCH_TX_POWER=0

# Enable device power management for low power consumption
CONFIG_PM_DEVICE=y

# Ensure RAM power down is enabled for low power consumption
CONFIG_RAM_POWER_DOWN_LIBRARY=y
9 changes: 9 additions & 0 deletions samples/light_switch/snippets/low_power/snippet.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#
# Copyright (c) 2025 Nordic Semiconductor
#
# SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
#

name: low_power
append:
EXTRA_CONF_FILE: low_power.conf
42 changes: 29 additions & 13 deletions samples/light_switch/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@

LOG_MODULE_REGISTER(app, LOG_LEVEL_INF);

/* Helper functions for LED control in low power mode */
#if CONFIG_LIGHT_SWITCH_LOW_POWER
static inline void led_set(uint32_t led, uint32_t val) { ARG_UNUSED(led); ARG_UNUSED(val); }
static inline void led_set_on(uint32_t led) { ARG_UNUSED(led); }
static inline void led_set_off(uint32_t led) { ARG_UNUSED(led); }
#else
static inline void led_set(uint32_t led, uint32_t val) { dk_set_led(led, val); }
static inline void led_set_on(uint32_t led) { dk_set_led_on(led); }
static inline void led_set_off(uint32_t led) { dk_set_led_off(led); }
#endif

struct bulb_context {
zb_uint8_t endpoint;
zb_uint16_t short_addr;
Expand Down Expand Up @@ -319,10 +330,12 @@ static void configure_gpio(void)
LOG_ERR("Cannot init buttons (err: %d)", err);
}

#if !CONFIG_LIGHT_SWITCH_LOW_POWER
err = dk_leds_init();
if (err) {
LOG_ERR("Cannot init LEDs (err: %d)", err);
}
#endif
}

static void alarm_timers_init(void)
Expand Down Expand Up @@ -350,7 +363,7 @@ static void toggle_identify_led(zb_bufid_t bufid)
{
static int blink_status;

dk_set_led(IDENTIFY_LED, (++blink_status) % 2);
led_set(IDENTIFY_LED, (++blink_status) % 2);
ZB_SCHEDULE_APP_ALARM(toggle_identify_led, bufid, ZB_MILLISECONDS_TO_BEACON_INTERVAL(100));
}

Expand All @@ -372,9 +385,9 @@ static void identify_cb(zb_bufid_t bufid)

/* Update network status/idenitfication LED. */
if (ZB_JOINED()) {
dk_set_led_on(ZIGBEE_NETWORK_STATE_LED);
led_set_on(ZIGBEE_NETWORK_STATE_LED);
} else {
dk_set_led_off(ZIGBEE_NETWORK_STATE_LED);
led_set_off(ZIGBEE_NETWORK_STATE_LED);
}
}
}
Expand Down Expand Up @@ -458,7 +471,7 @@ static void find_light_bulb_cb(zb_bufid_t bufid)
bulb_ctx.endpoint);

k_timer_stop(&bulb_ctx.find_alarm);
dk_set_led_on(BULB_FOUND_LED);
led_set_on(BULB_FOUND_LED);
} else {
LOG_INF("Bulb not found, try again");
}
Expand Down Expand Up @@ -567,7 +580,7 @@ static void ota_evt_handler(const struct zigbee_fota_evt *evt)
{
switch (evt->id) {
case ZIGBEE_FOTA_EVT_PROGRESS:
dk_set_led(OTA_ACTIVITY_LED, evt->dl.progress % 2);
led_set(OTA_ACTIVITY_LED, evt->dl.progress % 2);
break;

case ZIGBEE_FOTA_EVT_FINISHED:
Expand Down Expand Up @@ -706,13 +719,13 @@ static void decrease_cmd(struct k_work *item)
static void on_nus_connect(struct k_work *item)
{
ARG_UNUSED(item);
dk_set_led_on(NUS_STATUS_LED);
led_set_on(NUS_STATUS_LED);
}

static void on_nus_disconnect(struct k_work *item)
{
ARG_UNUSED(item);
dk_set_led_off(NUS_STATUS_LED);
led_set_off(NUS_STATUS_LED);
}

static struct nus_entry commands[] = {
Expand Down Expand Up @@ -825,15 +838,18 @@ int main(void)
/* Set default bulb short_addr. */
bulb_ctx.short_addr = 0xFFFF;

/* If "sleepy button" is defined, check its state during Zigbee
* initialization and enable sleepy behavior at device if defined button
* is pressed.
/* Check if sleepy button is pressed during Zigbee initialization
* and enable sleepy behavior. In low power mode, always enable sleepy behavior.
*/
#if defined BUTTON_SLEEPY
if (dk_get_buttons() & BUTTON_SLEEPY) {
#if CONFIG_LIGHT_SWITCH_LOW_POWER
bool enable_sleepy = true;
#else
bool enable_sleepy = (dk_get_buttons() & BUTTON_SLEEPY) ? true : false;
#endif

if (enable_sleepy) {
zigbee_configure_sleepy_behavior(true);
}
#endif

/* Power off unused sections of RAM to lower device power consumption. */
if (IS_ENABLED(CONFIG_RAM_POWER_DOWN_LIBRARY)) {
Expand Down
6 changes: 3 additions & 3 deletions samples/ncp/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ The communication channel uses Zephyr's `UART API`_.

The ``uart20`` pins are configured by devicetree overlay files for each supported development kit in the :file:`boards` directory.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

The serial device is selected in devicetree like this:

Expand Down Expand Up @@ -288,7 +288,7 @@ User interface
.. group-tab:: nRF54L15 DK

All the NCP sample's interactions with the application are automatically handled using serial communication.
.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

All the NCP sample’s interactions with the application are automatically handled using serial or USB communication.

Expand Down Expand Up @@ -333,7 +333,7 @@ After building the sample and programming it to your development kit, complete t
When it is found, the simple gateway configures bindings and reporting for the device.
It then starts sending On/Off toggle commands with a 15-second interval that toggle the **LED 1** on the light bulb on and off.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

1. Download and extract the `ZBOSS NCP Host`_ package.

Expand Down
4 changes: 2 additions & 2 deletions samples/network_coordinator/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ User interface
The length of the button press can be edited using the ``CONFIG_FACTORY_RESET_PRESS_TIME_SECONDS`` Kconfig option from :ref:`lib_zigbee_application_utilities`.
Releasing the button within this time does not trigger the factory reset procedure.

.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

LED 1:
Blinks to indicate that the main application thread is running.
Expand Down Expand Up @@ -151,7 +151,7 @@ After programming the sample to your development kit, complete the following ste
#. Use buttons on the development kit that runs the Light switch sample to control the light bulb, as described in the Light switch sample's user interface section.

The result of using the buttons is reflected on the light bulb's **LED 1**.
.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

1. Turn on the development kit that runs the coordinator sample.

Expand Down
4 changes: 2 additions & 2 deletions samples/shell/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ User interface

Button 3:
Starts or cancels the Identify mode.
.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

LED 3:
Turns on when the device joins the network.
Expand All @@ -92,7 +92,7 @@ User interface

Button 4:
Starts or cancels the Identify mode.
.. group-tab:: nRF52840 and nRF5340 DKs Dongle
.. group-tab:: nRF52840 Dongle

LED 1:
Blinks green to indicate that the identification mode is on.
Expand Down
4 changes: 2 additions & 2 deletions samples/template/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ User interface
* If pressed for five seconds, it initiates the `factory reset of the device <Resetting to factory defaults_>`_.
The length of the button press can be edited using the ``CONFIG_FACTORY_RESET_PRESS_TIME_SECONDS`` Kconfig option from :ref:`lib_zigbee_application_utilities`.
Releasing the button within this time does not trigger the factory reset procedure.
.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

LED 3:
Turns on when the device joins the network.
Expand Down Expand Up @@ -108,7 +108,7 @@ After programming the sample to your development kit, complete the following ste

.. note::
If **LED 2** does not turn on, press **Button 0** on the Coordinator to reopen the network.
.. group-tab:: nRF52840 and nRF5340 DKs DK
.. group-tab:: nRF52840 and nRF5340 DKs

1. Turn on the development kit that runs the Network coordinator sample.

Expand Down