XBEE S2C Mesh Network with Arduino

Hi! I have been searching the web on how to establish a mesh network. I tried following Digimesh data sheet and using Andrew Rapp’s library but I didn’t get the meshing to work. I have set the Arduino to API 2 mode and have programmed two routers to send data directly to the coordinator; thinking that it will self-heal if one of the router is out of sight from the coordinator. However, when I test it out in an outdoor setting it didn’t self-heal ie it was a star connected network instead of a mesh.

Have no clue why. Could anyone provide me with an explanation? Stuck with this problem for weeks :frowning: I am using Arduino micro for one of the routers and Unos for the other router and coordinator. I checked the connections on XCTU and the network mode show that a mesh network was established as shown in the diagram below.

I have set the Arduino to API 2 mode

That doesn’t make sense. API mode is an XBee thing, not an Arduino thing.

I am using Arduino micro for one of the routers and Unos for the other router and coordinator.

That doesn’t make sense, either. XBees can be end devices, routers, and/or coordinators. Arduinos can not.

Ok my apologies but that is what I am referring to. I have set my XBEEs to API 2 mode and connect the Arduino micros to an XBEE module. Do you have any experience in meshing? Thanks!

Do you have any experience in meshing?

Specifically with XBees? No. But, I understand the concept, and my day job involves making computers share data in a mesh network.

I'm not sure that I understand what your problem is. If you have 3 XBees - lets call them A, B, and C, where A and B are routers, and C is the coordinator - and you take A or B offline/out of the network, you get point-to-point mode between the only two devices left in the network. A mesh with 2 nodes and a star with 2 nodes are indistinguishable.

Thanks for the reply! Will it be possible to relay the message from A to B? Here is what I did:

I tested my system outdoors. So in my first attempt, I had A and C(the coordinator) setup and I move A till the message can't get through to C. I placed B in the middle and see if it is able to relay the message to C but it wasn't able to. When I move A back, C starts to get the message from both of them. So I was wondering what the problem is as I want it B to relay the message from A.

I tried changing the settings DH and DL on XCTU and also the destination address to "0x00000000 0000FFFF"on my Arduino but it didn't work. Edit: I initially set it to the coordinator's address thinking it will relay the message and get to the coordinator.

Hope I made myself clear :slight_smile:

Each XBee has an address, defined by SH and SL. Each wants to talk to some coordinator, defined by setting DH and DL to the SH/SL value of the coordinator.

When an XBee wants to send data to the coordinator, it determines the hops required by consulting the map it has built. When a node moves, the map needs to be updated. When a node goes offline, or comes online, the map needs to be updated. Building a map, and keeping it up to date is not a trivial task, so the XBee doesn’t do it more often than is needed.

Obviously, it is needed when an XBee tries to send data, and the packet doesn’t get through because some node in its map is not acknowledging receipt of the packet. But, a node coming online, and providing a shorter path is not so easily noticed.

How long did you give the XBees to discover that a node had gone offline/come online?

Thanks for the information!:slight_smile: I gave it a good few minutes (2-3 minutes). Must I wait longer?

Right now I have set Routers to transmit packets and Coordinators to receive packets. Can I just check for each XBEE-Arduino Router do I need to program the Arduino to be able to transmit and receive? I wanted to do that but was thinking about timing issues for example if A wants to transmit data to B but at the same time, B decides to also transmit data to C.

Also about the map, do we need to program the Arduino to allow the XBEEs to establish a map.

Must I wait longer?

I wouldn't think so.

Can I just check for each XBEE-Arduino Router do I need to program the Arduino to be able to transmit and receive?

That sentence needs some more punctuation, I think.

All XBees are able to send and receive. The Arduino, with the XBee library, determines whether the XBee is asked to send. It needs to, periodically, see if the XBee has received anything.

I wanted to do that but was thinking about timing issues for example if A wants to transmit data to B but at the same time, B decides to also transmit data to C.

It does not sound like the XBees make the decisions. In any case, if XBee A is told to send a message to XBee B, but XBee B doesn't get the message, because it is busy talking to XBee C, XBee A will retry however many times it is programmed to, or until it gets an ACK from the intended recipient.

Also about the map, do we need to program the Arduino to allow the XBEEs to establish a map.

The XBees have microcontrollers built in. They will build a map regardless of what the Arduino is doing.