# Forcing sleep mode when out of range

**URL:** <https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431>\
**Category:** XBee - Zigbee\
**Created:** [March 1, 2011, 7:48am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431 "2011-03-01T07:48:16Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![GianfrancoPa](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GianfrancoPa](https://forums.digi.com/u/GianfrancoPa)\
**Post date:** [March 1, 2011, 7:48am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/1 "2011-03-01T07:48:16Z")

</div>

Hi, this is my first post. Thanks in advance for the help.

Explain the situationa: I have a weather station, of which I download the memory of the datalogger via RS232 cable using the PC. Usually I download the memory of data logger once per week (total duration: 10 minutes)

Because the station is in a place not easily accessible, I used the following:

1. meteorological station + Xbee (end device) + socket 232 + battery
2. PC + Xbee (coordinator) + USB shield

It works perfectly, as if the weather station was physically connected to the PC. That way I can download the data logger easily.

Once I download the data, I go away, taking with me the computer (included Xbee coordinator).

Using the tester, I see that when I turn off the PC module, the end device begins to consume a lot of current (much more than when working), while I would like to bring it into sleep mode.

In this way the battery runs out very soon!

In short, how to force the end device to enter sleep mode when the coordinator is out of range (or off), and reactivated when re-power the coordinator?

All this to make the battery last as long as possible.

Thank you and sorry for the bad English!

---

<div class="post-metadata">

**Author:** ![shahrj1988](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@shahrj1988](https://forums.digi.com/u/shahrj1988)\
**Post date:** [March 22, 2011, 4:36am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/2 "2011-03-22T04:36:45Z")

</div>

Hi, one way is to provide the remote AT commands for sleep to your end device, before shutting down your laptop.

---

<div class="post-metadata">

**Author:** ![GianfrancoPa](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GianfrancoPa](https://forums.digi.com/u/GianfrancoPa)\
**Post date:** [March 22, 2011, 6:49am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/3 "2011-03-22T06:49:35Z")

</div>

> Hi, one way is to provide the remote AT commands for sleep to your end device, before shutting down your laptop.

Ok, perfect, but… How can it wake up, if it is sleeping?

---

<div class="post-metadata">

**Author:** ![shahrj1988](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@shahrj1988](https://forums.digi.com/u/shahrj1988)\
**Post date:** [March 22, 2011, 7:42am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/4 "2011-03-22T07:42:13Z")

</div>

Hi, you can give the following AT commands

SM : 5 — Cyclic Sleep PIN- WAKE  
ST : F  
SP : AF0  
SN : Any HEX Value (in the rage of 1 - 0xFFFF)  
SO : 04 (Note: Sleep time = SP \* SN)

With this setting, You can increase the sleep time and remote XBee can wake up as PIN wake up applied at the pin 9 on the XBee.

---

<div class="post-metadata">

**Author:** ![GianfrancoPa](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GianfrancoPa](https://forums.digi.com/u/GianfrancoPa)\
**Post date:** [March 22, 2011, 7:48am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/5 "2011-03-22T07:48:39Z")

</div>

Sorry, but it’s been a long time, I almost forgot the question!

Can I force it into sleep mode, ok, no problem. But as soon as I walk away (or turn off the coordinator), he wakes up and begins to search for the coordinator, consuming a lot of energy!

---

<div class="post-metadata">

**Author:** ![shahrj1988](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@shahrj1988](https://forums.digi.com/u/shahrj1988)\
**Post date:** [March 22, 2011, 7:55am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/6 "2011-03-22T07:55:04Z")

</div>

Ok, Then why dont you try establishing router in between Coordinator and End Device? This problem will be solved.

---

<div class="post-metadata">

**Author:** ![GianfrancoPa](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GianfrancoPa](https://forums.digi.com/u/GianfrancoPa)\
**Post date:** [March 22, 2011, 8:30am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/7 "2011-03-22T08:30:40Z")

</div>

> Ok, Then why dont you try establishing router in between Coordinator and End Device? This problem will be solved.

It’s cheaper build a little circuit with (and, first of all, more powersave), for example, a microcontroller ATmega, in order to force hybernate mode, and wake up it, for example, every minute to check the coordinator avaibility. If coordinator is avaible, it can starts the comunication, otherwise it returns into hybernate mode.

What do you think about?

---

<div class="post-metadata">

**Author:** ![shahrj1988](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@shahrj1988](https://forums.digi.com/u/shahrj1988)\
**Post date:** [March 23, 2011, 4:13am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/8 "2011-03-23T04:13:52Z")

</div>

It will be better to interface controller with your end device XBee, as you can not use Coordinator to send the remote XBee command every time as you explained in your previous posts. But always use the controller which is working on 3.3V.

---

<div class="post-metadata">

**Author:** ![GianfrancoPa](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GianfrancoPa](https://forums.digi.com/u/GianfrancoPa)\
**Post date:** [March 23, 2011, 7:36am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/9 "2011-03-23T07:36:28Z")

</div>

I’ll use an ATmega328P, that functions at 5V, but using an adatpter I’ll be able  
to use 3.3V, too.

I know that I have to adapt the serial DIN from 5V to 3.3v. It’s correct?

---

<div class="post-metadata">

**Author:** ![shahrj1988](https://avatars.discourse-cdn.com/v4/letter/s/c4cdca/32.png) [@shahrj1988](https://forums.digi.com/u/shahrj1988)\
**Post date:** [March 23, 2011, 11:48am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/10 "2011-03-23T11:48:23Z")

</div>

Yes, you need to use both way. For that you can use Bidirectional Buffers/ Transceivers, Precision Operational Amplifiers, or Voltage Divider Circuits.

And as a microcontroller, Youcan use the low power Controller as PIC24F16KA102.

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [March 23, 2011, 2:09pm UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/11 "2011-03-23T14:09:50Z")

</div>

Ok folks. Lets clarify some things.

First, the ZigBee Mesh and Znet 2.5 Mesh based products are not designed for the Coordinator to be roaming. The Coordinator is intended to be stationary.

The best product to use for a Point to point connection for which you have is an XBee 802.15.4 module. This module can sleep on your remote side giving you the longer battery life you need while the always on sleep Coordinator can be connected to your PC and be removed.

---

<div class="post-metadata">

**Author:** ![JoYcEr182](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JoYcEr182](https://forums.digi.com/u/JoYcEr182)\
**Post date:** [May 11, 2011, 3:53pm UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/12 "2011-05-11T15:53:42Z")

</div>

Hi folks, I have more or less the same situation, I have 3 end devices modules (sensing and recording temperature) and 1 coordinator (connected to PC) what I want to do is power the end devices modules with batteries (to remote data logger and battery low consumption), the issue is in the communication form, I always keep the module listening for the detection of a coordinator (this one performance the ATND command and discover the nodes in the XBee network) to download the data recordered by the end device module. On this way the battery life is about two days (I use energizer batteries, and this is the best model that I found Energizer® Ultimate Lithium this one can handle up to 3000mAh) I want to increase the battery life but I could not do.

I have this:

XBee modules (End Devices)  
XB24-Z7CIT-004  
Firmaware  
Modem = XB24-B  
Function Set = ZNet 2.5 Router/End Device AT  
Version = 1247

XStick  
XU-Z11  
Firmware  
Modem = XB24-B  
Function Set = ZNet 2.5 coordinator AT  
Version = 1047

Any suggestion is welcome.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![GianfrancoPa](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GianfrancoPa](https://forums.digi.com/u/GianfrancoPa)\
**Post date:** [May 12, 2011, 5:44am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/13 "2011-05-12T05:44:30Z")

</div>

I think that the best way is use a microcontroller that goes in sleep mode,  
forcing Xbee to sleep when unused

---

<div class="post-metadata">

**Author:** ![JoYcEr182](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JoYcEr182](https://forums.digi.com/u/JoYcEr182)\
**Post date:** [May 12, 2011, 7:19am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/14 "2011-05-12T07:19:22Z")

</div>

Hi GianfrancoPa thank you for your answer. That is actually what I’m doing, I have my end devices connected to a microchip microcontroller 12F683 and in my microcontroller program I force the end device to sleep using the pin hibernate. What I can’t control is wake up the end device when is close enough from the coordinator. My idea of an ideal operation would be, the end device module with a microcontroller record temperature data and stored in an EEPROM memory then goes to sleep, when it is close enough from the coordinator automatically wake up the end device and send all data collected to a PC. I want to safe energy because when the end device finished to collect the data take long to get where is the PC to download that data. Spends to much time in idle mode and I prefer that the end devices stay in sleep mode.

I hope I expressed myself well.

Thanks in advance.

Regards.

---

<div class="post-metadata">

**Author:** ![GianfrancoPa](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GianfrancoPa](https://forums.digi.com/u/GianfrancoPa)\
**Post date:** [May 12, 2011, 7:38am UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/15 "2011-05-12T07:38:12Z")

</div>

It is what I want to do:

You can poll if coordinator is in range, waking up the end device for the minum time that it needs to find the coordinator:

1. if it finds the coordinator you can start to send data and when it finishes it can hibernate and restarts the polling for the next data trasmission session;

2. if it don’t find the coordinator, it returns in hibernate mode and restarts the polling.

In my opinion if you choose a 15/30 sec time polling (or less, depending your needs) you can save a lot of battery…

---

<div class="post-metadata">

**Author:** ![JoYcEr182](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JoYcEr182](https://forums.digi.com/u/JoYcEr182)\
**Post date:** [May 12, 2011, 2:52pm UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/16 "2011-05-12T14:52:02Z")

</div>

Thank you for your answer, but I believe if I do that my communication would not be 100% reliable, let me explain myself better, if I program the end device microcontroller with a poll rate about 15/30 sec I should make it sleep about 3min (it’s my guess for energy saving) ok this is the end device side now for the PC side I should do the same poll rate or something like that because I should do a poll every 15/30 sec and I think there’s a possibility that the end device will not be detected by the coordinator, the end device spend much time sleeping than waking up.

I don’t know if I miss some considerations or if I drowning in a glass of water but that possibility drives me crazy.

I hope you can open my mind or tell me any idea to do my goal.

Thank you.

---

<div class="post-metadata">

**Author:** ![mvut](https://sea2.discourse-cdn.com/flex016/user_avatar/forums.digi.com/mvut/32/31_2.png) [@mvut](https://forums.digi.com/u/mvut)\
**Post date:** [May 12, 2011, 2:57pm UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/17 "2011-05-12T14:57:13Z")

</div>

The product you are using is designed as such that the Coordinator is not intended to be roaming. It is intended for it to remain in place. What I would recommend is to switch to the XBee 802.15.4 product instead. This way, your end device can still sleep but it does not require a Coordinator. Nor does it require a Coordinator to sleep. It is also designed for t he simple point to point connection you are referring to.

---

<div class="post-metadata">

**Author:** ![JoYcEr182](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JoYcEr182](https://forums.digi.com/u/JoYcEr182)\
**Post date:** [May 12, 2011, 3:32pm UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/18 "2011-05-12T15:32:06Z")

</div>

Hi mvut thank you for your opinion, my coordinator is fixed to PC (always remain in the same place) the end devices always are moving and the download operation takes place when the coordinator detects any end device.

I can’t replace the XBee series 2 that I have with XBee 802.15.4 because it’s so hard to me buy pieces from my country to another I did it once and I bought a few XBee series 2.

Thank you.

---

<div class="post-metadata">

**Author:** ![GianfrancoPa](https://avatars.discourse-cdn.com/v4/letter/g/2acd7d/32.png) [@GianfrancoPa](https://forums.digi.com/u/GianfrancoPa)\
**Post date:** [May 12, 2011, 4:52pm UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/19 "2011-05-12T16:52:23Z")

</div>

Where you need power saving? End device or coordinator?

---

<div class="post-metadata">

**Author:** ![JoYcEr182](https://avatars.discourse-cdn.com/v4/letter/j/b77776/32.png) [@JoYcEr182](https://forums.digi.com/u/JoYcEr182)\
**Post date:** [May 12, 2011, 5:30pm UTC](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431/20 "2011-05-12T17:30:19Z")

</div>

Hi GianfrancoPa, I need power saving in the End Devices, the coordinator always is plugged to a PC.

[Next page](https://forums.digi.com/t/forcing-sleep-mode-when-out-of-range/2431.md?page=2)
