12.9.06: XBees go solo and sleep on the job
I go over the basics of getting an XBee to run by itself and sleep.
The basics of this are coveraed at Rob's
site
First set up a breadboard with the FT232R Breakout board.

Open terminal and enter the following: use TAB key to complete words
>> ls /dev/tty.*
/dev/tty.Bluetooth-Modem /dev/tty.usbserial-A1000S5B
/dev/tty.Bluetooth-PDA-Sync
>> screen /dev/tty.usbserial-A1000S5B
ctrl a ctrl \ to exit the screen
once in: shift +++ to initiate communication with XBee
from there you can hit: AT__ RETURN to issue a command
Note that after 5 seconds of inactivity it exits
To exit sooner do ATCN
Now to Add sleeping to Rob's example also add these commands to the sended module:
ATSM5 (sleep mode 5)
ATST1388 (1388hex = 5 seconds) (Note that GT is 1 second 3E8)
Note 1 in hex here = 1ms
ATSP320 (320hex = 8 seconds)
Note 1 in hex here = 10ms
12.2.06: More
First a link to the code being used on the send module from 11.29.06:
arduino code.
Also useful, an image of the atmel:
image.
I implemented a sleep/wake transimitter: here is the
code.
There was a problem with the old recieve code that is fixed: here is the
code. The explanation of the fix is at the top.
The power consumption of the send module without LEDs except for an LED on the ON/SLEEP Pin (pin 13)
is 15mA which bumps up to something like 18mA during the brief transmit period.
The LED on pin 13 is useful because it tells you the system is working and is on for such a brief
period of time that it hardly accounts for any current draw. If you are really crazy remove it
but hopefully we will have more power savings soon by putting the atmega to sleep...
Here is a picture of the send setup:

11.30.06: Next on the List
1. Configure Sleep Modes with AT commands from arduino.
2. Implement circuit/code that will sleep and wake and send a byte of data, then go back
to sleep...
3. Look at theoretical battery consumption off of a fresh 9 volt, and configure a base station
that will be able to keep track of how long the module runs for.
4. Maybe do a real test to see how long it lasts, but I'd rather wait and do the following:
5. Figure out how to put the Atmega to sleep and then wake it back up again.
6. Then do #4.
7. From this create a usable platfrom for doing sensor systems in this manner.
8. Tackle Sleep modes 3-5, distributed sleep!
11.29.06: Power and the XBee with Rob


At 3.3V, measuring the amperage flowing between the power bus and the VCC pin on the XBee (pin 1),
we found the following current in different states:
Transmit 48mA
Idle/Receive 53mA
SM1 0.10mA (100uA)
SM2 0.17mA ( 170uA)
This is very close to the specs in the datasheet (page 5 and page 21)
SLEEP MODES
These are well Documented in the XBee manual (pages 21-23).
Here we look at SM (sleep mode) 1 and 2.
SM is default set to 0 (off). In this case we set SM to 1 or 2. SM1 is the Pin Hibernate mode, and features the lowest power draw but has a slower wake up time (13.2 msec). SM2 is the Pin Doze mode, which features faster wake up time (2msec) and slightly higher current consumption while "Dozing."
The XBee is sent into SM by unplugging the /DTR/SLEEP_RQ/DI8 Pin (pin 9) from ground, and woken up by setting it to ground (de-asserted).
The status of the XBee can be seen by plugging an LED in the ON/SLEEP Pin (pin 13). When the LED is lit, the XBee is on, when it is off the XBee is either off or asleep.
A very important note on SM 1 and 2 is that the XBee will not go into sleep mode until it has finished either sending serial data written to it, or completed receiving incoming radio data. Also note that the 802.15.4 protocol includes a verification signal from the receiver to the sender, so even after you have sent a signal, the XBee may have to wait for the acknowledgment to complete.
The practical implication of this is that we have found you must have at least a 10mS delay between serial writing in your arduino code if you want to put the XBee to sleep. Depending on how much data you are writing out or receiving, this amount of time may change. The basic point is that there must be a period of "quiet" on the TX/RX lines before the XBee will enter SM 1 or 2.
How could SM 1 or 2 be used? Well imagine you have a one way sensor network, e.g. every hour or so you have a sensor/uP/XBee module running off a battery, transmitting a data reading back to a central station. In this case you can put that remote XBee to sleep and only wake it up when you want to send out some data.
A few important points on SM 1 and 2:
The XBee is put into and woken up from sleep by an external system.
While asleep, the XBee will not receive any RF or serial data: it will be lost.
For this reason, these modes may work well only if you have strongly controlled timing (unlikely) or if you have a one way (Many to Central) system. This last scenario is very likely to occur.
A simple note on the power draw of the entire send board:
Sleeping the whole draw is 0.015A
Active the whole draw is 0.060A
The board amperage is being measured between a 9V battery and the input to a 3.3V regulator feeding the entire circuit. All power/status LEDs have been removed from the board to minimize extraneous power consumption.
Note also: MaxStream has a nice live chat with Technical Assistance.
THINGS TO DO.
How to set SM via the serial commands set in the setup() of arduino.
11.18.06: Initial Arduino and XBee
So I got the simplest Arduino Xbee stuff up.
First, how to bootload a new Atmel chip:
Get: The Atmel AVR bootloader (from ER), External Power supply
1. switch power jumper to external on ardunio board
2. open arduino in windows (only because the AVR is serial)
3. plug serial AVR in and put 3x2 jumper on board
4. In arduino make sure serial port to COM1 (if applicable)
5. go Tools > Burn Bootloader
6. Voila!
Now on to the Xbees. Here are images of the two boards from
Rob's site.



I am going to replace these pictures with circuit diagrams at some point.
Here is the code that runs on each board:
xbee_send
xbee_recieve