GurdeepakSidhu
Since the CM4 POE is closed off, your only real option is ethernet. You can use TCP/UDP/MQTT to control the machine.
For communication, basically google how to interface your specific machine to a linux system (which is what a RPI is).
For example, if using MODBUS, this is how it can be done:
from pymodbus.client.sync import ModbusTcpClient
# Connect to the PLC
plc_ip = "192.168.1.200"
plc_port = 502
client = ModbusTcpClient(plc_ip, port=plc_port)
# Send a signal to trigger an actuator
client.write_coil(1, True) # Write to coil 1 (ON)
client.write_coil(1, False) # Write to coil 1 (OFF)
# Close connection
client.close()
Thanks,
Jaka