Zigbee

Zigbee, or XBee Pro, is a form of wireless communication. Zigbee is the wireless protocol (802.15.4). An XBee is a wireless radio chip.

We use XBee-PRO 802.15.4 chips. X-CTU runs zigbee chip commmunication software and firmware upgrade Direct download software link

Present baud rate: 57600 LKatona Aug, 4, 2011 Baud rate has been increased so we can send more data to the groundstation.

=Antennas= According to Lady Ada, there are some zigbees which require a certain type of antenna, of a certain length. We need to look into ours to make sure that we have the proper antenna to preserve range.

This forum post mentions that antennas malfunction when there are wires routed over them; ensure we take this into account in our box layout.

There is one zigbee radio that does not have an antenna snap surface mount soldered to it. For this one, a length of wire 5 to 10 cm (not sure about best length?) soldered into the through-hole next to where an SMT antenna snap would mount increases the range 3x at least.

=Zigbee with Arduino=

How to Make it Work
Note: Must disconnect zigbee shield to program the arduino (power off before disconnecting).

Serial COM1 setup Baud rate: 9600 8N1

Jumpers on XBEE shield: both are on XBEE position (interior of board) THIS IS WHY IT WASNT WORKING

Power: 5V to standard XBEE module from arduino Power to arduino from 9V adapter OR USB to computer

Setup: COM1 -- XBEE standard module .. arduino xbee shield -- arduino

Code: byte input; void setup { Serial.begin(9600); } void loop {  delay(1000); if (Serial.available > 0){ input = Serial.read; Serial.print(input); }   else Serial.println("hello"); }

Output (COM1): hello hello hello  <- this is input dhello Output (serial monitor): nothing; this (according to http://www.arduino.cc/en/Main/ArduinoXbeeShield should be displaying the output to Serial... the same as COM1)

Getting the USB board to work
First of all, make sure the xbee chip being used is paired properly with the one on the Arduino.

See dropbox for (old?) drivers. Or see http://www.digi.com/support/kbase/kbaseresultdetl.jsp?id=2138

First run the FTDIUNIN.EXE in order to uninstall any current drivers (this seems to have been the key step). Arduino also uses an FTDI chip, but worked fine after this install.

After this, followed instructions from ftp://ftp1.digi.com/support/documentation/90000831_A.pdf

The XBee-PRO USB RF Modem is a "plug-and-play" device that should automatically be detected by the PC. To interface between the modem and a PC, two drivers must be installed. After the modem is detected, the PC will display an installation wizard that facilitates driver installations.

Drivers for Windows, Macintosh & LINUX operating systems are included on the Digi International CD.

To Install Drivers:

The following steps were recorded while using the Windows XP operating system.

1. Connect the XBee-PRO RF Modem to a PC using a USB cable.

["Found New Hardware Wizard" dialog box appears.]

2. Verify the Digi International CD is inserted into the drive.

3. Select "Install from a specific list or location (Advanced)" option; then select the 'Next' button.

4. a. Select the 'Search for the best driver in these locations' option.

b. Check 'Search removable media (CD-ROM...)' box; then select the 'Next' button.

[Hardware Installation "Windows Logo Testing" alert box appears.]

5. Select the 'Continue Anyway' button.

6. Select the 'Finish' button.

7. Repeat steps 2 through 6 to install the next driver.

8. Reboot computer if prompted to do so.

Wireless Arduino Programming
Being able to wirelessly program the Arduino via zigbee would save huge amounts of headaches for us. It is mainly a hardware challenge.

Tutorials
http://www.ladyada.net/make/xbee/arduino.html

http://www.sparkfun.com/commerce/tutorial_info.php?tutorials_id=122

Forums
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1231361413

http://stackoverflow.com/questions/2304292/wireless-programming-with-the-arduino-xbee-sheild-and-xbee-explorer

http://forums.adafruit.com/viewtopic.php?f=19&t=8222&st=0&sk=t&sd=a

Put together hardware for wireless Xbee programming. Followed the ladyada tutorial and everything was the same. Note the following however:

-on x-ctu, when selecting modem version for xbee, select xbp24 from the dropbox

-on the xbee wireless receiver circuit (the one that goes in the boat) the TX line goes to RX on arduino and vice versa

Wireless programming is currently not working at the moment.

Notes Nov 12
Zigbee was at 115200 (found this with X-CTU and selecting COM1, test/query (windows). Once connected, modem configuration -> read to get all parameters off of zigbee; Working with this setup: baud rate 115200 standard zigbee powererd off 2 batteries (around 14V) or 5V hyperterminal -- standard zigbee module .. custom zigbee -- loopback

Thoughts on arduino and zigbee |The XBee shield we use with arduino

We aren't sure what baud rate or settings the two Zigbee modules are currently set on; tried comp -- null modem -- custom module (5V powered) ... arduino zigbee shield sending the baud rate every 2 seconds at different baud rates, and changing the baud rate on the computer as per below (didnt see any data on computer):

void setup { Serial.begin(9600); } void loop { Serial.print('9600'); delay(1000); Serial.end; delay(1000); Serial.begin('115200'); Serial.print('115200'); delay(1000); Serial.end; delay(1000); Serial.begin('4800'); Serial.print('4800'); delay(1000); Serial.end; delay(1000); Serial.begin('19200'); Serial.print('19200'); delay(1000); Serial.end; delay(1000); Serial.begin(9600); }

comp -- null modem -- custom module (5V powered) ; sending +++ didnt get an AT response; tried at 4800, 9600, 19200, 115200, a lot more

=How to use X-CTU on Linux= X-CTU is the program that talks with zigbee chips and can be used to change their settings.

First
 * We setup a COM10 port for linux to emulate COM1 following these instructions
 * We installed X-CTU using wine

cd ~\.wine\c_drive\Program Files\X-CTU\ wine X-CTU.exe
 * 1) Run X-CTU:
 * 1) Change the port to COM10 and click "add" or "use" or whatever the button is
 * 2) Click connect. It should find your zigbee module if it is connected to COM1(TTYS0) (the serial port on the back of the computer)

-- means hard-wired connection

... means wireless connection

Resetting
We should never have to do this (use X-CTU instead), but:

To reset baud to factory, http://www.youtube.com/watch?v=9MMpZ-8JExk (this might not be accurate and might have other bad effects)

=Zigbee with TS7260=

X-CTU terminal restart uC/login ok:

comp -- null modem -- custom module #1... standard RS232 module #2 -- uC

Some error checking (March 2010)
12V converter using 4W, 0.09A with no load 5V converter using 0.07A with no load, 3W

Not looping back/responding to +++ in minicom: comp -- (null modem) -- custom module #2... standard RS232 module #1-- loopback

looping back/ responding to +++: comp -- standard RS232 module #1 ... custom module #2 -- loopback custom module drawing 78mA at 5V = 0.4W. standard RS232 module drawing 110mA at 120V, or 6W with 12V converter custom module drawing 86mA at 5V = ~0.4W. standard RS232 module drawing 70mA at 120V, or 4W with 5V converter -> normalized (take out load of inverter) 4-3 = 1W, 70-70=0A (resolution issues?)

looping back/ responding to +++: comp -- standard RS232 module #2 ... custom module #1 -- (null modem) -- loopback

X-CTU query ok: comp -- (null modem) -- custom module #1... standard RS232 module #2-- loopback

X-CTU range test ok: comp -- (null modem) -- custom module #1... standard RS232 module #2-- loopback

X-CTU range test timeout: comp -- (null modem) -- custom module #1... standard RS232 module #2

X-CTU terminal loopback ok: comp -- (null modem) -- custom module #1... standard RS232 module #2-- loopback

X-CTU terminal +++ ok: comp -- (null modem) -- custom module #1... standard RS232 module #2 -- (loopback)

minicom restart uC not ok (not recieving from uC): comp -- custom module #2... standard RS232 module #1 -- uC X-CTU restart uC not ok (not recieving from uC): comp -- custom module #2... standard RS232 module #1 -- uC therefore: need null-modem

X-CTU terminal restart uC/login ok: comp -- null modem -- custom module #1... standard RS232 module #2 -- uC

X-CTU terminal restart uC/login ok: comp -- null modem -- custom module #2 ... standard RS232 module #1 -- uC <- same setup as wasnt working in minicom; power issue?? comp -- null modem -- custom module #1 ... standard RS232 module #2 -- uC <- same setup as wasnt working in minicom; power issue?? custom module drawing 78mA at 5V = 0.4W. standard RS232 module drawing 110mA at 120V, or 6W X-CTU terminal has DTR, RTS enabled, no flow control

minicom restart uC ok (recieving from uC) but cant login (send to uC): comp -- null modem -- custom module #2... standard RS232 module #1 -- uC <- same setup as login works on X-CTU -> cant login -> not sending properly? therefore: com port settings problem to fix: turned on software flow control (hardware flow control was on before already) -> still cant log in (exactly same setup directly afterwards withs with X-CTU Therefore: use X-CTU terminal to do all tests, a setting is incorrect in minicom

Possible causes: - handshaking only one way - rs232 level converter broken - rs232 level converter only one way

no reply from loopback, or +++ comp -- null modem -- rs232 straight through Jstick adapter -- standard RS232 module #1 ... custom module #1 -- loopback

reply from loopback, +++ comp -- standard RS232 module #1 ... custom module #1 -- loopback

reply from loopback, +++ comp -- standard RS232 module #1 ... custom module #1 -- null modem -- loopback

reply from loopback, +++ comp -- standard RS232 module #1 ... custom module #1 -- null modem -- rs232 straight through Jstick adapter -- loopback

therefore: existance of null modem only unimportant when next to loopback therefore: put null modem next to uC, not computer?

no loopback, no restart/login to uC comp -- custom module #1... standard RS232 module #2 -- uC

no restart/login to uC, no +++ comp -- custom module #1... standard RS232 module #2 -- null modem-- uC

++ ok, loopback ok, uC restart/login ok comp -- null modem -- custom module #1... standard RS232 module #2 -- loopback/uC

big current draw :( comp -- standard RS232 module #1 ... custom module #1 -- null modem -- uC

Question: what is current draw of standard RS232 adapter? - can remove the wall plug and put wires there instead, power off our 5V system and measure current across 1ohm resistor

Question: will it work if we supply it with a higher current source? And what is the current? - can use wall adapter, cables on desk to plug into the custom module; use 1ohm resistor to monitor current via voltage across cable wire connections

The zigbee board schematics are here: http://ftp1.digi.com/support/documentation/xbibr_schematic.pdf they show the following pins in use for the rs232 board: - DTR from rs232 pin 4 controlling PIN_SLEEP - DSR/DCD from zigbee connected to pin 1 and 6 - CTS from zigbee connected to pin 8 - DOUT from zigee connected to pin 2 RXD - TXD from rs232 pin 3 connected to zigbee DIN - RTS from pin 7 connected to zigbee RTS - 5 gnd - 9 NC

level shifter SP3203eey-l

60mA xbee custom module, now 68mA with no change to harware setup 110mA drop across resistor on elec power board - standrad rs232 module, no transmitting 100mA current measured into standrad rs232 module 123 mA loopback rangetest (might just be the LEDs on the standard module); same with the big antenna

with everything plugged in: 213mA -> use the standard zigbee board

comp -- null modem -- custom module #2 ... .... standard rs232 module -- null modem -- optoisolator inside wind sensor

zigbee to wind sensor outside

Zigbee settings (March 2010)
http://www.ladyada.net/make/xbee/configure.html

http://www.arduino.cc/playground/Shields/Xbee01 Arduino xbee shield

http://arduino.cc/en/Main/ArduinoXbeeShield Xbee AT commands

http://www.arduino.cc/en/Guide/ArduinoXbeeShield

http://www.digi.com/products/wireless/point-multipoint/xbee-series1-module.jsp#overview

http://www.libelium.com/squidbee/index.php?title=How_to_set_XBee_parameters http://www.libelium.com/squidbee/upload/3/31/Data-sheet-max-stream.pdf

Upgraded firmware on chip #1 to version 1081 - http://www.digi.com/support/productdetl.jsp?pid=3257&osvid=0&s=268&tp=2

Our xbee's replies: Initially: Xbee 1, connected to computer: ATBD 7 ATVR 106 ATMY 0 ATID 3332 ATCH C ATDL 40003911 ATDH 13A200 ATND ERROR ATNI ERROR ATDN ERROR

Xbee 2, connected to loopback/microcontroller: ATBD 7 ATVR 10A5 ATMY 0 ATID 3332 ATCH C ATDL 0 ATDH 0 ATND (blank) ATNI (blank) ATDN ERROR

Now changed so one's address is 1, the other is 0 -> didnt work, uses the serial codes (ATSL, ATSH for low and high bits ie ATDL should be ATSL of the other module)

Chip #1 ATMY 0 ATWR OK ATSH 13A200 ATSL 40003532 ATDL40003911 OK ATDH13A200 OK ATEE ERROR ATCE ERROR ATVL ERROR ATHV 1808 ATNT ERROR ATP0 1 ATPL 4 ATIO ERROR ATVL MAX BOOTLOADER V 0Ald: Jul 25 2007 16:10:54l 26 2007 13:49:56

From X-CTU XBP24 modem with firmware version 106 (initially)

+++OK ATVR 106

Chip #2 +++OK ATMY 0 ATMY1 OK ATWR OK ATMY 1 ATDL 0 ATDH 0 AT OK ATCN OK

+++OK ATNI

ATND

ATDN ERROR ATSH 13A200 ATSL 40003911

ATDL 40003532 ATDH 13A200 ATWR OK ATCN OK ATCE 0 ATEE 0 ATHV 1808 ATVL MAX BOOTLOADER V 0Ald: Jul 25 2007 16:10:54l 26 2007 13:49:56

=External Links=

Zigbee inter-module addressing

X-CTU manual

XBEE Pro Manual

Microcontroller and Zigbee programming