Xbee Communication help please

Hi there,

I am new here. Been looking for help with ZigBee communication.

I have 2 xbee pro S2B modules sitting on zibee shields on UNO R3 boards

Coordinator:

ID = 1212
DH = 0013A22
DL (Router address as only going to communicate with the one) - 40AC0BC2

Router:

ID = 1212
DH = 0013A200
DL (cordinator address) - 40AC0BD9

I can communicate with these in XCTU. The reciver will get the data sent.

These are the sketches:

Coordinator

#include <SoftwareSerial.h>

SoftwareSerial zigBee(3,2);

void setup() {
  Serial.begin(9600);//begin hardware serial (PC<->arduino)
  zigBee.begin(9600);//begin software serial (xbee<->arduino)
}

void loop() {
  zigBee.println("Hello! Anyone there?");
  Serial.println("Sending 'Hello! Anyone there?'");
  delay(5000);
}

Receiver

#include <SoftwareSerial.h>

SoftwareSerial zigBee(3,2);

char data;

void setup() {
  Serial.begin(9600);

  zigBee.begin(9600);
  Serial.println("x~ started ~x");
}

void loop() {
  if (zigBee.available()) {
    Serial.println("data recieved");
    data = zigBee.read();

    Serial.print(data);
  }
}

But I am not getting the data on the reciever. I am not getting into the if(zigBee.available()) so not receiving any data.

Is there something I am missing? Just need the very simple communication for now. I have been at this for ages and I am stuck.

Are you running the Zigbee firmware on the Xbee or something else?
Your code assumes "transparent mode" but the Zigbee firmware on the Xbee doesn't have a transparent mode.

Correction: For S2B
"RF modules that contain the following firmware versions will support Transparent Mode:
20xx (AT coordinator), 22xx (AT router), and 28xx (AT end device)."

Are you running the Zigbee firmware on the Xbee or something else?
Your code assumes "transparent mode" but the Zigbee firmware on the Xbee doesn't have a transparent mode.

@mikb55

Im running it on an arduino. I have 2 xbee pro s2b's with a shield. Ive routed the xbee serials to pis 2 and 3 using cables. This was the setup we used in uni where I first messed with arduino a bit. I am following the same setup and info, but cant get it to work. I have seen that they communicate using xctu so I know they are able to comunicate. Just can't figure out where I am going wrong or what I am missing.

I have actually worked it out. I used a different shield and sent the data via Serial. Worked straight away. So there was something with the previous shield. I think it works, just something I maybe have not understood about it. But it works perfectly now. Time to mess with a few things. Thnk you for helping me out :slight_smile:

Forgot to mention. The Equipment, settings and firmware were: -

The Router:
-- equipment --
Board: Arduino UNO R3
Shield: libelium ArduinoXBee v1.1
Adapter/programmer: ICStation XBee USB Adapter

Wireless RF module: XBee pro S2B XBP24BZPIT
--XBee settings--
Family: XBP24BZ7
Functions: ZigBee Router AT
Firmware ver: 22A7