XBee Arduino Library for API mode

The sensor xbee is connected to only vcc, gnd and d0. There is no serial i/o connection (din/dout.) The d0 input is fed by a voltage divider to bring it down to a max of 1V.

Your sensor circuit is correct. You can go up to 1.2V to get the full 10-bit range. I found that if you go over 1.2V, all the inputs read 1024. So looks like you have everything at this point, right?

Yes, fantastic - I even solved my x-ctu problems (see under xbee issues thread).
Did you update your library so I can download new version? Then I'll have another go at it.

Forgot to mention - my problems were solved thanks to another posting of yours.

I'm getting a compiler error on Arduino v15 in the second statement:

RemoteAtCommandRequest remoteAtRequest = RemoteAtCommandRequest(remoteAddress, irCmd, irValue, sizeof(irValue));
remoteAtRequest.setApplyChanges(false);

error: expected constructor, destructor, or type conversion before '.' token

Tried casting but that didn't work either.

Mike,

You just need to move remoteAtRequest.setApplyChanges(false); inside a function, like setup or loop.

I release version 0.2.1 with a bug fix for apply changes, but I found that the example still works with the bug. This means you don't need apply changes to enable i/o on a remote. Here's what I receive at the coordinator after running the exmaple:

03:43:59.504 PM
Received Response apiId=ZNET_IO_SAMPLE_RESPONSE (0x92),length=20,checksum=0xe6,error=false,packetBytes=0x7e 0x00 0x14 0x92 0x00 0x7d 0x33 0xa2 0x00 0x40 0x0a 0x3e 0x02 0xaa 0x74 0x01 0x01 0x04 0x00 0x01 0x04 0x00 0x02 0x1d 0xe6,remoteAddress64=0x00 0x13 0xa2 0x00 0x40 0x0a 0x3e 0x02,remoteAddress16=0xaa 0x74,option=PACKET_ACKNOWLEDGED,digitalChannelMask1=00000100,digitalChannelMask2=00000000,analogChannelMask=00000001,dioMsb=00000100,dioLsb=00000000,D10=high,analog0=541

Remember to issue the WR command if you want to save the config to memory; otherwise it will be lost when you power off the xbee.

Andrew

Hi Andrew,

Looks like my problem is that I'm using an Xbee as a Zigbee when it should be a Znet 2.5 - Digi is driving me nuts. I also didn't pay attention to something you mentioned earlier because I didn't know the difference between Zigbee and Znet. This explains the error return from your calls. I am trying to write this (coordinator) file now:

XB24-B_ZigBee_1147.mxi
80
0
251
1147
0
[A]ID=234
[A]SC=1FFE
[A]SD=3
[A]NJ=FF
[A]DH=0
[A]DL=FFFF
[A]NI= 
[A]BH=0
[A]AR=FF
[A]DD=20000
[A]NT=3C
[A]NO=0
[A]PL=4
[A]PM=1
[A]EE=0
[A]EO=0
[A]BD=3
[A]NB=0
[A]D7=1
[A]D6=0
[A]AP=2
[A]AO=0
[A]SP=20
[A]D0=1
[A]D1=0
[A]D2=0
[A]D3=0
[A]D4=0
[A]D5=1
[A]P0=1
[A]P1=0
[A]P2=0
[A]LT=0
[A]RP=28
[A]PR=1FFF
[A]IR=0
[A]IC=0
[A]V+=0

Note it's called Zigbee, but drop down in X-CTU calls it Znet 2.5. It just will not do the write - keeps coming back with an error for EE. Changing EE and E0 produces an error for BD, etc.
Probably time to talk to the X-CTU boys...

Mike,

ZNet is Zigbee. ZNet 2.5 is based on Embernet 2.5. Digi also provides ZB Pro, based on embernet 3.x.

Release notes for znet: http://ftp1.digi.com/support/firmware/93009374_C.txt

Release notes for zb pro:
http://ftp1.digi.com/support/firmware/93009373_C.txt

I can't seem to find any info on the version 1320 firmware. The ZB Pro firmware is 2.x.6.4 but that is selected by choosing xb24-zb on the modem menu.

You're on the right track now by installing the 114x ZNet firmware. What are you using to flash the firmware? Have you tried a reset before the write?

Andrew

Hi Andrew,
I'm using a modified development board that I wire-wrapped; it has 3.3V ttl/RS232 level converter, led's and grounds, etc. Works well. I am keeping the wire-wrap between pins 9 and 10 on the Xbee on that board. I must say X-CTU presents a steep learning curve for a simple program, but...
NOW your libraries seem to work!!!!!!!! Got RemoteAtCommand.pde to work, anyway - proceeding with rest. I'll download your new version first. Thanks for doing that.

Yup, sampling works as well - good stuff!

ok, good to hear it's working for you

Hi Rappa/MaxMike,

I am also trying to setup two Xbee series 2 radio's for communication in API mode. I want to add more Xbee's later, but for now one coordinator and one router/end device is what I am shooting for. However, I am at the point where MaxMike was at reply 9:

I can see one problem - X-CTU did not write AP=2 as I thought it had.
I am having one hell of a time with it. I do a read, then show defaults, then set the value, then on write it fails during setting AT parameters,
then shows all errors. A subsequent restore sends it into a loop that requires it to be killed. I had to turn off the end device because it doesn't match new parameters and I get a complaint about network formation. Need to find a way of managing X-CTU.

I tried resetting the board just before hitting write, but it remains hanging on the "setting AT parameters". It this a timing thing where I should release the reset at just the right moment?

I have the xbee on top of an libelium xbee shield, which in turn is on top of an unchipped arduino duemilanove, connected to a windows laptop by USB. It seems after all the resets, write's etc there is a firmware for coordinator in API mode, but it is not retaining the NI and PAN ID. Also, is it correct that you cannot set the channel yourself?

I must be missing something, but I don't what and it is driving me crazy :slight_smile:

Any thoughts, hints or tips?
Regards,
Arno

My problem disappeared as soon as I toggled off the "always update firmware" when writing...