How to transfer data from arduino through Xbee to Coordinator Xbee in API mode. Please help..Anyone?

I an doing a smart automation project and am trying to connect 3 Xbee Routers to a Xbee coordinator connected to a Rpi. The problem is the sensors are connected to the arduino and the ardunio code accordingly sends the data to the Xbee via the Tx Rx connection.
My question is - how will this stream of data be turned in API frames that are then sent to coorindator?
I can identify which node is sending by assessing the serial no of the incoming data frame right?

In short, yes you will be able to distinguish the incoming frames based on the sender serial.

Is the Arduino side also running in API mode? Meaning is the Arduino code already taking care of frame generation? Or the fact that data is sent to TxRx is meant to indicate that you are running in mixed mode where the XBee on Arduino is running in AT (Transparent mode?) and the Coordinator is in API mode?

In that case, the Data you send from the sensors will appear on the Coordinator as: “Explicit Rx Indicator frame - 0x91”.

1 Like

I was planning on setting both Xbees to API mode and using the library from andrewrapp on GitHub to take care of the frame generation.
But using mixed mode sounds less complicated. Do I set the end device to ROUTER AT configuration and then program my arduino to just SerialWrite() in the form of a valid frame? How do I set the DH and DL addresses in the Coordinator and Router for the same?

Thanks a lot for the quick reply, I have been struggling with Xbees for some time now

I would recommend you to stick to your original plan - running in API mode. Running in mixed mode creates it’s own challenges.

In mixed mode the Coordinator is still being interfaced in API mode. The Router with the sensors operating in AT mode you either preset the DH/DL using XCTU or if you want to set them in the Arduino code, you can simply go to the command mode to set them:


Serial.print('+++');
delay(1000);
Serial.print('ATID');

But again, it would make much more sense to keep operating in API mode and the Arduino library should be easy enough to create the proper packets you need. Cheers!