Ethernet nework with Arduino

Hello,

I would like to create a wored ethernet newtork of 4 Arduino boards,
and I would like to know what do I will need as Hardware setup and sofwtare modules?

For Hardware parts I have:

  • 4x MKR Zero + MKR Eth Shield boards
  • a switch + 4 Ethernet cables.

For SW part
till now I succeed to connecte only one board (MKR Zero + Eth Shield) to a compter and test is good with Telnet. I believe in this case Arduino is a server and Computer/Telnet is a client

My objective for the network is to have a network, where each node can send data to other ECUs, and each ECU can recieve data.

Thanks in advance for advices to build the second step for my local network.

there is no server and client on Ethernet. the devices have MAC addresses.
on IP level the peers on network have IP addresses.
TCP protocol sockets are identified by ports.

Arduino EthernetClient object wraps a TCP socket. A normal TCP socket is connected to IP address and port.

EthernetServer starts a listening socket on a port. If server on listening socket is contacted by a remote client socket, the server creates a local client socket connected with the remote client socket on a free port and returns a EthernetClient object wrapping the socket. Everything you write or print to a EthernetClient is send to that one remote socket.

client socket

   if (client.connect(serverIP, PORT)) {
     client.print("request\n");
     String response = client.readStringUntil('\n');
     Serial.println(response);
     client.stop();
   }

server side

   EthernetClient client = server.available();
   if (client && client.connected()) {
     String request = client.readStringUntil('\n');
     Serial.println(request);
     client.print("response\n");
     client.stop();
   }

There are many protocols that can run on top of TCP/IP.

One popular protocol to exchange small data packets e.g. sensor data is MQTT.

It requires an extra node called the broker that collects and distributes messages. I use a Raspberry Pi for that.

MQTT is very well supported on Arduino, Raspberry Pi, PC/MAC and even cloud platforms and very easy to understand.

Thanks a lot for your feedbacks.

I'll start tomorrow to implement your proposals.