XBee Series 2 Getting Started
Could anyone point me to resources for getting started with the XBee Series 2 modules. My professor and I purchased the series 2 because of the long range capabilities (we figured the better the distance the less likely hood we would loose connection at a bad time). However I am finding that the Series 2 take a little work to get running. We failed to purchase a USB interface (soon to be fixed) to do programming.
This is what I understand so far:
This is what I understand so far:
- At least one XBee module needs to be in Coordinator mode. The rest can be in Router or EndPoint.
- Series 2 can be run in either AT or API modes
- Firmwares exist for all 6 configurations (Cord-At,Route-At,EP-At,Cord-API,Route-API,EP-API) and at least 1 must be flashed to the module to begin using it.
- Example code is primarily geared to series 1 modules and is not necessarily compatible with series 2
- Create a simple Point-2-Point wireless connection
- The system will likely be setup as Coordinator <<->> Router
- Get a firmware on the XB2 sans USB Programer if it is even doable
- Find example code to get our project ported from 433MHz links to XB2-Mesh
Comments
I have been working on a document to be posted for EXACTLY this application - point to point with XBee Series 2. With what I have, I get really snappy communication between both modules - like what you would get if you have the series 1 modules. I have the content down but its not yet in a "prettied up" format to post on the website.
It would be a great test for me if you went through it and tried to configure your modules with it. You could give me some good feedback on how to make the document better.
You have the idea right, you will configure one module as a Coordinator and the other as a Router. The trick is to configure the Coordinator to ONLY talk with the Router, and visa-versa.
As for configuring the modules without the USB adapter, you can totally do that! You just have to do a little extra wiring. Check out the attached pic. Basically, you need to connect the TX and RX lines to the XBee's DIN and DOUT pins respectively and then connect the XBee's ground pin to give it a reference to the computer. Be careful using a line level COM port - those typically operate at higher voltages than the USB COM port and will likely damage your module (maybe use a MAX232 chip to manage this).
Lemme know how things go
As for the XBee module via the propeller plug, we only have Basic Stamp boards. I have a Board of Education with BS2 and BS2x modules and a BS2pe MOBO board and SIP adaptors for the XBee modules. Can I program through one of those BS2s or do I need to hack up a USB cable/use a USB-Serial adapter (got one of those)/buy the board to make the connection you diagrammed below?
Solving the connection issue... It would be best if you could use the USB-serial adapter. That way, you wouldnt have to convert RS232 levels to TTL. Hopefully you have an extra serial extension cable. If so, you can plug one end into your USB-serial adapter and cut the other to gain access to the Transmit, Receive, and Vss/ground pins. Just connect those to the XBee SIP header like you would with the Prop plug. That should get you communicating.
Ok, the commands. From what I can tell, all the commands that you can change using the X-CTU tool, you can issue the XBee serially and modify. All you have to do is put the XBee in command mode ("+++" by default, wait for the OK) and then issue your AT command. For example, if you wanted to get the node identifier, you would do the following (my commands in regular font, XBee responses in bold):
+++OK
ATNI <enter>
COORDINATOR
You can set these attributes by adding your setting as an argument to the command. For example, setting the Node Identifier:
+++OK
ATNI BOB<enter>
OK
ATWR <enter>
OK
ATNI <enter>
BOB
The command ATWR stands for "write". This writes the settings to the XBee's flash memory. Since this is flash memory, it does have a limited number of write cycles. The XBee datasheet notes this - its ok to use, just dont issue the command after EVERY change. If you dont write the flash the setting will stay loaded into RAM until the XBee is rebooted/power cycled.
If you want to know more about issuing commands to the XBee manually with a serial connection (either by PC or uController), just let me know. I could go on about it. (dont want to bore you or confuse with extraneous fine details though)
I still am having trouble connecting to the modules to the computer. I am trying to hack up a serial DB9 cable. I have the following configuration
Computer/BOE
XBee Sip Adapt 32402A
BOE Vdd
+5V
BOE Vss
GND
PC Tx (Pin 3)
Din
PC Rx (Pin 2)
Dout
<nothing>
/RTS (Unconnected)
With this hooked up I have on the SIP board PWR, On_Sleep, ASSOC and TX lights on. Using a Prolific USB-Serial (Com5) adapter when I query out of XCTU Nothing comes up. It tells me communications failed. I have even put XTCU in XP compatibility on Win7 to no avail. Am I doing things right? I think I am going to need to break down and buy a USB to XBee adapter but that will take time to come in.
Did you make sure that you tied the GND pin on your XBee to the computer's GND somehow? This provides the module a common reference point with the computer so that the two can "talk apples to apples".
The minimum connections you need to power and talk to the XBee are as follows:
+5V/3.3V
> Vdd/Vcc respectively (make SURE that only 3.3V is connected to Vcc as this goes straight to the XBee. I.E. only run power to the Vcc line if its coming through a 3.3V regulator.) Otherwise, connecting +5V to Vdd will be fine as it goes through a voltage regulator on the SIP adapter.
DIN
> Conncet to Tx
DOUT
> Connect to Rx
GND
> Connect to GND
I pulled out my multimeter and checked. I am seeing about -6.6v on the Tx line and 0.0 on the Rx line when checked off of the Signal ground pin (mm+ to pin 3, mm- to pin 5 on USB-Serial). Trying Pin3 to Vss on a BOE shows 0.0 volts.
No I really didn't. I had thought of that but didn't know quite sure how to go about that. Below is what I tried for a wiring diagram, I have the XBee SIP adapter hooked up as follows:
+5V
> Vdd {5v coming from a Board of Education Vdd pin}
DIN
> Conncet to Tx {pin 3 on serial converter}
DOUT
> Connect to Rx {pin 2 on serial converter}
GND
> Connect to GND {connected to BOE Vss and pin5 of serial converter}
If I try to run the GND to just pin 5 on the Serial converter nothing lights up on the board. I dont know if tyings pin 5 to PowerNegitive/Ground will help but there is not Ground port on the Xbee side.
When I connect the system as shown above then what I get is the Tx light always on. This happens even if I don't connect anything but Vdd and Vss to +5 and Gnd respectively. Should I at this point assume the SIP adapter is fried?
Is there any test code to just transfer some text and variables that is written for the series 2?
I would love to see these communicating.
Thanks,
Don
If you follow Dan's guide you can use most of the simple serial transmit and receive code. I was successfully using just some test code to my computer over my link I made. I to am going to be looking at more complex solutions but for the time being what I have works.
@Dan, I am going to send you some suggestions. I was able to get it working but I think some things could be explained better for more novice users.
That is exactly what I am looking for . . . a very simple network.
I will send Dan an e-mail to ask him for his instructions.
I will let you know how it works.
Thanks again,
Don
Thanks so much for the instructions for the XBEE Pro series 2. You did a great job, which would have been a lot harder without your instructions.
The terminal test at the end is great diagnostic tools to verify simplest communications exist. I keep going back to verify it still works.
The propeller drivers are great. I go between the onboard prop driver and the "parallax serial terminal" with no problems at all.
Thanks again,
Don
I am trying to communicate between 2 props now and I am having a problem with the RX command on the full duplex serial. I have no problem transmitting, but I loose data using the RX command (on the receive side).
I am using 9600 baud and get very intermittent loss of data from prop to prop.
This should be like trying to send data from prop to prop directly . . . maybe I should look up code on the OBEX under that.
Thanks again,
Don
The Xbee pro series 2 network is running great.
I am now communicating prop to prop, with no problems.
Thanks again,
Don
2 questions for you . . .
It now takes 8 seconds for association, when you first turn it on. Is there any way to shorten this?
Now that these Xbees just communicate with each other, how difficult is it to add another?
Thanks again,
Don
To add more devices to your network, it will just be a matter of updating the new device with the same PAN ID and setting up the Function Set for the device you added. Then based on the Function you setup for that device, determines how you address it.
You may see some association time increases if you have some of the notifications and verifications enabled which could slow you down.
Thanks for the quick reply.
Do you know which notifications and verifications I can safely turn off? I would like to shave off as much time as I can.
I am looking at putting this in a hand held battery operated device, so every second counts.
Thanks,
Don
Welcome to the forums!
Have you downloaded the book from:
http://www.parallax.com/product/122-32450
Free to download.
It deals primarily with the Series 2 (ZigBee) XBees.
What processor are you using?
I have a project using two Series 2 XBees. I haven't worked out all the kinks yet but I do have the XBees talking with each other.
I could take a snap shot of my X-CTU screen if you think it would help.
http://tutorial.cytron.com.my/2012/03/08/xbee-series-2-point-to-point-communication/
Coordinator
SH-Coordinator (copy to router/endpont DH)
SL-Coordinator (copy to router/endpont DL)
DH-Router/Endpont = Coordinator SH
DL-Router/Endpont = Coordinator SL
Router/Endpont
SH-Router/Endpont (copy to Cordinator DH)
SL-Router/Endpont (copy to Cordinator DL)
DH-Coordinator=Router/Endpont SH
DL-Coordinator=Router/Endpont SL
This will fix the huge delay when you TX/RX between 2 units. This is for 2 units ONLY like
a XBeeS1setup for AT transparent mode.