Manage End Devices Sleep examples
Digi XBee® 3 Zigbee® RF Module
165
Sleep examples
Some sample XBee configurations to support different sleep modes follow. In Command mode, issue
each command with a leading AT and no = sign, for example, ATSM4. In the API, the two byte
command is used in the command field, and parameters are populated as binary values in the
parameter field.
Example 1: Configure a device to sleep for 20 seconds, but set SN
such that the On/sleep line will remain de-asserted for up to 1
minute.
The following settings should be configured on the end device.
n SM = 4 (cyclic sleep) or 5 (cyclic sleep, pin wake).
n SP = 0x7D0 (2000 decimal). This causes the end device to sleep for 20 seconds since SP is
measured in units of 10 ms.
n SN = 3. (With this setting, the On/Sleep pin asserts once every 3 sleep cycles, or when it
receives RF data) SO = 0.
Set all router and coordinator devices on the network SP to match SP on the end device. This set the
RF packet buffering times and transmission timeouts correctly.
Since the end device wakes after each sleep period (SP), you can set the SN command to 1 on all
routers and the coordinator.
Example 2: Configure an end device to sleep for 20 seconds, send 4
I/O samples in 2 seconds, and return to sleep.
Because SP is measured in 10 ms units, and ST and IR are measured in 1 ms units, configure an end
device with the following settings:
n SM = 4 (cyclic sleep) or 5 (cyclic sleep, pin wake).
n SP = 0x7D0 (2000 decimal). This causes the end device to sleep for 20 seconds.
n SN = 1.
n SO = 0.
n ST = 0x7D0 (2000 decimal). This sets the sleep timer to 2 seconds.
n IR = 0x258 (600 decimal). Set IR to a value greater than (2 seconds / 4) to get 4 samples in 2
seconds. The end device sends an I/O sample at the IR rate until the sleep timer has expired.
You must enable at least one analog or digital I/O line for I/O sampling to work. To enable AD1/DIO1
(Micro pin 30/SMT pin 32/TH pin 19) as a digital input line, you must set the following:
D1 = 3
Set all router and coordinator devices on the network SP to match SP on the end device. This ensures
that RF packet buffering times and transmission timeouts are set correctly.