Sending frames to XBee

Hi, I am using an Arduino Nano connected via UART to a XBee3 Sender device that is going to send data to another XBee3 Receiver device. The TX (pin 3) of the XBee Sender is connected to the RX pin of Arduino, the RX (pin 2) of the XBee Sender is connected to the TX pin of Arduino. The 3.3V pin on the XBee Sender is connected to the 3.3V pin of the Arduino, and the ground pins are connected as well. I need to send about 50 frames with the maximum amount of bytes in each frame from the Arduino to the Sender, then get the Sender to send them to the Receiver, followed by the Receiver providing an acknowledgement that the packet is received. However, I am not sure on how to do that, help is greatly appreciated!

Sender configuration in XCTU: ID - 2015, CE - Enabled [1], NI - SENDER, AP - API Enabled[1]
Receiver configuration in XCTU: ID -2015, JV - Enabled [1], NI - RECEIVER, AP - API Enabled[1]

Digi XBee 3
Digi XBee 3 Schematic
Arduino Nano ATmega328P

I have tried a code meant for Series 2 (can't seem to find any documentation on Series 3) but does not work:

#include <Printers.h>
#include <XBee.h>
#include <SoftwareSerial.h>

/*
  This example is for Series 2 XBee
  Sends a ZB TX request with the value of analogRead(pin5) and checks the status response for success
*/

XBee xbee = XBee();

uint8_t payload[] = { 0, 0 };

// SH + SL Address of receiving XBee
XBeeAddress64 addr64 = XBeeAddress64(0x0013A200, 0x41AE9DBC);
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));
ZBTxStatusResponse txStatus = ZBTxStatusResponse();

int pin5 = 0;

int statusLed = 13;
int errorLed = 13;

void flashLed(int pin, int times, int wait) {
  for (int i = 0; i < times; i++) {
    digitalWrite(pin, HIGH);
    delay(wait);
    digitalWrite(pin, LOW);

    if (i + 1 < times) {
      delay(wait);
    }
  }
}

void setup() {
  pinMode(statusLed, OUTPUT);
  pinMode(errorLed, OUTPUT);

  Serial.begin(9600);
  xbee.setSerial(Serial);
}

void loop() {
  pin5 = analogRead(5);                          // break down 10-bit reading into two bytes and place in payload
  payload[0] = pin5 >> 8 & 0xff;
  payload[1] = pin5 & 0xff;

  xbee.send(zbTx);

  flashLed(statusLed, 1, 100);                   // flash TX indicator

  //after sending a tx request, we expect a status response, wait up to half second for the status response
  if (xbee.readPacket(500)) {
    // got a response!

    // should be a znet tx status
    if (xbee.getResponse().getApiId() == ZB_TX_STATUS_RESPONSE) {
      xbee.getResponse().getZBTxStatusResponse(txStatus);

      if (txStatus.getDeliveryStatus() == SUCCESS) {
        flashLed(statusLed, 5, 50);
        Serial.println("SUCCESS");
      } else {
        flashLed(errorLed, 3, 500);                   //the remote XBee did not receive our packet. is it powered on?
        Serial.println("NOT RCVD");
      }
    }
  } else if (xbee.getResponse().isError()) {
    Serial.print("ERROR");
    //nss.print("Error reading packet.  Error code: ");
    //nss.println(xbee.getResponse().getErrorCode());
  } else {
    // local XBee did not provide a timely TX Status Response -- should not happen
    flashLed(errorLed, 2, 50);
  }
  delay(1000);
}

/*
//turn on external LED when data is available (does work)
void setup() {
  pinMode(8, OUTPUT);
  digitlWrite(8, LOW);
  Serial.begin(9600);
}

void loop() {
  for (int i = 0x01; i < 0x33 ; i++){
    Serial.println(i, HEX);
    delay(100);
  }
  if (XBee.available() > 0){
    delay(1);
    digitalWrite(8, HIGH);
  } else {
    digitalWrite(8, LOW);
  }
}
*/

Is the Xbee plugged into a level shifting adaptor, or have you directly connected the Xbee pins to the Arduino?
The Xbee pins are tiny so I imagine that you are using an adaptor. If not then you have already destroyed the Xbee by putting 5v into the Rx pin.

Have you been able to get the 2 Xbees communicating by using the diagnostic tools in the XCTU program? If not then you need to do that first.

There are several 'Xbee3 for beginners' type videos on Youtube and Sparkfun has a bunch of information about Xbee3.

Hi, thanks for the reply.
You mean that I cannot connect the TX and RX pin directly from the Arduino to the XBee device? Is there a way to know if the device is destroyed?
I am able to get the XBees communicating and I have went through the examples in the XBee Mesh Kit Guide.
Will take a look at the videos and sparkfun. However, are there any tutorials on XBee3 with Arduino Nano? Am I able to use Series 1/2 examples with the Series 3 XBees? If not, may I know what are the differences?
Thank you.

If you can still talk to the Xbee via XCTU and communicate with another Xbee then it is still working. If it can longer communicate with other Xbees then it is has been damaged beyond repair.

It would appear that you are using the Digi "XBee SMT Grove Development Board" which does not include any level shifting circuitry. Everything you connect to it must be 3.3v only. This makes the Nano unsuitable unless you plan to add your own level shifting circuitry.

Also the Xbee3 SMT modules you are using are not compatible with any of the Xbee level shifting adaptors available from Sparkfun which require socketed pins. You are either going to need to use resistive dividers or a proper level shifting IC.

The easiest option is to replace the Nano with one of the more modern Arduinos that runs at 3.3v. Alternatively you could add your own level shifting circuitry. If this is a student project then you should talk to your supervisor and ask why you have been given a 5v Arduino to use with a 3.3v Xbee. This is forever going to cause problems as there is a high risk you will end up destroying the expensive Xbee modules.

From a quick look at the Youtube videos I think you should be able to do Xbee3 to Xbee3 communication without having to use the Xbee2 library.

I see, thank you for explaining it thoroughly. I am going to use it with a voltage translator (TXS0108E). You mean that I won't have to use libraries for Arduino to XBee3 communication right?