user45247: 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.

user4143: 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).

user313: 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.

user7508: 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.

user37523: 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.begin(9600);
  Serial.println("Print to Serial Monitor");
  mySerial.begin(9600);
  mySerial.println("Print to SoftwareSerial");
}

void loop(){
  if(mySerial.available()){
    Serial.write(mySerial.read());
  }
  if(Serial.available()){
    mySerial.write(Serial.read());
  }
}


user37622: 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.


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

<p>There's only one Serial object to use.</p>

<p>However, maybe, there is an alternative way to print data separately, is there?</p>

<p>P.S. I use Nano and UNO.</p>
 4143: <p>Not without adding more hardware, no.</p>

<p>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).</p>
 313: <p>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.</p>
 7508: <p>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:</p>

<pre class="lang-c++ prettyprint-override"><code>Serial.println("1This app data goes to stdout.");
Serial.println("2This diagnostic message goes to sterr.");
</code></pre>

<p>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.</p>

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

<p>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.</p>
 37523: <p>As Majenko mentioned in his answer, you can connect a USB to UART adaptor such as a <a href="https://www.aliexpress.com/item/30pcs-USB-to-TTL-USB-TTL-STC-microcontroller-programmer-PL2303-in-nine-upgrades-plate-with-a/1726023406.html" rel="nofollow noreferrer">PL2303HX</a> 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.</p>

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

<pre><code>#include &lt;SoftwareSerial.h&gt;

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

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

void loop(){
  if(mySerial.available()){
    Serial.write(mySerial.read());
  }
  if(Serial.available()){
    mySerial.write(Serial.read());
  }
}
</code></pre>
 37622: <p>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.</p>

<p>Other option is to use some terminal program to see the output of the com port.</p>

<p>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.</p>

<p><a href="https://i.stack.imgur.com/utbBE.gif" rel="noreferrer"><img src="https://i.stack.imgur.com/utbBE.gif" alt="enter image description here"></a></p>
