I'm trying to set up a wireless communication between a Computer (coordinator) and a Arduino Mega (router) using two xbees.
Here is the Coordinator configuration: ZIGBEE COORDINATOR AT Serial high:13A200 and serial low: 407B69E6
PAN ID: 1111
DH: 13A200
DL: 40813BFC (Rooter serial number low)
Baud Rate: 9600
Here is the Router Configuration: ZIGBEE ROUTER AT Serial high:13A200 and Serial low: 40813BFC
PAN ID: 1111
DH: 13A200
DL: 407B69E6 (Coordinator serial number low)
Baud Rate: 9600
I'm using the Xbee Explorer Regulated to connect the Xbee module to the board and the USB explorer board to connect the xbee to the computer. I'm able to communicate from the Arduino to the Computer. All data sent from the serial monitor of the Arduino IDE are received in the terminal window of XCTU. If I switch the modules I am still able to communicate.
Arduino Code
#include <SoftwareSerial.h>
uint8_t pinRx = 4 , pinTx = 2; // the pin on Arduino
long BaudRate = 9600;
char GotChar, getData;
SoftwareSerial xbee(pinRx, pinTx);
void setup()
{
Serial.begin(9600);
Serial.println( "Welcome to the XBee Communication Test" );
Serial.print("BaudRate:");
Serial.println(BaudRate);
Serial.print(" Rx Pin#");
Serial.println(pinRx,DEC);
Serial.print(" Tx Pin#");
Serial.println(pinTx,DEC);
xbee.begin( BaudRate );
xbee.println("Setup Completed!");
}
void loop()
{
if (Serial.available())
{
GotChar = Serial.read();
// Send it to Computer
xbee.print(GotChar);
// print it to serial monitor
Serial.print(GotChar);
}
while (xbee.available()>0)
{
//Serial.println("Ohohoh");
getData = xbee.read();
Serial.print(getData);
// send it back
xbee.println(getData);
}
}
The problem
I can't send data from the computer to the arduino.
When I send a character from the computer using the XCTU terminal, the TX and the RSSI leds light up on the USB Explorer board. Same thing occurs on the Arduino, the DOUT and RSSI led light up and nothing is received. I have tried setting DH and DL to broadcast mode using 0 and FFFF as values for the coordinator but it didn't solve the problem.
pinRx
is correct? If you connect a serial cable to pins 2 and 4 of the Arduino, can you send data over it? Continue to work on isolating the problem until you identify all of the known good/working components of your setup. Note that settingDH
andDL
to 0 is a shortcut for indicating the coordinator, not for broadcast mode. – tomlogic