Home/Support/Support Forum/xbee digimesh library for arduino

xbee digimesh library for arduino

0 votes
i have been trying on mesh network using digimesh protocol, the problem is that i cant get one library for arduino. i have reading this guide:
ftp1.digi.com/support/documentation/90000991.pdf
i found that there is a library but i dont know how to use it in arduino, here is the library
https://github.com/digidotcom/xbee_ansic_library

please help
asked Jan 26, 2016 in DigiMesh Proprietary Mesh Networking by waqasaps New to the Community (3 points)

Please log in or register to answer this question.

2 Answers

0 votes
These are standard C files for microprocessors using C. What I would suggest is looking at https://github.com/andrewrapp/xbee-arduino for the library files you are looking for.
answered Jan 27, 2016 by mvut Veteran of the Digi Community (11,439 points)
thanks for your response, i tried using this library but this wont support digimesh frames.
If it supports the Zigbee mesh for the XBee then it will support the Digi Mesh. I know this because Digi uses the same API for both protocols.
there is a difference between zigbee frames and digimesh
Xbee digimesh protocol frame for sending transmit request using '5'as payload:
7E 00 0F 10 01 00 00 00 00 00 00 FF FF FF FE 00 00 35 BE

here is the same frame for zigbee transmit request using 64 bit addressing:
7E 00 0C 00 01 00 00 00 00 00 00 00 00 00 35 C9
You need to read the API sections of the product manuals.  You are going to find that it is the same.

The frames you are using a reference are not the same frames.  The first is sending a packet to a Broadcast address where as the 2nd is sending data using the 802.15.4 64 bit TX request packet.

If you look between the Zigbee TX request packet  and the Digi Mesh TX request packet, you will find that other than a few additional option bytes available to use, they are the exact same API.
i am using this library

//code
#include <XBee.h>
XBee xbee = XBee();
  // put your setup code here, to run once:
   void setup() {
    Serial.begin(9600);
    Serial3.begin(9600);
  xbee.begin(Serial3);
}


void loop() {
  // put your main code here, to run repeatedly:
  xbee.readPacket();
  if (xbee.getResponse().isAvailable()){
  Rx16Response rx16 = Rx16Response();
  uint8_t data=rx16.getData(0);
  Serial.println(data);
  }
}
but i am getting wrong data, i am sending transmit request with payload 0x5 and i think i should get it using this function.
But i am getting wrong data, and its almost random
64 bit TX request packet is not available in digimesh
so here is the code for checking if the packet is valid

if (xbee.getResponse().isAvailable()) {
   if (xbee.getResponse().getApiId() == RX_16_RESPONSE) {
      xbee.getResponse().getRx16Response(rx16);
     }
}

how do it check it in digimesh
[SOLVED]
Thanks for your help

Its now working,

xbee.readPacket();
    
    if (xbee.getResponse().isAvailable()) {
if(xbee.getResponse().getApiId() == ZB_RX_RESPONSE)
        {
          xbee.getResponse().getZBRxResponse(rx);
          option = rx.getOption();
          data = rx.getData(0);
          Serial.print("data:");
          Serial.print(data,HEX);
          }
}
0 votes
thank you all its working now
answered Jan 27, 2016 by waqasaps New to the Community (3 points)
Hi Waqasaps,
I’m going through a similar problem trying to get the Arduino to talk with the xBee S3B Digimesh in API mode.
Would you please post the Arduino code that you are using for sending the msg and also the code for receiving the message.
This is the code I use to in the Arduino “Sender” for sending data. In this particular case I’m trying to send a “Hi” but I think I’m getting the wrong API message in the output of the Arduino “7E01010107D33A2040B2FA4AFFFE00486955”
I use another Arduino “Receiver” to check what is coming in the serial output of the Arduino Sender. In the real application this output would be connected to the xBee module.
I think the API message that goes out of the Arduino sender should look like “7E 00 10 10 01 00 7D 33 A2 00 40 B2 FA 4A FF FE 00 00 48 69 55”
Do you see anything wrong in mi code?
I’m using Andrew’s library “andrewrapp/xbee-arduino”

// Arduino Sender//////////////////////////////////////////////////////
#include <XBee.h>
#include <SoftwareSerial.h>

// Create an XBee object at the top of your sketch
XBee xbee = XBee();

int xBeeRX = 6; // Connect Arduino pin 8 to Xbee TX pin
int xBeeTX = 7; // Connect Arduino pin 9 to Xbee RX pin
SoftwareSerial xBeeSerial(xBeeRX, xBeeTX);// Define SoftwareSerial xBeeSerial RX/TX pins

// Create an array for holding the data you want to send.
uint8_t payload[] = {'H','i'}; //{48,69} in HEX

// Specify the address of the remote XBee (this is the SH + SL)
XBeeAddress64 addr64 = XBeeAddress64(0x0013A200, 0x40B2FA4A);//0013A20040B2FA4A

// Create a TX Request
ZBTxRequest zbTx = ZBTxRequest(addr64, payload, sizeof(payload));

void setup() {
xBeeSerial.begin(9600); // Start the serial port
xbee.setSerial(xBeeSerial); // Tell XBee to use  SoftwareSerial xBeeSerial
}

void loop() {
xbee.send(zbTx);// Send your request
delay(10000);
}

// Arduino Reciver//////////////////////////////////////////////////////
//This Arduino is connected to the xBeeSerial of Arduino Sender. Just for debugging propose. #include <SoftwareSerial.h>

int xBeeRX = 6; // Connect Arduino pin 8 to Xbee TX pin
int xBeeTX = 7; // Connect Arduino pin 9 to Xbee RX pin
SoftwareSerial xBeeSerial(xBeeRX, xBeeTX);// Define SoftwareSerial xBeeSerial RX/TX pins

void setup() {
  // initialize both serial ports:
  Serial.begin(9600);
  xBeeSerial.begin(9600);
}

void loop() {
  // read from port xBeeSerial, send to port Serial:
  if (xBeeSerial.available()) {
    int inByte = xBeeSerial.read();
    Serial.print(inByte, HEX);
  }
}
...