Arduino PLC Connectivity

ProtoTwin Connect supports the Modbus TCP protocol for connection to all Arduino Opta and Portenta Machine Control PLCs.

Server Configuration

Click the “Add Server” button in the “Servers” tab of the IO Browser and configure the server as follows:

  • Protocol: Select “Modbus/TCP” from the list.
  • Type: Select “Arduino” from the list.
  • Name: Enter a (preferably) unique name, which will be used to identify the server.
  • Host: Enter the static IP address of the PLC.
  • Port: Enter the port number for the Modbus TCP server (typically 502).
  • Unit ID: Enter the unit/slave ID for the Modbus TCP server (typically 255).
  • Scan Rate: Enter the desired scan rate, which is the interval (in seconds) at which ProtoTwin Connect will read and write tag values.

Note that the scan rate is the desired interval at which tags are read and written. The actual rate will depend on the performance of the PLC and networking latency. You can set the scan rate to zero in order to read/write as fast as possible.

Save the configuration to add the server.

Register Types

Arduino supports two types of holding registers: parameters and status variables. Parameters are retentive, whilst status variables do not retain their values after the PLC is restarted. The first parameter has address 16384 whilst the first status variable has address 24576. ProtoTwin can read and write both parameters and status variables.

Addressing

When Arduino is selected as the Type of the server, you should specify the Modbus addresses in the format used by Arduino PLC IDE. Some examples are provided below:

  • 16384: The first parameter register (read/write).
  • 16385: The second parameter register (read/write).
  • 24576 The first status variable (read/write).
  • 24577: The second status variable (read/write).
  • 24578.0: The first bit of the third status variable (read/write).
  • 23578.15: The last bit of the third status variable (read/write).

Note that the addresses can also be entered in hexadecimal format. For example, you may enter 0x4000 instead of 16384.