Xbee and configuring thereof.

Go To Last Post
14 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello Freaks,

Not sure if that is the best place to ask this, but decided to try anyway :twisted:

I've gotten myself a couple of Xbee units (http://www.maxstream.net/products/xbee/xbee-oem-rf-module-zigbee.php) . Xbee is basically USART wireless transmiter/receiver. However I am having trouble with it's "out-of-the-box" configuration and would like to change some of the settings. (Basically I want it to transmit USART sygnals between 2 AVRs). However in order to change the settings on this unit it needs to be hooked up to the PC and "reprogrammed". MaxStream (manufacturer) also sells development kits (http://www.maxstream.net/products/xbee/dev-kit-zigbee.php) however they are on the expensive side. Especially taking into account the fact that software is free and downloadable from their website. So basically the extr 100$ or so they are charging for a programmer and some packaging (bah!).

So, long story short, my question is, does anyone have a schematic of such programmer, or knows how to set up the unit(s) for USART comm between 2 AVRs?

Thanks in advance.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
However I am having trouble with it's "out-of-the-box" configuration and would like to change some of the settings. (Basically I want it to transmit USART sygnals between 2 AVRs).

What problems are you having? I played with the Xbee modules a while back in preparation for an upcoming project and, for me, they did work "out of the box". Mostly I was doing range experiments but it was essentially transmitting ASCII between two AVR boards. It should be exactly as if you have the two AVR's hooked to each other via a UART except this makes it wireless (ie: transmit a character on one AVR and get a UART receive interrupt on the other).

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

The problem I was having was very strange .. untill I burnt one of the Xbee modules by mistake :(

the program was dead-simple: 1 AVR had USART comm enabled and had POT hooked up to one of the C ports. Main loop was reading the value of the pot and storing it in the global variable.
Whenever AVR was ready-to-send it would send the vaule of global var through UART (event driven).

Second AVR had event driven UART comm enabled as well, however it would store the data received from other AVR in global var (once again interupt enabled) and the main loop would set PWM value to be the value of global var.

I had an LED hooked up to the apropriate pin on the receiver AVR to "guess" the value received.

both AVRs were running at 3.3V (or so) from different power sources.

So, with this setup and a wire running from one board to another I had very predictable bahavour - change POT position, brightness of LED changes.
However when i replaced wire with 2 Xbee pro modules I started to see strange behavour:
LED would not be solid, but would blink between off and max bright, but the fleaker (sp?) did not seem to be random, but related to the POT position (ie light would be solid bright at max position of the POT and almoust always off at min position).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have been tinkering with the XBee modules. I do believe you can change their setup by just hooking a dumb terminal to them and using the modem-style commands to change and save the configuration. Be advised that the signal attenuation through walls is significant. I'm using a pair of 100mw units about 20 feet apart, but the intervening 8 layers of drywall and a brick veneer don't leave me with much margin 8-)

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hmmm... you started out doing exactly what I would have suggested - get the software up and going using a direct connect and then switch over to the Xbee modules. I suppose it could be hardware but they are pretty straightforward to hook up. Have you verified that there is nothing shorted?

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

tpappano:
Range couldn't have been the issue, because 2 units were right next to each other (2 meters apart tops) and in direct line of sight.
As for programming through terminal ... aren't the Xbees 3V and RS232 10-ish? I'm afraid I'll burn another one :-P I accidently shorted 9V onto one o the Xbees and it died instantly. At least I think it died :\

dharper:
I do not think I had anything shorted, because it did work with the wire... However I did sodder pritty long wires to the Xbee because it would not fit into the breadboard :) So maybe I picked up some interference or whatnot on them? Thats the only posible explanation I have at that point.

Another question, though. Howdid you guys hook up your Xbees to AVR? (My concern is AVR is usually 5V operation and Xbee is 3V) Did you run AVR at 3V? If so did you use external crystal for data rate?

Any help is apriciated.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

MaxStream have their development schematics on their site,
http://www.maxstream.net/support/knowledgebase/files/XBIB-R%20schematic.pdf

As for programming, you can do it with a standard terminal program and AT commands, as described in the manual. (the cheats way is to run a sniffer progam and grab the AT commands that the XCTU program sends to the serial interface).

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
As for programming through terminal ... aren't the Xbees 3V and RS232 10-ish? I'm afraid I'll burn another one Razz I accidently shorted 9V onto one o the Xbees and it died instantly. At least I think it died :\

You are correct, you need to use a rs-232 to logic level interface of some sort. It can be a standard interface chip of some flavor or a couple of transistors (which is what I use most of the time).

Tom Pappano
Tulsa, Oklahoma

Tom Pappano
Tulsa, Oklahoma

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
As for programming through terminal ... aren't the Xbees 3V and RS232 10-ish?

The Xbee runs from a supply in the range of 2.8V to 3.4V. RS-232 is an electrical interface that uses both positive and negative voltages in the range of 3V-15V, with the negative voltage representing a logical 1. If you were to connect an Xbee to an AVR running on the same supply voltage you could directly connect the TXD/RXD pins on the AVR to the DIN/DOUT pins on the Xbee. On the other hand, if you were trying to talk to the Xbee using the serial port on a PC, you would need an RS-232 interface chip connected to the Xbee. This would be used to translate the rather large positive and negative voltages on the PC COM port into the voltage levels used by the Xbee.

For the test board that I did, I was running the AVR (Mega128) at 5V and the Xbee at 3.3v. This was because I already had a bunch of 5V Mega128 chips handy (and yes, I used an external 16 MHz crystal). To assure that I stayed within the I/O level specs from the datasheet, I used a SN74LVC245A buffer between the AVR and the Xbee. The SN74LVC245A pretty much swings rail to rail and was running off the 3.3V supply. Since the Mega128 has two UART's, I had one of them hooked to an RS-232 interface and talking to the PC. The other went through the SN74LVC245A to the Xbee. I had two boards like this and, in my initial checkout tests, both ran the same software. This was a very simple program where the Mega128 monitored the receiver on each UART. As soon as it saw a character it would read it and write it to the other UART. I then connected both boards to separate COM ports on the PC and started up separate Hyperterminal windows. I was able type characters into one window and see them echoed in the other window. Later versions of the software would allow me to either talk through the board in the manner described above, or talk to the Xbee from the PC using the AVR as a go-between. In this manner I was able to do things like read the Received Signal Strength when doing the range testing. This is what Tom was talking about above.

Dave

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Broxbourne:
oh, I've missed that, thanks a lot.

tpappano:
that's what I've thought, thanks

dharper:
Thanks a lot for the info, very helpful.

Great, after reading all your pointers and suggestions I have devised a plan of action:
- I want to hook up AVR to COM port so I haveat least some debug info, not just the blinking light :) To accomplish that I have ordered MAX3232 (3.3V version of MAX232). I would hook RX and TX pins of AVR to COM pins 3,2 rep through MAX3232 and run AVR (I have ATMega88's in my disposal) at 3.3V through regulator + capacitor, just in case. Pin 5 of COM would go to common ground. Also I would hook up 1.8432MHz oscilator to AVR. And set the BaudValue to 11 (9600 Baoud rate).
That from my understanding should accomplish PC<->AVR comm through whire.
- Next stepwould be to write a simple echo program, that would go into infinite loop and upon receive of data through UART would raize a flag and fill in global var. On_send_ready routine would consist of simple if that would check if new data is available (flag from above) and would send back the same data it received (global var) and lower the flag.
- After the above two steps are complete I should be able to hook the thing up to PC and send some messages through COM port and get back the same messages.
- Once that is succesful I would replace the wire that goes from MAX3232 to AVR with 2 Xbee modules connected to the same 3.3V regulator (I hope 9V battary can handle such a load) in the default settings.

Any comments or suggestions?
Thanks alot.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I would suggest you consider building and keeping a dedicated rs232 development board or two (with sockets for xbees). That way you have a stable reference and interface to XCTU.
XCTU can be used to program a bunch of xbees (parameters can be save and loaded for programming). It also has diagnostics such as range testing (given you have another xbee with its rxd and txd connected as a loopback). Lastly, XCTU will upgrade the latest xbee firmware directly from the internet if desired.

Our project wallowed for a few days until we bought a development system and could see what was going on, so your decision to hook up an rs232 i/f is good from my experience.

In practice, the most important setting for us in simple out-the-box mode were:-
pan id (low word?) = 0xffff for broadcast listening
power level
baud rate
sleep mode (0=radio always on, 1=pin enabled)

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Broxbourne wrote:
I would suggest you consider building and keeping a dedicated rs232 development board or two (with sockets for xbees). That way you have a stable reference and interface to XCTU.

How easy is it to build my own dedicated rs232 development board? Is it a simple RS232 interface as I described above (through MAX3232 or equivalent)? Or is it something more complex?
maybe I should consider buying that development kit after all?

thanks

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I was only suggesting that if you make a pcb capable of progamming the XBee, that you keep it. Plus it is very good to limit the variables you have when developing, so using proven software and hardware helps to narrow in on any problems.
Look at the schematic of the rs232 development board and figure out what is really important. An aweful lot of the stuff there is for extra features and abilities.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Everything worked in the end!
Many thanks to all of you.

The problem was a baud rate. When I was using 2 AVRsI had them communicate at 2400 baud and 9600 baud, but using internal crystal. After I hooked up external 1.8432Mhz crystal and set the baud rate to 9600 everything worked like a magic!

Thanks again.