ZigBee Power Management using Pin Sleep example for mbed XBeeLib By Digi

Dependencies:   XBeeLib mbed

You are viewing an older revision! See the latest version

Homepage

ZigBee Pin Sleep Power Management Mode Example

description

This example characterizes a device that after taking samples from some sensors and sending the information collected through the radio does nothing for a long period of time that could range from some minutes to some hours.
In that long period of inactivity it's not expected to have communication with the coordinator, the device will not be able to receive packets and it's desired to save as much power as possible; for that, ther radio is set into low power.

The example does following cycle endlessly:

  • Some sensor is read. For demonstration, a counter is incremented.
  • For demonstration, a message containing the data collected during sampling stage is sent to the coordinator.
  • After job has been done the radio will go to sleep:
  • First radio is requested to go to sleep. When radio finally sleeps, then the application waits for the time configured in the SLEEP_SECONDS define (40 seconds).
  • This time can be increased as desired.
  • After that time, the application will awake the radio through the On/Sleep pin and another cycle will start by taking a sample.

setup

Hardware

The example is preconfigured to use a Arch-Pro board. Feel free to use any other board just changing the pin defines in the example.

It's necessary to wire following connections from the cpu to the XBee radio:

  • sleep_req: From the cpu SLEEP_REQ_PIN (pin P0_4) to the radio SLEEP_RQ pin (pin 9) will allow the cpu to request the radio to sleep or awake.
  • on_sleep: From the cpu ON_SLEEP_PIN (pin P0_5) to radio ON/SLEEP# pin (pin 13) will allow the cpu to know if the radio is awaked or sleept.

Firmware

Warning

Router firmware will not work for this example, because routers don't support sleep modes.
To flash a new firmware into an XBee module, you need to use the X-CTU software.

Warning

Make sure the coordinator has at 'Cyclic Sleep Period' (SP) and at 'Number of Cyclic Sleep Periods' (SN) options values so (3*SP*10*SN) is greater than the XBee module sleep time (in this example 40s = 40000mS).

If SP parameter in coordinator is pre-established for example to 0x1F4=500 based on other devices requirements, SN should be configured in coordinator for this example as:

  • MaxPinSleepTime= 3*SP*10*SN
  • SN= MaxPinSleepTime/3/SP/10
  • SN = 40000 / 3 / 500 / 10 = 2.666 -> Rounding high -> 3 = 0x3

Remember to change this parameter in the coordinator if SLEEP_SECONDS is changed in the example.

demo run

While it is running, you will see the frames sent by the XBee module through the serial console terminal.

Verify that the coordinator is receiving the frames by accessing the "Console" tab of the X-CTU.
If the frames are successfully sent, they will bedisplayed there. One message like the ones below every 40 seconds.
Sensor sample: 0, next sample in 40 seconds
Sensor sample: 1, next sample in 40 seconds


All wikipages