Sending data with XBEE connected on RX/TX and I2C.

Hi everyone,

This topic is about a trouble I have when changing the wiring of some pins with my XBEE.
Let me sum up my project.

It is composed of:

  • An Arduino Uno
  • An XBEE Shield from Funduino
  • An XBEE module
  • A sensor BNO055

The shield is made such as the DIN and DOUT pins of the XBEE are connected to the 0(RX) and 1(TX) of the Arduino. There is a switch on the shield to avoid communication issues when downloading the program on the Arduino.

The Sensor is connected with an I2C bus, using A4 for SDA and A5 for SCL.
You’ll find my wiring with the picture attached.

The goal is to send sensor data to another XBEE module. It actually works perfectly without the shield, the DIN and DOUT pins of the XBEE are connected to the digital pins 2 and 3 of the Arduino. However, when I plug the DIN and DOUT on 0 and 1, the data can’t be sent anymore.

I tried to plug my XBEE module without the shield, on pins 0 and 1 of the Arduino and same result, so I presume the issue is not linked to the shield.

I’m using SoftwareSerial Library for XBEE. And define the pins as follow:

#define RXPIN 0   // Arduino Pin for Reception
#define TXPIN 1   // Arduino Pin for Transmission
SoftwareSerial xbee(RXPIN,TXPIN);

Is it ok to use an I2C bus with a XBEE plugged on RX/TX of the Arduino ?


You're writing the problem yourself: You connect the XBee to pins 0 and 1 but you talk to it on pins 2 and 3. Change the code to talk to pins 0 and 1, so forget that horrible SoftwareSerial and use the standard Serial instead.

When I change the wiring (from 2-3 to 0-1), I obviously change the pin adresses in the code to fit with my wiring.

That’s not my problem here.The system works when i use 2 and 3 for Xbee. But no more with 0 and 1 (and i change the pin numbers in the code).

Don't define a SoftwareSerial on the hardware serial pins 0 and 1!!! Change from SoftwareSerial to Serial as I told you, then you don't have to define pin numbers.

And post complete code (don't forget to use code tags!), maybe there are other mistakes like this.