Pages: [1]   Go Down
Author Topic: Communication of Arduino UNO + Shield and USB Explorer with XBee S2  (Read 1221 times)
0 Members and 1 Guest are viewing this topic.
Belgium
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hello,

To be very clear, these are my components:
- 2 x XBee S2
- Arduino UNO R3
- Arduino Wireless Proto Shield
- USB Explorer from Sparkfun
- CMPS10 - Tilt Compensated Compass Module

I already managed to read the sensor through the USB of the arduino to the serial monitor. I also configured the 2 Xbee devices using the USB explorer and X-CTU. The XB24-ZB ZIGBEE COORDINATOR AT device has adress 13A200/406FE179 and the XB24-ZB ZIGBEE ROUTER AT device has adress 13A200/407C4A6A. I've set both their pan ID's to 1111 and baud rate to 3-9600. I've also entered the adress of the router as the destination adress high and low (DH and DL) of the coordinator and vice versa.
So I think i configured both XBee devices right ?

Now I plugged the coordinator on the usb explorer and the router on the shield + arduino. The communication with the coordinator using the X-CTU terminal works very well. To test the communication with the router on the shield, I uploaded an empty sketch and put the switch of the shield in USB mode. Then I thought it would also be possible to program the XBee with the serial monitor (but when I type +++, I don't get 'OK')
What am I doing wrong ?

The final goal of the project is to read the sensor and send it from the arduino to the usb explorer and display the value on the computer screen. If you can give me good advice to get this work, it would be great! (I think hardware isn't the problem but i'm a software newbee)
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 654
Posts: 50956
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Then I thought it would also be possible to program the XBee with the serial monitor (but when I type +++, I don't get 'OK')
Why do you want to do this? It's far easier to put the XBee on the USB Explorer and program it that way.

Which shield? The one from Sparkfun?

I find it easiest to have two USB Explorers, and get the XBees talking to each other before worrying about connecting them to the Arduino. Once I know the XBees talk, getting data from the Arduino to the PC, via the XBees, has never been a problem.
Logged

Belgium
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Which shield? The one from Sparkfun?

I'm using this shield: http://arduino.cc/en/Main/ArduinoWirelessProtoShield

You can find on that webpage: "With the switch in the USB position, the DOUT pin the wireless module is connected to the RX pin of the USB-to-serial converter, and DIN on the wireless module is connected to the TX pin of the USB-to-serial converter. This means that the module can communicate directly with the computer. The microcontroller on the board will be bypassed. To use the shield in this mode, you must program the microcontroller with an empty sketch (shown below), or remove it from the board."

It is not really necessary to program the Xbee with the shield but they say it's possible so i wanted to try it out smiley

I don't got a second XBee exploder (maybe i'll order a second one later but i first want to try to get communication with my arduino). What i need to know right now is: What kind of program code do i need to get on the microcontroller of the arduino in order to send it through the xbee? For example: If I put the same code on it that reads my sensor and sends the info through the USB to my pc (Serial.begin(9600), Serial.print(..), etc stuff). Does it send that information to the XBee or not? Or what commando do i need ? (I've read XBee wants UART?) And how can I read the information out of the USB explorer (if it receives data ...) ? Does it appear on the Terminal of X-CTU ?
Logged

Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 654
Posts: 50956
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No one makes a really good XBee shield. Sparkfun's suffers from the fact that you can select pins 0 and 1 or pins 2 and 3 for the Arduino to communicate with the XBee.

The Arduino one suffers from the fact that you can choose to let the XBee talk to pins 0 and 1 or not. There is no other choice. In order for the PC or the Arduino to talk to the XBee, the switch must be in the Serial position. The USB position gets the Arduino out of the circuit, so you can upload new sketches without the XBee interfering.
Logged

Belgium
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the help!

I found a solution for my problem:
Fot the configuration of the XBee's, i first restored them to the original settings and only adjusted the parameters needed (following the guide of this topic: http://arduino.cc/forum/index.php/topic,125324.0.html)

I just uploaded the same code on the arduino which i used to transmit data via the USB-cable to my pc (switch of shield in USB mode), to get that XBee (on the arduino) send that info to the other XBee (on the USB Explorer) you need to PUT THE SWITCH TO MICRO MODE!!!
In my opinion that's a bit weird because the rx ledon the arduino is blinking while you are transmitting data, when you put it in usb mode: the tx led is blinking while you are receiving data (the arduino code) ...

One more question: Do you know how to store the information of the X-CTU terminal somewhere? (For example Excel sheet, Matlab, Labview, ...)
Logged

Pages: [1]   Go Up
Jump to: