Forum >[ASK] Tutorial how to connect xbee S2 with arduino uno R2
ArduinoGeneral

[ASK] Tutorial how to connect xbee S2 with arduino uno R2

userHead uyacakra 2012-06-02 06:32:20 17011 Views19 Replies
Please someone in this forum, I want to make my data on sensor that connected with my arduino can sent to my computer via wireless that using xbee.

I there someone can help me give a tutorial and schematic how to connect xbee and arduino. I want use a mesh topology too if possible
2012-06-08 04:51:31 I just can't reply in more details, nevermind I have another question: do you insist on XBee mesh network ?? If you expect communication in direction node-cordinator only, there can be enough run XBees in AT mode ...

Then node's Arduino will Serial.print() your data to XBee and if you connect the receiving XBee via explorer board and USB cable to PC, you may see the coming data on Serial Terminal window.

I have to leave just now, but I'll be back later today.

Let me know what network topology you need.

Cheers
userHeadPic synekvl
2012-06-08 04:51:31 I just can't reply in more details, nevermind I have another question: do you insist on XBee mesh network ?? If you expect communication in direction node-cordinator only, there can be enough run XBees in AT mode ...

Then node's Arduino will Serial.print() your data to XBee and if you connect the receiving XBee via explorer board and USB cable to PC, you may see the coming data on Serial Terminal window.

I have to leave just now, but I'll be back later today.

Let me know what network topology you need.

Cheers
userHeadPic synekvl
2012-06-08 02:36:38 thanks for help,

now I have 2 side :
1. node side is arduino + sensor + xbee (like this [url=http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/]http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/[/url])
2. coordinator node side is xbee + xbee explorer + USB cable (like this [url=http://dlnmh9ip6v2uc.cloudfront.net/images/products/08687-07-L.jpg]http://dlnmh9ip6v2uc.cloudfront.net/images/products/08687-07-L.jpg[/url])

and now, what is the line of code I must put ini my source code (*.ino on xbee node -in arduino ATmega microcontroller- and *.pde on coordinator node to catch the transmit data from the node) to make the arduino transmit the data from sensor to computer by xbee node and xbee coordinator node.

thanks for your help :D
userHeadPic uyacakra
2012-06-08 02:36:38 thanks for help,

now I have 2 side :
1. node side is arduino + sensor + xbee (like this [url=http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/]http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/[/url])
2. coordinator node side is xbee + xbee explorer + USB cable (like this [url=http://dlnmh9ip6v2uc.cloudfront.net/images/products/08687-07-L.jpg]http://dlnmh9ip6v2uc.cloudfront.net/images/products/08687-07-L.jpg[/url])

and now, what is the line of code I must put ini my source code (*.ino on xbee node -in arduino ATmega microcontroller- and *.pde on coordinator node to catch the transmit data from the node) to make the arduino transmit the data from sensor to computer by xbee node and xbee coordinator node.

thanks for your help :D
userHeadPic uyacakra
2012-06-07 08:23:10 Hi,

until now I feel I can help - so no problem ;) .

Maybe, first of all, let we go through your equipment. On transmitting side there is a sensor which is connected to Arduino and XBee sending the data. On receiving side is receiving XBee and ... what ?? Another Arduino connected via USB to PC ?? Or there is something else ??

Reading your posts I feel that you connected first your sensor to Arduino which makes some handling operations with sensor data and you use USB connection (cable) between Arduino and PC to display the values.
Now you would like to replace the USB cable for XBee connection. If I understand this well the transmission part should consist of Sensor-Arduino-Xbee (in some cases, i.e. if you don't need controller to read sensor you may connect sensor directly to XBee).
So the data are in the air and now you need something to catch them and display them on PC again. So definitely you need another (receiving) XBee. Further there is a question HOW you would like to display it on PC. If there will be enough to open PC Serial terminal window and see what data are coming than you need something like this - [url=https://www.dfrobot.com/index.php?route=product/product&filter_name=xbee&product_id=588]https://www.dfrobot.com/index.php?route=product/product&filter_name=xbee&product_id=588[/url] . This adapter translates the TTL data on XBee output into USB and you may see it on Serial terminal window on PC. Whether you need to further handle coming data before displaying them than you have add another controller (Arduino) on receiving side ....

So back to the beginning - WHAT sensor is measuring the data and HOW it should be displayed on PC (under which PC programme) ??

Bye for now
Vladimir
userHeadPic synekvl
2012-06-07 08:23:10 Hi,

until now I feel I can help - so no problem ;) .

Maybe, first of all, let we go through your equipment. On transmitting side there is a sensor which is connected to Arduino and XBee sending the data. On receiving side is receiving XBee and ... what ?? Another Arduino connected via USB to PC ?? Or there is something else ??

Reading your posts I feel that you connected first your sensor to Arduino which makes some handling operations with sensor data and you use USB connection (cable) between Arduino and PC to display the values.
Now you would like to replace the USB cable for XBee connection. If I understand this well the transmission part should consist of Sensor-Arduino-Xbee (in some cases, i.e. if you don't need controller to read sensor you may connect sensor directly to XBee).
So the data are in the air and now you need something to catch them and display them on PC again. So definitely you need another (receiving) XBee. Further there is a question HOW you would like to display it on PC. If there will be enough to open PC Serial terminal window and see what data are coming than you need something like this - [url=https://www.dfrobot.com/index.php?route=product/product&filter_name=xbee&product_id=588]https://www.dfrobot.com/index.php?route=product/product&filter_name=xbee&product_id=588[/url] . This adapter translates the TTL data on XBee output into USB and you may see it on Serial terminal window on PC. Whether you need to further handle coming data before displaying them than you have add another controller (Arduino) on receiving side ....

So back to the beginning - WHAT sensor is measuring the data and HOW it should be displayed on PC (under which PC programme) ??

Bye for now
Vladimir
userHeadPic synekvl
2012-06-07 04:46:57 thanks for the reply

I use *.ino for programming the arduino microcontroller, in file *.ino I wrote the code taht read and process data that I need. And I use *.pde to make a visualisation on my computer using direct connect arduino and my computer with USB mount A-B (I use arduino uno R2).

And now I want to use Xbee to make a wireless connection so I don't need USB cable anymore to transmit data from arduino that connect with a sensor to my computer. [u]But I confused about the programming code[/u]. For schematic how to connect arduino board and Xbee, I found on [url=http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/]http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/[/url] but I've never try to make this connection mode.

thanks for your help
best regards,

Uyacakra, Indonesia
userHeadPic uyacakra
2012-06-07 04:46:57 thanks for the reply

I use *.ino for programming the arduino microcontroller, in file *.ino I wrote the code taht read and process data that I need. And I use *.pde to make a visualisation on my computer using direct connect arduino and my computer with USB mount A-B (I use arduino uno R2).

And now I want to use Xbee to make a wireless connection so I don't need USB cable anymore to transmit data from arduino that connect with a sensor to my computer. [u]But I confused about the programming code[/u]. For schematic how to connect arduino board and Xbee, I found on [url=http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/]http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/[/url] but I've never try to make this connection mode.

thanks for your help
best regards,

Uyacakra, Indonesia
userHeadPic uyacakra
2012-06-05 00:37:16 Hi Uyacakra,

I can confirm Hector's contribution that setting-up of XBee network is maybe not very difficult but rather more complex thing. Writing the sketch for Arduino is only one part of the process.

Another thing is setting of XBees themselves. You need for that to get the software from Digi here [url=http://www.digi.com/support/productdetail?pid=3352]http://www.digi.com/support/productdetail?pid=3352[/url] called X-CTU. It allows you to set the basic parametres of the network and upgrade the firmware.

I suggest to you to get some book about XBee networks, i.e. link on one of them is [url=http://oreilly.com/catalog/9780596807740?cmp=il-orm-ans-learnmore-9780596807740]http://oreilly.com/catalog/9780596807740?cmp=il-orm-ans-learnmore-9780596807740[/url] (it is in the link you mentioned in your last message). In such books you may find the theory how it works, how to set-up XBees and there are also the sample sketches for Arduino.

Another good source is the book "Arduino Cookbook, 2nd Edition" by O'Reilly Media where is also one project using XBee.

So now you have to learn a few basic things in order to start  ;) ...

But please don't forget you also need some hardware i.e. for setting XBees ...  :) - some breadboard (XBee explorer) in order to connect it via USB to PC.

So that's for now.

Cheers
Vladimir
userHeadPic synekvl
2012-06-05 00:37:16 Hi Uyacakra,

I can confirm Hector's contribution that setting-up of XBee network is maybe not very difficult but rather more complex thing. Writing the sketch for Arduino is only one part of the process.

Another thing is setting of XBees themselves. You need for that to get the software from Digi here [url=http://www.digi.com/support/productdetail?pid=3352]http://www.digi.com/support/productdetail?pid=3352[/url] called X-CTU. It allows you to set the basic parametres of the network and upgrade the firmware.

I suggest to you to get some book about XBee networks, i.e. link on one of them is [url=http://oreilly.com/catalog/9780596807740?cmp=il-orm-ans-learnmore-9780596807740]http://oreilly.com/catalog/9780596807740?cmp=il-orm-ans-learnmore-9780596807740[/url] (it is in the link you mentioned in your last message). In such books you may find the theory how it works, how to set-up XBees and there are also the sample sketches for Arduino.

Another good source is the book "Arduino Cookbook, 2nd Edition" by O'Reilly Media where is also one project using XBee.

So now you have to learn a few basic things in order to start  ;) ...

But please don't forget you also need some hardware i.e. for setting XBees ...  :) - some breadboard (XBee explorer) in order to connect it via USB to PC.

So that's for now.

Cheers
Vladimir
userHeadPic synekvl
2012-06-04 19:19:05 Hi Uyacakra,


The *.INO is the NEW Arduino format starting with IDE V1.0. The *.PDE is the old format from IDE v0023


You can combine both into *.INO if you are using the new IDE, you can download it directly from Arduino.cc


You might need to change some commands in the old code to be compatible with the new version.


Making a Mesh network with Xbee is not very easy. It depends more on the Xbee configuration rather than on the Arduino. You will need to use the Xbee configuration software to setup your mesh network, this also depends on the model of Xbees you are using.  I can not help you with that part since I have never gone through the process.







userHeadPic Hector
2012-06-04 19:19:05 Hi Uyacakra,


The *.INO is the NEW Arduino format starting with IDE V1.0. The *.PDE is the old format from IDE v0023


You can combine both into *.INO if you are using the new IDE, you can download it directly from Arduino.cc


You might need to change some commands in the old code to be compatible with the new version.


Making a Mesh network with Xbee is not very easy. It depends more on the Xbee configuration rather than on the Arduino. You will need to use the Xbee configuration software to setup your mesh network, this also depends on the model of Xbees you are using.  I can not help you with that part since I have never gone through the process.







userHeadPic Hector
2012-06-04 06:38:46 thanks for your help all, now i got a simple schematic on here [url=http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/]http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/[/url] is this right?

but now I'm confused about the program code on arduino (*.ino) and on xbee receiver (*.pde). what the program code should I put there to make them connected sent and receive data on a mesh topology.

Sorry for many question, I just want to know cause I'm newbie for robotics
Best Regards, uyacakra, Indonesia
userHeadPic uyacakra
2012-06-04 06:38:46 thanks for your help all, now i got a simple schematic on here [url=http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/]http://answers.oreilly.com/topic/2458-how-to-connect-an-arduino-to-an-xbee-radio/[/url] is this right?

but now I'm confused about the program code on arduino (*.ino) and on xbee receiver (*.pde). what the program code should I put there to make them connected sent and receive data on a mesh topology.

Sorry for many question, I just want to know cause I'm newbie for robotics
Best Regards, uyacakra, Indonesia
userHeadPic uyacakra
2012-06-03 12:20:20 Maybe the first question is: how your sensor/arduino is powered ?? Can be powered 5V from mains adapter or it is remote sensor and it is powered by accu ?? If the sensor and arduino can be supplied by 5V from mains, take arduino and relevant XBee shield as The Crusher suggested. If your remote set is going to be placed somewhere where is not electricity, let think about battery or accu and i.e. solar re-charging of the accumulator.

Nevermind for both variant there exists XBee library with attached examples on internet - there is nearly everything you need to write your own sketch.

Enough to start - if not let us know .....  ;)

Cheers
Vladimir

userHeadPic synekvl
2012-06-03 12:20:20 Maybe the first question is: how your sensor/arduino is powered ?? Can be powered 5V from mains adapter or it is remote sensor and it is powered by accu ?? If the sensor and arduino can be supplied by 5V from mains, take arduino and relevant XBee shield as The Crusher suggested. If your remote set is going to be placed somewhere where is not electricity, let think about battery or accu and i.e. solar re-charging of the accumulator.

Nevermind for both variant there exists XBee library with attached examples on internet - there is nearly everything you need to write your own sketch.

Enough to start - if not let us know .....  ;)

Cheers
Vladimir

userHeadPic synekvl
2012-06-02 11:46:07 Hi uyacakra,

You can buy the [url=https://www.dfrobot.com/index.php?route=product/product&path=35_39&product_id=61]Xbee shield for arduino[/url] and just plug the Xbee on the shield, and the shield on the arduino.

Hope this helps.

Regards,
The Crusher
userHeadPic The Crusher
2012-06-02 11:46:07 Hi uyacakra,

You can buy the [url=https://www.dfrobot.com/index.php?route=product/product&path=35_39&product_id=61]Xbee shield for arduino[/url] and just plug the Xbee on the shield, and the shield on the arduino.

Hope this helps.

Regards,
The Crusher
userHeadPic The Crusher
2012-06-02 06:32:20 Please someone in this forum, I want to make my data on sensor that connected with my arduino can sent to my computer via wireless that using xbee.

I there someone can help me give a tutorial and schematic how to connect xbee and arduino. I want use a mesh topology too if possible
userHeadPic uyacakra