SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By equipoise
#172571
I've just received an Arduino Leonardo, an Xbee Shield, an Xbee Explorer, and 2 Xbee modules. I'm trying to run through the tutorials to get one Xbee to communicate with the other and have run into a problem. Here it is:

Following the tutorial at https://learn.sparkfun.com/tutorials/xb ... troduction, I've worked through the "Introduction" and "Hardware Overview" pages. I installed XCTU, then mounted an Xbee board onto the Xbee Explorer, plugged it into my host computer, ran XCTU and configured the Xbee using the "Add a radio module" and so forth. So far so good, it seems to configure perfectly.

Next, I want to similarly configure the second Xbee board, as told to do on the tutorial's "Example: Communications Test" page (https://learn.sparkfun.com/tutorials/xb ... ation-test). I mounted this second Xbee onto the Xbee Shield that is itself plugged into the Arduino Leonardo, and plug the Arduino into a different USB port on the host computer. The switch is in the "DLine" position.

Problem:
When I try to get XCTU to add this second module, XCTU lists the USB port that the Arduino/Xbee Shield/Xbee tripledecker is plugged into; the port name looks fine ("usbmodemfd..."). But, when I pick this port and then hit the "Finish" button in XCTU, I get a warning that I need to reset the Xbee. When I press the reset button on the Xbee shield, there doesn't seem to react and I end up cancelling. I then tried socketing the second Xbee module in the Xbee Explorer and seeing if that will do it, but XCTU warns me that there is already an Xbee radio associated with that port so I cancelled that try.

This leaves me unable to move on to installing and running the Arduino sketch that allows me to verify communication between the two Xbee's, as described on the communications test page.

Questions:
How can I configure the second Xbee when it is mounted onto an Arduino with Xbee shield? Isn't this what is intended in this tutorial? It shows this kind of setup being used to test communications on the tutorial communications test page; do I need some other setup to get things configured? Do I need to use 2 Xbee Explorers to get things setup and then move one Xbee to the shield and Arduino? Is there some sketch I should first load onto the Arduino? I've done this with a brand spankin' new Arduino, which has whatever sketch it comes with. Through all of this I've had the shield in the "DLine" switch position; is there some period when it should be in the "UART" position? And when the time comes to move the sketch onto the Arduino, do I need to first remove the Xbee shield or put the switch into a particular position? I've assumed "DLine" would be used for everything, as suggested in the tutorial.

Thanks.

-- equipoise
By equipoise
#172572
OK, I have an update: I found after playing with things that I could get the second, Arduino-mounted Xbee to send data to the Xbee mounted on the Xbee Explorer.

To do this involved several changes. I removed the Xbee shield from the Arduino before I then loaded the sketch given on the Sparkfun tutorial page onto it. After this I disconnected the Arduino from the host computer, remounted the shield to the Arduino, and plugged the Arduino back into the host. In XCTU I bypassed configuration of the Xbee on the Arduino. Apparently, the default configuration allows it to see the Xbee Explorer. Using the console of XCTU associated with the Xbee Explorer, I opened the Serial Monitor in Arduino. Text I enter into the SerialMonitor shows up in the XCTU console, but text entered into the console doesn't reciprocally show up in the Serial Monitor.

Can anyone offer suggestions on how to get two way comms going?

-- equipoise
By stevech
#172582
Xbee Series 1 or Series 2? I hope, Series 1.
Read/re-read Digi International's XBee User/OEM guide?

Using an Arduino? And the XBee library?

many of the XBee explorers had a diode in series with a data line - as a mickey-mouse 5V to 3.3V converter. But it can't work. And it doesn't, well.
By equipoise
#172596
Yes, I've been using the series 1 Xbee for this. What I describe was with an Arduino Leonardo, using the native libraries (#include <SoftwareSerial.h>) and did not use the Xbee library. The code source for the Arduino sketch is on the linked page. I've looked over the digi.com documentation but have not read it in depth.

As a complete Xbee beginner I had hoped the Sparkfun tutorial would get me up and running, but there is obviously supplementary information or knowledge I need. For example, I see nothing regarding use of AT or API mode in the tutorials.

By playing with things in XCTU I have now been able to get the Xbees to talk to each other using API mode. I arranged for the Explorer to send a single frame and got a 3 character frame back from the Arduino-mounted Xbee. But there's no sign that the Arduino is doing anything other than acting as a power supply. What I really hope to learn is how to have something communicated by radio from the Xbee Explorer to the Arduino-mounted Xbee, and to have the Arduino sketch there do something with the data that was communicated. So far I see no sign of this.

The Xbee Explorer is brand new and has the reset switch for the Xbee on it.

-- equipoise
By stevech
#172661
equipoise wrote:... there's no sign that the Arduino is doing anything other than acting as a power supply. What I really hope to learn is how to have something communicated by radio from the Xbee Explorer to the Arduino-mounted Xbee, and to have the Arduino sketch there do something with the data that was communicated. So far I see no sign of this.
-- equipoise
Tell us you goal and what code you have or plan to write in C/C++ for the Arduino MCUs.
With *no* connected MCU (e.g., Arduino mega32), the XBee can do a lot if you configure it correctly. Such as
Sample analog voltages and send samples every x amount of time to a designated XBee.
Sample digital inputs as above.
Send change of state of digital inputs, as above.
Turn digital output bits on/off according to command from the mating XBee.
Have a scheduled power-saving sleep, if battery powered.
These are called Virtual Wire and are in the XBee's firmware.

Your hub XBee or base station, can interface via UART/serial to a PC or RPi or some such and do all the control and data processing.
Or the hub XBee can connect by UART to an Arduino at the hub (e.g., a "shield") and all the logic as above could be done by your code on the Arduino MCU instead of in the PC.

Glad to help, but what's the game plan?
No doubt you've read the XBee user/OEM guide which takes 4 read-throughs to get the idea of what can be done where.