Ethernet communication with Arduino Mega

Hey there guys,

I would like to ask what's the easiest method to communicate with Arduino over ethernet (Arduino as server PC as the client (Python script, Node.js script)?

I will probably use python as a client and I will need to control 16 digital outputs on the Arduino mega using ethernet.

So I have been just wondering what's the easiest method to proceed

I have checked some UDP communication between Arduino server and Python PC client
Or Arduino as Modbus TCP server and then using PyModbus and communicate like that
I have also seen some OPC UA server running on Arduino but I guess that's the most complicated method.

The process we're doing is that my colleague will run some shell script on testing devices which we have which will check everything necessary on those devices then he will make some .txt file which will simply tell "OK" or "NOK" I will read this file probably by using Python or Node.js and if the output will be "OK" then I will send the request to Arduino over ethernet to switch digital output in order to shut down the board and in few moments switch it back on (To make testing device reboot - We're testing the repeatability of the board if couldn't happen that some of the components on the board wouldn't start correctly).
And this process will repeat over and over for 16 boards at the same time and if the output of the file will be "NOK" then I will let the device powered so we can check what didn't work on the testing device.

Thank you in advance for any hints!

so do you want to use plain TCP (telnet), HTTP or Modbus TCP or...?

for telnet there is a ChatServer example, for HTTP there is a WebServer example in the Ethernet library or you can use the EthernetWebServer library

Well, I don't mind, to be honest, I am just looking for what will be easiest to apply to Arduino and to be easiest to write in python to communicate with each other. :+1:

Thank you for the hint with the ChatServer guess it's solved by now I just start the chat server on the Arduino and then just simply use some python lib to connect using Telnet Send the command from the python to turn off/on digital pins and that's it.

Thank you!

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