Problem with arduino mega and xbee shield 2.0

Hi all,

This shield is driving me mad ! I’ve tried many and many solutions found on the internet but nothing works. Let me explain :
I have 2 arduino mega, 2 xbee shield V2.0 and 2 xbee S1 xb24 model.
I have plugged jumper between rx and digital for pin 5
I have plugged jumper between Tx and digital for pin 4

I’ve tried a little program that use SoftwareSerial and just read data from xbee.

#include <SoftwareSerial.h>
SoftwareSerial xBeeSerial = SoftwareSerial(5, 4); //RX, TX

int incomingByte;

void setup() {
  Serial.begin(9600);        
  xBeeSerial.begin(9600); 
}

void loop() {
  Serial.print(".");
  if(xBeeSerial.available() > 0) {
    Serial.println("xbee ready");
    incomingByte = xBeeSerial.read();
    Serial.println(incomingByte);
  }
  delay(1000);
}

I don’t know what’s wrong with that but I never print “xbee ready” (so xbeeserial is never available).
I’ve tried to reset xbee shield with the little button but nothing changes.
I’ve tried to use x-ctu but it never let me use the shield (it always ask me to press reset button but nothing else).
I’ve tried both arduino and xbee shields (in case of a bricked one) but same thing happens -> nothing.

Is there an error in my code ? my jumper configuration ?
Do you have an idea of what’s going wrong please ?

Regards
Steeve

you have just got a little problem, not all pins of mega can be used as software serial pins, refer to SoftwareSerial. So you need do some modification like this: Connect D4 to D10 then D5 to D11 by jumper wires, and don’t forget to modify your program.

Good luck.

Hi,

I’ve already tried that and was not working but just to be sure, here are some pictures of what I’ve done

And the modified software :

[code]
#include <SoftwareSerial.h>
SoftwareSerial xBeeSerial = SoftwareSerial(11, 10);

int incomingByte;

void setup() {
Serial.begin(9600);
xBeeSerial.begin(9600);
}

void loop() {
Serial.print(".");
if(xBeeSerial.available()) {
Serial.println(“xbee ready”);
incomingByte = xBeeSerial.read();
Serial.println(incomingByte);
}
delay(1000);
}[/code]

As you can see, jumpers are on pin 11 for RX and pin 10 for TX.
I’ve tested if jumper configuration was ok between jumper and arduino input and all is ok -> xbee shield RX pin is connected to arduino D11 pin and xbee shield TX pin is connected to arduino D10 pin

I’ve tried with my another set of arduino/xbee shield/xbee -> same thing o_O
I really don’t know what can i do then.

I made it work with this configuration :

xbee -> xbee shield -> arduino mega -> pc -> xctu with this configuration :

The program in the arduino should have an empty Setup() method and an empty loop() method.
xbee shield must have this configuration :

  • jumper between XB_TX and DIGITAL on the line 1
  • jumper between XB_RX and DIGITAL on the line 0

Run XCTU -> it will detect xbee and you will be able to use it through XCTU.

Then, when you want to use your xbee with arduino IDE (in my case Arduino mega so I can use one of the 3 other hardware serial) :

  • plug a jumper wire between xbee XB_TX and arduino TX1 (18) and a jumper wire between xbee XB_RX and arduino RX1 (19)

Then, use Serial1 as xbee serial in your arduino IDE code and it will work.
I made it simplier by first try to make an emitter with arduino IDE and test it with my other arduino plugged into XCTU.
Then, I made the code for receiver and tested with the other arduino plugged into XCTU.
Then, I pushed to code to both arduinos and it works standalone !

I same as you!!!
Who do it video tutorial shiled xbeev 2.0 connected with xctu 6.1.0 , please!!! T_T, ;…; :nerd:

x-ctu3.pngx-ctu2.pngx-ctu.pngWP_20150209_002.jpg

Change your jumpers settings !
change them as I explained and just upload an empty setup() and empty loop() as I said.