Power Management

Last Updated on : 2023-05-12 08:08:02download

This topic describes power management for NB-IoT devices, which can be adopted to ensure power consumption is minimized.

Background

NB-IoT is well suited for devices and applications that require low throughput and bandwidth, long battery life, and low mobility. NB-IoT supports three power-saving modes:

  • PSM: Power saving mode
  • DRX: Discontinuous reception
  • eDRX: Extended DRX

PSM and eDRX are critical technologies to enable the NB-IoT network to handle massive low power devices.

Power management

PSM

A device enters deep sleep mode during the non-service period, without receiving downstream data. It receives the downlink data cached by the Tuya IoT Development Platform only after sending uplink data (mobile originated data) to the platform.

In PSM, the radio module on the device is turned off, which is similar to power-off. But, the device remains registered with the network, so when it turns back to idle or connected mode, there is no need to re-attach with a packet data network (PDN) connection.

PSM is suited for downlink latency-tolerant and battery-powered applications, for example, smart metering.

Power Management

  • Active: The module is in active status. All functions of the module are available and all processors are active. Radio transmission and reception can be performed. Transitions to Idle mode or PSM can be initiated.

  • Idle: The module is in the light sleep status, a network connection is maintained, and paging messages can be received. Transitions to Active mode or PSM can be initiated.

  • PSM: The module is in the deep sleep status and only the RTC is working. The network is disconnected and thus paging messages cannot be received. When the timer expires, the module is woken up. Alternatively, pull down PSM_EINT to wake up the module from PSM.

    Power Management

eDRX

eDRX provides a balanced trade-off between latency and battery lifetime. In each eDRX cycle, the device can receive downlink data in the preset paging time window (PTW). In between the PTWs, the module is in deep sleep and not reachable. eDRX provides a good compromise between device reachability and power consumption. An example service is remote gas shut-off.

Power Management

In each eDRX cycle, there is a PTW. The device listens to the paging channel to receive downlink traffic according to the DRX cycle in the PTW. Between two consecutive PTWs, the device enters sleep mode.

In eDRX mode, the device is considered reachable at any time, but with a relatively long latency that is determined by an eDRX cycle. You can adjust a tradeoff between the energy saving and the latency incurred in downlink communication.

DRX

In DRX mode, downlink data can reach the device at any time. In each DRX cycle, the device checks if downlink data arrives. This mode is suitable for services with low delay tolerance. Typically, the device is mains-powered, for example, the street lights.

Power Management

The DRX cycle is short, which can be 1.28s, 2.56s, 5.12s, or 10.24s, depending on the APN specified by the carrier. Therefore, it is considered that the downlink data can arrive at any time with low latency.

DRX mode consumes more power. Generally, you can apply this mode to mains-powered devices with high latency sensitivity.

Example

// Set the device's operation mode.
tuya_user_api_sim_mode_set("PSM");
// Set the lifetime.
tuya_user_api_lifetime_set(600);

API description

Set the operation mode

Function prototype OPERATE_RET tuya_user_api_sim_mode_set (IN char* mode)
Parameter mode: The low power mode to be set for the SIM card.
Description Set the operation mode of the NB-IoT device, which can be PSM, DRX, or EDRX.
Header file #include <tuya_user_api.h>
Return value
  • OPRT_OK: Success.
  • Other values: Failure. The return value is invalid.

The valid values of mode are psm, drx, and edrx in lowercase or PSM, DRX, and EDRX in uppercase. A mix of uppercase and lowercase letters such as Psm is invalid. The string literally represents the power mode.

Get the current operation mode

Function prototype nbiot_mode_t tuya_user_api_sim_mode_get (void)
Parameter None
Description Get the current operation mode
Header file #include <tuya_user_api.h>
Return value The current operation mode of the NB-IoT device. For more information, see the nbiot_mode_t enum.

Description

nbiot_mode_t enum:

typedef enum {
  NBIoT_MODE_PSM,      //PSM mode
  NBIoT_MODE_DRX,      //DRX mode
  NBIoT_MODE_EDRX      //eDRX mode
} nbiot_mode_t;

Disable sleep mode

Function prototype void tuya_user_api_psm_disable (void)
Parameter None
Description Disable the device to enter sleep mode.
Header file #include <tuya_user_api.h>
Return value None

Enable sleep mode

Function prototype void tuya_user_api_psm_enable (void)
Parameter None
Description Enable the device to enter sleep mode.
Header file #include <tuya_user_api.h>
Return value None

Disable the power saving lock

Function prototype void tuya_user_api_enter_psm (void)
Parameter None
Description Disable the power saving lock to enable the NB-IoT device to enter sleep mode.
Header file #include <tuya_user_api.h>
Return value None

For more information, see NB-IoT Solution.