Simple Arduino Uno and two XBee S1

Hello!

I purchased the XBee Wireless Kit Retail (RTL-09897) 6 years ago along with my Arduino Uno and had a lot of fun playing with it then. Fast-forward 6 years and I’ve rediscovered my interest in electronics so I took my kit out of storage and now I am trying to remember how to use it. I knew I was going to hit trouble with 6 year old hardware v.s. updated software (i.e… xctu) so below is my setup and problem.

Project: Have a single LED light turned on/off wirelessly by sending a character through the serial communication from my laptop. H = Turn the LED on for 10 secs, anything else should turn the LED off for 10 secs, otherwise keep blinking.

Hardware: I have 1x Arduino Uno, 1x XBee Shield, 1x XBee USB Explorer, 2x XBee S1.

Problem: I’ve read [Sparkfun’s Exploring XBees and XCTU guide along with many other internet guides but they all assume you can connect two XBee’s to your computer at the same time, but I can’t because I only have one XBee USB Explorer. So I follow the guide very closely, configure the CH, ID, DH, DL respectfully for each XBee but cannot figure out how to send a character from the USB connected XBee to the other on the Arduino. I remember doing this originally with the Serial Monitor provided with the Arduino IDE but now when I open that and type either nothing happens in the text area below or I see a bunch of garbage characters.

Direct Question: How do I send data (number, characters, or strings) from the USB Explorer connected XBee to the one attached to my Arduino?

Software:

Fedora 26

Linux 4.13.5-200.fc26.x86_64 #1 SMP Thu Oct 5 16:53:13 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux

XCTU Version 6.3.10, Build ID: 20170928-2

Arduino IDE 1.6.6

Note: That I am running all of this as the root user so it has full access.

XBee Sheild:

Set to DLINE

XBee 1 Setup (Connected to my PC via USB Explorer):

Series: 1

Product Family: XB24

Function set: XBEE 802.15.4

Firmware version: 10ef

Baud: 9600

CH: C, ID: 555, DH: 0, DL: 2, MY: 1, CE: Coordinator [1]

AP: API enabled w/ PPP [2]

XBee 2 Setup (Connected Arduino Uno via XBee Shield):

Series: 1

Product Family: XB24

Function set: XBEE 802.15.4

Firmware version: 10ef

Baud: 9600

CH: C, ID: 555, DH: 0, DL: 1, MY: 2, CE: End Device [0]

AP: API enabled w/ PPP [2]

Now when XBee1 is connected to my PC I can use the XCTU Discovery Mode to see the visualization graph of the connected devices. It successfully displays that XBee1 (Coordinator) is connected to another XBee2 device but it’s Role is shown as Unknown. That’s concerning because I would think it should display End Device.

http://stevenz.io/wp-content/uploads/20 … covery.png

Now if I try to send a character using Arduino Serial Monitor it will either display no characters or garbage characters, more importantly nothing happens to the LED light and it keeps on blinking which implies no data is being transmitted at all.

http://stevenz.io/wp-content/uploads/20 … 68x298.png

Here is the code loaded on the Arduino.

#include <SoftwareSerial.h>
SoftwareSerial XBee(2, 3); // RX, TX

int ledPin = 13;

void setup()
{
  XBee.begin(9600);
  pinMode(ledPin, OUTPUT);
}

void loop()
{
  if (XBee.available()) {
    char c = XBee.read();
    if (c == 'H')
    {
      // stay on for 10 secs if you see an H
      digitalWrite(ledPin, HIGH); delay(10000); 
    }
    else{
      // stay off for 10 secs for anything else
      digitalWrite(ledPin, LOW); delay(10000); 
    }
  }
  else{
    // just blink on/off when there is no communication.
    digitalWrite(ledPin, HIGH); delay(200); digitalWrite(ledPin, LOW);  delay(200);
  }
}

Question: Am I using the SoftwareSerial and XBee library correctly? Are these compatible with the devices I have? Is it good for XBee S1? Also where is the documentation for the XBee library, where can I find out what functions exist and what they do?

Any help at all is appreciated, this is only the first step in a very long journey I have planned.](https://learn.sparkfun.com/tutorials/exploring-xbees-and-xctu/all.pdf)

Update: Has anyone here accomplished this? I gave up on trying the simple approach of using the built-in tools and started opting for the more complicated route. I wrote a Java application using the XBee Java Library and after hours headaches over there I finally have a [running example just like this one.

I can say for certain that two XBee’s are somehow connected to each other on the same network because this Java library proves that it can also discover the other XBee by Node Identifier which makes me feel great.

The problem still seems to be that whatever data I attempt to send over serial to USB Explorer XBee just doesn’t make it’s way over the air to the other XBee?

I read the description of UART v.s. DLINE and understand that it should be DLINE when I’m programming the XBee but should it be flipped back to UART when I’m trying to really use the device? Either way it still doesn’t work.

Is the XBee shield ALWAYS connected to pins 2,3 for RX,TX respectfully? It feels as though that might be the problem.

// XBee's DOUT (TX) is connected to pin 2 (Arduino's Software RX)
// XBee's DIN (RX) is connected to pin 3 (Arduino's Software TX)
SoftwareSerial XBee(2, 3); // RX, TX ... How do I know if this correct?

](xbee-java/examples/communication/SendDataSample/src/com/digi/xbee/api/senddata/MainApp.java at master · digidotcom/xbee-java · GitHub)

You have both Xbees in API mode. That requires all the packet header byte,adressing, packet length, payload data and an error detection values to be assembled in to a specific format. If the Xbee doesn’t understand what you sent (a single character isn’t a complete packet) then it ignores it. Details are in the manual for the chip.

If you instead set the AP register to AT mode then the modules should link up automatically with those address-values (I think!?! It’s been a while for me using them)

The seemingly garbage characters that you received in the serial monitor are infact packets of bytes stating the status of something that happend. In the Arduino Serial monitor it is of little use. But if you were to use a serial terminal program that could show the hex values of each character then you would be able to decode it. (with the manual and API description.)

This is the manual: http://www.digi.com/resources/documenta … 001500.pdf

More technical documents can be found here: https://www.digi.com/products/xbee-rf-s … uctsupport