Sleep Options

Sleep Modes

Coordinators and Routers are not capable of sleeping, only End Devices can enter into a low-power state to safe battery and wake up when needed to transmit or receive data.

There are two sleep modes: pin sleep and cyclic sleep.

Pin Sleep

This mode is used to wake and sleep the module using a hardware pin. When the pin is asserted, the module enters to sleep after ending any transmission or reception in process. In the case the module has not joined a network, it will sleep after joining a network.

When a joined end device wakes up from a pin sleep, it sends a poll request to its parent to see if the parent has buffered data for the end device. The end device will continue to send poll requests every 100ms while it remains awake.

Cyclic Sleep

Cyclic sleep allows modules to wake up periodically to check for RF data and sleep when idle. In cyclic sleep mode, if serial or RF data is received, the module will start an inactivity timer and remain awake until this timer expires. While the module is awake, it will continue to send poll request transmissions to its parent to check for buffered data every 100ms. The timer will be restarted anytime serial or RF data is received. The module will resume sleep when the timer expires.

Sleep Parameters

There are some parameters involved in setting an End Device to sleep.

Sleep Mode

Sets the sleep mode for a module. Its available values are:

• 0: Sleep disabled. When using this mode, the module operates as a router. • 1: Pin sleep enabled. • 4: Cyclic Sleep enabled. • 5: Cyclic Sleep with Pin awake enabled.

When 'Sleep Mode' changes to a non-zero value, the node leaves the PAN and rejoins it as an End Device.

Example of use:

{
    xbeeZB.setSleepMode(1);
    xbeeZB.getSleepMode();
}

Related variables:

xbeeZB.sleepMode → stores the sleep mode in a module

• Set sleep mode example:

https://development.libelium.com/waspmote/zb-08-set-low-power-mode

Sleep Period

It determines how long a node will sleep continuously with a maximum of 28 seconds. The parent determines how long it will buffer a message for the sleeping device. It should be set at least equal to the longest sleeping value of any children.

Example of use:

{
    uint8_t asleep[3]={0xAF,0x00,0x00};
    xbeeZB.setSleepTime(asleep); // Set Sleep period to 0,32 seconds
}

Related variables:

xbeeZB.sleepTime → stores the sleep period the module will be sleeping

Time Before Sleep

It determines the time a module will be awake waiting before sleeping. It resets each time data is received via RF or serial. Once the timer expires, the device will enter low-power state.

Example of use:

{
    uint8_t awake[3]={0x13,0x88,0x00};
    xbeeZB.setAwakeTime(awake);
}

Related variables:

xbeeZB.awakeTime → stores the time the module remains awake

Number of Sleep Periods

It determines the number of sleep periods to not assert the On/Sleep pin on wakeup if no RF data is waiting for the end device.

Example of use:

{
    uint8_t periods[2]={0x13,0x88};
    xbeeZB.setPeriodSleep(periods);
}

Related variables:

xbeeZB.periodSleep → stores the number of sleep periods

Sleep Options

It configures options for sleeping modes. Possible values are:

  • 0x02 : Always awake for 'Time Before Sleep' time.

  • 0x04 : Sleep entire 'Number of Sleep Periods' * 'Sleep Period' time.

Example of use:

{
    xbeeZB.setSleepOptions(0x02);
}

Related variables:

xbeeZB.sleepOptions → stores the sleep option chosen

Last updated