SparkFun Forums 

Where electronics enthusiasts find answers.

All things pertaining to wireless and RF links
By chrisjx
#158738
I'm using the xbee series 1 modules on 2 xbees and I would like them to communicate, 2-way.

I set up the xbees like this (these are the only changes I made):

// XBee #26:
// PAN ID: 1111
// DH: 0
// DL: 1A
// MY: 17
//

// XBee #23:
// PAN ID: 1111
// DH: 0
// DL: 17
// 0 MY: 1A

My understanding is they are now configured to talk directly to each other...

Now the question, Serial or Serial1? Where is this documented. I've seen some references about changing Serial.begin() to Serial1.begin() but where's the definitive documentation for the V3 version of this product?

Basically I expect each fioV3 could have the very same code and transmit their data to each other.

Should I consider SoftwareSerial Library?

Hints, tips, examples of code that works on the fio to cross communicate would be appreciated.


Thanks,
Chris.
By saibur
#170751
Looks like there's better documentation now:
https://learn.sparkfun.com/tutorials/pr ... okup-guide
Code: Select all
void loop()
{
 Serial.println("Hello world");  // Print "Hello World" to the Serial Monitor
 Serial1.println("Hello!");  // Print "Hello!" over hardware UART
}
...
In that sketch, you’ll also notice a pair of Serial initialization statements: Serial.begin(9600), Serial1.begin(9600). That ‘1’ makes a huge difference. Think of the Pro Micro having two separate serial ports. The one without the ‘1’ is for communication to and from the computer over USB; this is what is visible in the Serial Monitor. The Serial1 port is a bonafide, hardware UART, where your Pro Micro can talk to any serial-enabled piece of hardware.
By Valen
#170784
saibur wrote:You'll also need to use the XCTU interface to change the firmware on one of so that it becomes a Coordinator. They are all set to Router by default. Get the software here: http://www.digi.com/products/wireless-w ... dules/xctu
Not in my experience. The series 1 modules can communicate with eachother in non-beacon mode. No need to give each a router, coordinator or end-device firmware. But XCTU does make it easier to change the register settings. However, XCTU needs to be able to talk to the XBee directly but the Fio does not allow this by default.

The problem that chrisjx runs into is not a Xbee problem, but a Ardiuno Fio design feature. (like you showed with your earlier post) He has more than 1 serial port in his Fio, but doesn't know which one he needs to adress for communication with the Xbee. (Which pins are considered Serial, Serial1 should be found on the Arduino wiki/site/forum, or if it is the Sparkfun design in the schematic in the product page.) Also, the Fio doesn't forward data between the serial ports by default (for good reason). So the serial communication between the Xbee and the Fio does not end up in the serial monitor of the Arduino IDE. There are plenty examples on how to write code that makes communication get forwarded between these serial ports. The Leo and Mega have the same 'problem'.
Last edited by Valen on Mon May 05, 2014 3:33 pm, edited 1 time in total.
By waltr
#170799
Yep, what Valen wrote.

The way to solve this is direct connection of the fios without the XBees. Once this is waorking correctly then it should be a simple matter of inserting the XBees to make a RF link.
By Valen
#170807
To test the program code that allows passthrough of data from one serial line to the other and vice-versa, I would first connect the RX and TX (pin 0 an 1) of the Fio together to make a loop-back connection. No need for an XBee on the board yet. If the forwarding code works good then whatever is send via the serial monitor should go out through the TX pin and directly back into the Fio via the RX pin, and eventually a copy back on the Serial monitor window.

If that works then it is possible to use the XCTU program to program the Xbee. Or be able to eavesdrop on the communication between the Fio and it's connected Xbee. Updating the firmware will not be possible without proper connection of the RTS and DTR line. So I would get something like the XBee Explorer USB anyway to be able to do this.