802.15.4 Power Management using Pin Sleep example for mbed XBeeLib By Digi
You are viewing an older revision! See the latest version
Homepage
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 or other remote devices,
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 a remote device.
- 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¶
It's necessary to wire following connections from the cpu to the XBee radio:
- sleep_req: From the cpu SLEEP_REQ_PIN to the XBee module SLEEP_RQ pin (pin 9 on THT modules, pin 10 on SMT modules) will allow the cpu to request the radio to sleep or awake.
- on_sleep: From the cpu RADIO_ON_SLEEP to XBee module ON/SLEEP# pin (pin 13 on THT modules, pin 26 on SMT modules) will allow the cpu to know if the radio is awake or slept.
Demo run¶
While it is running, you will see the frames sent by the XBee module through the serial console terminal.
Verify that the remote device 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