Connect 2 PCs with 2 Arudino (Headless Server Linux)

Hi all,

I have a Headless Linux Server running which I can access with SSH. In case my network goes down, I want to be able to access the Server via Terminal connection. Problem is, that neither my laptop nor my server has a Serial Connection.

I have multiple Arudions in house and was wondering, if I could connect 2 of them and use them as a USB to Arudino - Arudino to USB interface between both computers. How would I do that at best?

Welcome to the forum.

You need an Arduino with an available hardware UART or you will need SoftwareSerial. You will need to connect TX from one Arduino to RX on the other and the other way around. The software will simply read each byte received on one serial interface and send it on the second serial interface.

Here is the example for an Arduino Nano 33 IoT with native USB and a free hardware UART on TX and RX. This will look almost identical on most Arduinos.

void setup()
{
  Serial.begin( 115200 );
  Serial1.begin( 115200 );
}

void loop()
{
  if ( Serial.available() )
  {
    int c = Serial.read();    
    Serial1.write( c );
  }
  if ( Serial1.available() )
  {
    int c = Serial1.read();    
    Serial.write( c );
  }
}

Can you use a USB to Serial adapter, they are very inexpensive.

1 Like

Hi Klaus,

would Serial be the Hardware Serial and Serial1 the USB serial? I will test that and see how it goes.

Meanwhile I was able to just use 2 FTDI programmer I had in a box to connect them and got excess to the server. This solution seems just to be a little slow.

No, its the other way around. This is to ensure standard sketches work on the boards with native USB. The virtual serial over USB is called Serial and is used for Serial Monitor and Serial Plotter.

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.