Arduino XBee read API frames send from Java

Hi,

I'm trying to send some data from a java application to an Arduino Uno via XBee S2. I have 1 XBee connected to my pc via XBee USB Adapter and 1 XBee connected to Arduino Uno via XBee Shield (the red one) and also the Arduino connected to the pc. The XBee connected to my pc via USB Adapter is the coordinator and have the following settings: ZigBee Coordinator API -ID 1111 -NI 'MASTER' -AP 2

The XBee connected to Arduino via Shield is the remote and have the following settings: ZigBee Router API -ID 1111 -NI 'REMOTE-1' -AP 2

XBee Java Library: https://github.com/digidotcom/XBeeJavaLibrary XBee Arduino Library: https://github.com/andrewrapp/xbee-arduino

Java Main Class: https://github.com/digidotcom/XBeeJavaLibrary/blob/master/examples/communication/explicit/SendExplicitDataSample/src/com/digi/xbee/api/sendexplicitdata/MainApp.java

Connecting my REMOTE-1 XBee via USB Adapter to XCTU (MASTER also connected to pc via USB Adapter), I am able to receive the message sent from my MainApp.java class in XCTU console.

But when the REMOTE-1 its mounted on Arduino Uno I can't manage to receive any data from my MainApp class or XCTU console.

I had tried many examples including: - https://github.com/andrewrapp/xbee-arduino/blob/master/examples/Series2_IoSamples/Series2_IoSamples.pde (did the required configuration from comments) - https://dzone.com/articles/xbee-zigbee-complaint (did the required configurations) - https://learn.sparkfun.com/tutorials/xbee-shield-hookup-guide/example-communication-test

How could I receive my msg sent from my MainApp.java class on my Arduino? Any example would be great. Thank you for reading. I appreciate it.

I wrote a small post about communication between Arduino and Raspberry pi using xbee. In RPi I used nodejs instead of java, not sure whether the post will help you, but you can have a look here.

sarouje:
I wrote a small post about communication between Arduino and Raspberry pi using xbee. In RPi I used nodejs instead of java, not sure whether the post will help you, but you can have a look here.

Hi sarouje, thank you for your atention. I tried your script but no success.

Also I tried sending frames from XCTU to Arduino still no data printed. Doesn’t even get in
“if (xbee.getResponse().isAvailable())”.

With XBee Shield, should I set some pins or something?

I dont know how xbee shield works, I connected xbee to Arduino using couple of jumper wires.

Have you tried communicating to the xbees just from your XCTU? If both can communicate via XCTU then you can check your code.

Some times I saw some xbees wont pair and unable to communicate, so i had to switch xbees. So before even I try connecting to Arduino, I checked the communication of two xbees by opening two XCTU instance.

Yes they are. I can communicate from Coord -> Remote (both API) from XCTU by destination address (MAC) Also I can send frames from my Java code from Coord -> Remote by NI (Network Identifier). I see the result received in XCTU. Tried rx->tx , tx->rx pins directly from adapter to arduino, still nothing...