I am assigned on a project involving Arduino and Raspbery PI. I have plenty of experience with Arduino and 0 with Raspbery or Linux. Person working quit and there are some problems that need me to start debuging.

The project involves control of input and output by Arduino and a touch screen and SMS aplication in Raspbery. They comunicate with standard Serial port using USB.

I want to read that communication on my PC terminal. What would be the simplest way of inserting myself without modifying anything on Raspbery?

  • 1
    What kind of Arduino? – Majenko Jan 31 '20 at 12:54
  • It is not clear who is doing the talking. Only that communications is over a USB. So, simplest answer is to use a USB bus protocol analyzer. Most cost hundreds of dollars. – st2000 Jan 31 '20 at 13:13
  • If you use an Arduino with no native USB support, you can tap the RX and TX pins, that are connected to the USB Serial chip (some Arduino boards have multiple Serial interfaces, so you need to connect to the right one) – chrisl Jan 31 '20 at 13:21
  • @Majenko Arduino Mega2560 – Affaltar Jan 31 '20 at 13:33
  • @st2000 Raspbery sends commands and expects a reply to them, and Arduino regularly (every 300ms) sends status report – Affaltar Jan 31 '20 at 13:34

As st2000 stated in the comments, tapping on USB is a complex task and certainly not the way to go.

Maybe there is a program for Raspbian, that pipes the Serial data to 2 programs simultaneously. (I don't know one and that would be off topic here)

So your best way would be to tap the Serial (UART) communication between the USB-Serial chip (which translates USB to real serial UART) and the Atmega2560 (the main chip on the Arduino Mega). Reading Serial (UART) is a completely passive action. You don't disturb the communication with it; only if you try to send something from your tapping device. The Mega uses the first Serial interface for communication over USB, meaning that you need to tap the pin 0 and 1 (marked with TX and RX).

Now about the tapping device: You have multiple possibilities here. You could use the RX pins of 2 other Arduinos or of 2 USB to UART adaptors. But I would suggest to directly buy a logic analyser. That is a small USB device, that let's you plot digital signals (like the serial communication) on your PC. I use one with the software Pulseview. It can also analyse the digital signal for different communication protocols, for example UART. With the logic analyser you would reach your goal of tapping the serial communication, but you would also have a very capable tool for your future Arduino projects (you can analyse all sorts of digial signals with it). They are rather cheap (I got one with little clamps to attach it to a circuit for about 15€).

In the end, it's up to you to decide, which way you want to go and what you want to buy.


You may be able to sniff the communication from the Raspberry Pi itself, with no extra hardware. Assuming the program on the Pi can be configured to use a serial port other than /dev/ttyACM0, a sniffing program could create a pseudo-terminal pair, then forward data back and forth between /dev/ttyACM0 and the master pseudo-terminal, while logging everything. If you point your Pi application to the slave pseudo-terminal, you have your man-in-the-middle logger:

Arduino --(/dev/ttyACM0)-- logger --(pseudo-tty)-- application

The interesting thing about a slave pseudo-terminal is that, as far as the application is concerned, it behaves exactly like a regular serial port.

There seem to be quite a few implementations if this idea. C.f. the answers to these other stack exchange questions:

Just as an example, the README of interceptty states:

interceptty is designed to sit between a serial port (or other terminal device, or program, or socket, or something connected to a file descriptor) and a program which is communicating with that device, recording everything that goes back and forth between the two. It does this by opening the real device, creating a pseudo-tty, then forwarding everything between the two, recording whatever it sees.


If all you want to do is monitor what is going on then you can take a pair of USB to UART adaptors and connect the RX pin of each to the Arduino - one to the RX pin to see what the Arduino is receiving, and one to the TX pin to see what the Arduino is transmitting.

You then have to open both COM ports in separate applications (unless you can find an application that will allow you to open both together) to see what each channel has going through it.

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.