I need to print data on the Arduino serial monitor received from the Xbee in AT mode. I have searched on most forums and have not found anything on how to do this.

I have my Xbee tx connected to Arduino nano Rx and rx connected to tx.

1 Answer 1


You connected the Xbee to the single hardware Serial interface that the Nano has. Is is also used by the USB to Serial chip, which connects to the Serial Monitor. So what you are sending to the Xbee is also send to the Serial Monitor. What the Xbee sends is only send to the Arduino (since the Xbee TX pin is connected to RX of Arduino and also TX of the Arduinos USB to Serial chip).

But you can seperate then by using a SoftwareSerial interface on any other pins of your liking. Then you can connect the Xbee to it. Then forward the output of the SoftwareSerial interface to the Serial interface. To see how this works have a look the first example of the SoftwareSerial library. Its basically checking both interfaces, reads available data from one interface and writes it to the other (note the write() in contrast to print() since when forwarding you don't want to interpret the data again to another format like print() does).

Also there are plenty examples and tutorials about SoftwareSerial on the web. An important restriction is, that only one SoftwareSerial interface can listen to data at any time. The Hardware Serial interface doesn't have such a problem.

  • Thank you for your reply. I will try this. You said that only one Software Serial can listen to data at once. Does this mean that I would not be able to connect a GPS module to a software serial interface on different pins as well as the Xbee module? How would I solve this problem? May 9 at 12:12
  • When you are interfacing a module, which only will send data, when you ask for it, you can implement time sharing. So listen to one interface, asking the corresponding module for info and reading it. Then listen on the other interface, asking that module for info and reading it. Rinse and repeat. Though this only works if you cannot miss data from one module while you are reading the other. If you would miss data, you can change to a microcontroller with more Hardware Serial interfaces, like the Arduino Mega.
    – chrisl
    May 9 at 13:28
  • Ok thank you this makes sense. May 9 at 13:34
  • How do I add the SoftwareSerial Library? It does not seem to come up in the Library Manager? May 10 at 12:03
  • 1
    Because its already part of the Arduino Core. You don't need to install it. You can use it directly with the Arduino IDE.
    – chrisl
    May 10 at 12:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.