(using screen, socat and others) but none of them deals with the question how to not block the port.
Other pointers on how to solve the issue are appreciated!
Virtually all hardware problems can be solved with software. But, sometimes, the $50000 software problem can be solved with the $2 hardware solution.
This is one of those cases. Buy a CP2102 6-pin serial UART USB adapter for < $2 on Ebay, or for < $10 on Amazon, to provide a second serial interface to the same Arduino (both connected to the same hardware UART built in to the Arduino's ATmega328 mcu). Let the main USB serial interface handle code uploads to the Arduino. Let this 2nd, external UART handle READ-ONLY from the Arduino!
Plug it in:
Arduino CP2102 USB 6-pin UART
Done. Do NOT plug in the CP2102
Tx to anything.
screen, or my crude datalogging Python serial terminal I wrote here (eRCaGuy_PyTerm), or a 2nd instance of the Arduino IDE with the Serial Monitor, or any other serial terminal for that matter, to read from the CP2102 while the Arduino's built-in USB adapter does code uploading.
Two serial interfaces to the same pins on the Arduino: one does Tx/Rx to/from the Arduino, while the other does only Rx to read from the Arduino.
I use a 2nd UART like this all the time as a trick to allow me to read the data from the Arduino into one Serial Monitor in one instance of the Arduino IDE so I can see the numbers, and I use the external CP2101 USB adapter to read the same exact data from the Arduino into the Serial Plotter of another instance of the Arduino IDE so I can see the live, plotted graphs!
It's amazing how well this works. Quick hack. Easy solution.
Note: to you use my eRCaGuy_PyTerm Python serial terminal, first set all your serial parameters inside the
user_config.py file, then run
python3 serial_terminal.py to run the program. It is a 2-way serial terminal, with datalogging. It works quite well. I really should improve its readme and post some examples someday.