Let's Make Robots!

XBee Files - Part 1 - Basic Communications - Atmel 328 (Arduino)

AttachmentSize
XBee-Manual.pdf1.09 MB

XBee Files - Part 1 - Basic Communications and Setup.

Non-Stream Video :- XBee Files Part 1

This guide will take you through the basic setting up of the XBees in an Arduino Environment.

Please note:- no flow control is being used ie RTS/CTS .


Because XBees work on a 3.3 Volt supply you will need some way of translating the 0-5 Volt logic levels from your arduino.

In my case i bought an additional interface board. (Google :-  xbee interface board and it will kick up many examples),

Then you can plug in a normal FTDI cable to talk to the XBee (my red board needed the RX/TX lines crossed over Grrrr).

You can also get combo boards that plug straight into your USB (what-ever presses your button :-).

This we will call the "TX XBee" - ie its directly connected to your computer.


 

 

 

 

 

 

 

 

 


Before you can get anywhere with the XBees its a good idea to download this application :-

X-CTU This is an application that is supplied by the manufacturer.


XBees are supplied "Out of the Box" with a default Serial rate of 9600 Baud. (set it to that).

Press the "Test/Query" button and the XBee will respond by sending back its firmware version. (comm link established)

This is a first test to see if you are connected to the modem (if it fails to report back then try all the other baudrate combination's, its often the case that there is a baud-rate mismatch if you have messed around before "reading the rules" )


You actually dont need to make any alterations to the Xbees "Out of the Box" to get them communicating with each other.

Here is my set up for the "RX XBee" :-

Four connections only :-

XBee     -       Arduino

+5 Volts         +5 Volts

  0 Volts           0 Volts

Data in           Serial TX

Data out         Serial RX


Simple Echo program for "RX XBee", all it does is listen for serial data and if received then transmit it back , this is termed as a "Software Loopback Test".


// XBee Files
// Part 1
// Simple Communication Link
// Letsmakerobots.com (Gareth)
// "RX XBee"
void setup() 
{
  Serial.begin(9600);
 }
void loop()      // run over and over again
{
  if (Serial.available()) {
      Serial.print((char)Serial.read());
  }
  }

 


You could also connect a wire from the "data out" to the "data in" pin of the "RX XBee"  this is termed as a "Hardware Loop-back Test" (so you can test without the "RX Arduino" being in the circuit)

 


Select the "Range Test" Tab and pressing the Start/Stop button sends serial ascii characters to the TX line.

As the Arduino is in "Loop-back" mode what you see above is the return characters.

if the link fails then the number of missed messages (Red) will be displayed, good for testing the range of the XBees.

The other way to check the comms link is to use "Terminal" tab, then you can type away at your hearts content.

The doubled characters are because of the "Loop-back". ie you type and the other end throws it back to you.

Thats is basically the full communication round loop process.


 



EXTRA :- OK that's all fine if you want a boring speed, this is how to wind it up :-

If you make a complete mess of the settings then you can always press the "Restore" which will put in factory default values.

Remember to hit the Write button to upload the changes to your XBee........

CAUTION :- if you alter the Baud rate here - next time you access the XBee you also have to change the baud rate of the "PC settings" tab to the same value (otherwise you will not be able to talk to the XBEE - common mistake)


Power levels are set here - in some counties its illegal to transmit over a certain rf level - the user PDF outlines which levels are permitted.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

You just saved a guy who is not an engineer to make his xbees works! Thank you! Is there a PART II ? For more advance control? :P

Thanks for  the feedback hardmouse, its good to hear that the walkthrough works :-)

Yes i have plans to make extra parts (PART II)  (one i need to  get finished  is Tx_ing the xbees onboard analog channels)...... however time and finishing off of old projects prevails ......

 

I am not sure if I fully understand what you mean with the inverted thing.

When sending serial data out from a Picaxe I can choose baudmode between a "true output" (idle high) and a "inverted output"(idle low).

So if I connect a picaxe output to the DIN on the regulated board I should be able to make it work?

(remember I'm new to this stuff)  :)

 

Connect the picaxe output to the Din and the picaxe input to the Dout on the regulated board. Try with true output and if it doesn't work, try with inverted output. If it still does not work, there is another problem. Perhaps the xBee is not set up properly?

I suggested he post the problem on a seperate forum post so he can include all relevant config info, code and images.

Im getting so frustrated that I think I'm just going to test it... Hope the smoke stays inside my xbees... :S

no smoke, no communication...

Hello Gareth!

Quick question:

I noticed that you are using these (edit :-Link removed) guys (XBee Explorer Regulated). Does theese really take care of the signal regulation as they state on the site? (convert the signal that comes out from the microcontroller 5V to the XBee 3.3V)

I just want to be sure that i don't fry the XBees before I connect them.

 

Background info:

I have had quite some problems with connecting these (Edit :- link removed)  Xbee modules to my picaxe. :) (XBee Pro 50mW Series 2.5 RPSMA)

I bought two axe210 connect boards, and was able to change the baud rate on the modules, but failed at the Ping test. (No communication what so ever). Then I found This post at the picaxe forum where a guy had the same problem as I. To conclude the axe210 will not work with series 2 Xbee modules.

Now I just happened to have two spare "XBee Explorer Regulated" and I am a little bit afraid of connecting them. Mainly because this forum here at LMR makes me think that I have to do something about the voltage for the data lines, when connecting a picaxe running at 5V straight to the XBee Explorer Regulated. I looked at the datasheet/schematics (edit :-link removed) for them and can't se anything but a diode on the DIN line.

Renkku

 

 

 

I have no experience with XBee-Picaxe links......However....

What i suggest is get the link working first :-

Using the X-CTU Gui described in my article above, connect one XBee to your computer via interface board - and just simply power up the second XBee.

Select the Range Test Tab and press start selection , this sends a stream of continuous data to one of your  Tx XBees -  the Rx Xbee will show it is receiving data by flashing an led.

Now with a piece of wire loopback the Dout and Din pins on the interface board of the Rx Xbee - this loops back the data to the first Xbee. You will see the returned data clocking up on the X-CTU Gui. This will test your Hardware Comms link.

This has to be working first before you add your Picaxe.

The interface board you are using will convert the logic levels to the correct levels - however i am a bit dubious about the onboard 3.3V regulator.

NB:- the supplier links in your above post have been removed (see edits).......(i took great pains to avoid advertising them in my tip and  videos) .