Separate serial monitor from sending serial data.

I have a serial communication between Arduino Nano and Raspberry Pi. Pi send some data and Arduino process that data to send back to Raspberry Pi.

Right now, the data Pi receiving is not what I am expecting. I want to know what is the data Arduino want to send to the Pi, to see if Arduino is outputting the correct data.

But if I use Serial Monitor (using Serial.print/println) to display some message, those messages will be sent back to the Raspberry Pi too (which is not what I want).

Is there any way for me to get around this? Thanks.

Will the Pi ignore messages that aren't intended for it to read? Then the serial monitor should just observe what was sent and not transmit anything itself.

Do you have control over the Pi end of the software? You should definitely re-write the software to ignore messages it doesn't understand.

Have you heard of SoftwareSerial?

MorganS:
Will the Pi ignore messages that aren't intended for it to read? Then the serial monitor should just observe what was sent and not transmit anything itself.

Do you have control over the Pi end of the software? You should definitely re-write the software to ignore messages it doesn't understand.

Have you heard of SoftwareSerial?

Currently, I wrote a Python script on the Raspberry to just read the next N bytes whenever it is asked to read. The thing is, even if I send the N bytes first and then just not read the rest, the serial data will not be dispatch and the next time I read it, it will read those data instead of the real data I want it to read.

Is your communication based on text? If so, disconnect the Pi and use Serial Monitor to simulate the Pi and debug your Arduino code.

If the data is binary, it will be trickier. A second serial output (software serial was mentioned) and an USB-to-TTL cable can provide debugging facilities.

Have a look at the examples in Serial Input Basics - simple reliable ways to receive data. There is also a parse example to illustrate how to extract numbers from the received text.

The technique in the 3rd example will be the most reliable.

You can send data in a compatible format with code like this, or its equivalent in Python

Serial.print('<'); // start marker
Serial.print(value1);
Serial.print(','); // comma separator
Serial.print(value2);
Serial.println('>'); // end marker

This Python - Arduino demo
may also help

You have not told us how you have connected the RPi to your Arduino. It seems as if you are using Pins 0 and 1 which are also used for communication using the USB connection. It would probably be a good idea to create a separate serial port for communication with the RPi using SotwareSerial

...R