I am trying to build a mesh network and therefore all of my Xbee devices are in API mode (I believe that is the way it is done if I want to build a mesh network, correct me if I am wrong). For now I am just testing communication and I am using just 2 devices: a coordinator and a router (the network will have more routers and end devices later). Both Xbee's (and every Xbee I add to the network later) will be attached to an Arduino unit. The Arduino will generate some values and send them to the coordinator, so no sensors will be used because I am just trying to implement a communication protocol in the network. The Xbee.h library is used in all Arduino sketches. At this moment, I am trying to establish communication between the coordinator and the router, but without success. I am new to Xbee and Arduino and I am trying to establish a communication between them for the last few days without any success. I am not sure if my X-CTU configuration is wrong or if my code is not OK. In my current scenario (it is used only to check if communication works), the coordinator sends some data to the router and the router will print it on the serial monitor. Both of my devices are attached to my laptop via USB cabels (I am not sure if this can cause a problem). My code and configuration is the following:

I am not sure if this is important or not, but when I attach my xbee+arduino router to my laptop, it does not print anything alhought there is a Serial.println command at the beginning of every loop iteration in the uploaded sketch. I have to upload my sketch every time if I want it to work. I don't have that problem with my coordinator.

Set the recieving Xbee to Coordinator. Set the DH and DL values of the sending xbees to the recieving xbee SH and SL values. I set the coordinator to API mode (2) and left the Transmitters (End Devices) in transparent mode. The Xbees in my setup are S1

This is how my hive setup works with multiple Tx Xbees sending to one Rx Xbee connected to a Mega2560

In this case the "transmitter" is the coordinator and it is sending data to a router Xbee which has the already mentioned receiver arduino sketch. It's address is set in the request on transmitter side.

If I want to make a mesh, what values have to be set for DH and DL for each Xbee (coordinator, router and end device). I assume that if I use AT mode for the router, then it's DH and DL have to be set to the coordinator address. Is it the same if the router is in API mode? I have googled and seen multiple different configuration scenarios for API mode and to be honest it really confuses me. In some cases the DH and DL were set as in my post and in others they were DH = 0 and DL = 1 for the coordinator, but none of that worked.

Quote

You are. A mesh network can be set up with the XBees in AT mode or API mode. Given the code you have, AT mode is more appropriate.

Should all Xbees be in AT mode including the coordinator? If so, then should the communication be established by using Xbee.h library?

By the way I am using series 2 Xbee's.

Quote

Set the recieving Xbee to Coordinator.

Why should I set the coordinator as the receiver? I guess I am wrong, but judging by your response it sounds to me as if the coordinator is only able to receive data. I want to establish bidirectional communication in my mesh. The coordinator will be periodically polling the generated values of each router and end device (broadcast). It should also be able to request (poll) the generated value/data of just one Xbee. That is why I tried to implement a scenario where the coordinator sends something to the router.

Hi! I am also facing the same issue. I tried both the code posted by vibe and the example given in the library. Not sure what the problem is but I am configuring the XBEEs on XCTU; followed the settings given by the datasheet of Digi: https://www.digi.com/resources/documentation/Digidocs/90001942-13/#concepts/c_libraries.htm%3FTocPath%3DXBee%2520API%2520mode%7CXBee%2520frame%2520exchange%7C_____7. The connections are fine on XCTU but when I try to move the modules to the Arduino it didn't work.

Can anyone tell me which settings to use or how did you all solve the problem? (I am using RX as coordinator and TX as router)