I'd like to split serial communication into the two channels: 1) debug info, 2) application data.

There's only one Serial object to use.

However, maybe, there is an alternative way to print data separately, is there?

P.S. I use Nano and UNO.

  • 1
    There is the SoftwareSerial Library: arduino.cc/en/Reference/SoftwareSerial, arduino.cc/en/Tutorial/TwoPortReceive. – VE7JRO Nov 9 '18 at 18:54
  • 1
    can you give more info on what device you are using, and what you are actually trying to accomplish – Chad G Nov 9 '18 at 18:56
  • I specified boards I use and the purpose I'm pursuing. – zhekaus Nov 9 '18 at 19:54
  • @VE7JRO, Thanks for the answer. But how to see the output from two serial ports of the the same arduino board on the same computer? – zhekaus Nov 9 '18 at 20:10

As Majenko mentioned in his answer, you can connect a USB to UART adaptor such as a PL2303HX to your Uno (cost is $0.70 CDN). Just connect the RX, TX, GND pins to your Arduino correctly and include the SoftwareSerial Library in your sketch.

Here is a simple test sketch which is almost identical to the "SoftwareSerialExample" that comes with the SoftwareSerial Library.

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // RX, TX

void setup(){
  Serial.println("Print to Serial Monitor");
  mySerial.println("Print to SoftwareSerial");

void loop(){

If you want to have two Serial Monitors, start the IDE twice. Use your desktop shortcut or start menu entry to start the second instance of the IDE. In the second instance you can select a different port. It will not work for Upload of course, but when you open the Serial Monitor, it will work at the selected port.

Other option is to use some terminal program to see the output of the com port.

The other answers cover the fact that you need an USB to TTL Serial adapter to connect to USB and in sketch SoftwareSerial as your second serial interface or use some board with two or more hardware serial ports like the Mega on the picture.

enter image description here


Not without adding more hardware, no.

You could add a usb to UART adapter and use software serial. Better would be to switch to a board that has a proper usb connection and a usb stack that supports multiple CDC/ACM instances, like a chipKIT board (Lenny, for instance).

  • Disclaimer: I designed the Lenny (though I only profit from it if you buy it from me) and I designed the usb stack specifically so you can have multiple instances of the different drivers. – Majenko Nov 9 '18 at 21:57

You can add another channel with the SoftwareSerial library and an FTDI cable. The cable costs about US$17 in the US and is available here from Amazon, Sparkfun, and probably others. Internationally, I don't know. The SoftwareSerial library does have some limitations, most notably that it has to interrupts off while it's actually operating to get its baud rate right. But it does work and may be the simplest solution for you.


Depending on your software environment, the simplest thing may be to send all the data multiplexed through the single serial port, then split it into two channels at the other end. For that, you will need some sort of multiplexing protocol. If all your data is text and line oriented, this may be as simple as prefixing each line with "1" or "2" to select the appropriate channel:

Serial.println("1This app data goes to stdout.");
Serial.println("2This diagnostic message goes to sterr.");

If you want to send arbitrary byte streams, you would instead use two control characters for selecting the channels and an "escape" character for when you want the control characters to be transmitted literally.

For convenience, you could encapsulate this logic into two separate objects and implement stdout.println() and stderr.println().

Then on the computer side, you will have to write a program that reads the serial port and splits the received bytes into two separate streams. How you implement those streams is OS-dependent. On an Unixish system I would probably use pipes, or pseudo-terminals if I needed bidirectional communication.

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.