Technical Details

M-DUINO PLC Arduino Ethernet 58 I/Os Analog/Digital PLUS


Initial Installation


Arduino IDE is the Original platform to program Arduino boards. This cross-platform application is available on Windows, macOS and Linux and under the GNU General Public License.
Arduino IDE supports C and C++ code structuring. Industrial Shields recommend using Arduino IDE to program Arduino Based PLC’s, but any Arduino compatible software are compatible with Industrial Shields Controllers.

Apart from that, Industrial Shields bring the possibility to select your Arduino based PLC into your Arduino IDE and compile your sketches for the different PLC’s.

Download the Arduino IDE 1.8.6: 

Windows Installer


Install Industrial Shields units to Arduino IDE:

Industrialshields boards

Inputs & Outputs


Voltage variation between –Vcc (or GND) and +Vcc, can take any value. An analog input provides a coded measurement in the form of a digital value with an N-bit number.  In Digital and Analog I/O there’s self insulation, so its posible to connect them in a different power supply than 24 V.  

Inputs: (16x) Analog Inputs (0-10Vdc) / Digital (7-24Vdc) configurable
by software.

To know more about analog inputs... 



Voltage variation  from  –Vcc (or GND)  to  +Vcc, with no intermediate values. Two states: 0 (-Vcc or GND) and 1 (+Vcc).  In Digital and Analog I/O there’s self insulation, so its posible to connect them in a different power supply than 24 V.  

Inputs: (16x) Analog Inputs (0-10Vdc) / Digital (7-24Vdc) configurable by software.

              (20x) Isolated Digital (7-24Vdc). 

All digital inputs are PNP.

To know more about digital inputs...


- Digital Isolated Input


- Digital No Isolated Input


Interrupt Service Rutine.  A mechanism that allows a function to be associated with the occurance of a particular event. When the event occurs the processor exits immediately from the normal flow of the program and runs the associated ISR function ignoring any other task. 

Interrupt Arduino Mega Pin M-Duino Pin
INT0 2 I0.5/INT0
INT1 3 I0.6/INT1
INT4 19 I1.6/INT4
INT5 18 I1.5/INT5
INT2 21 I2.6/INT2
INT3 20 I2.5/INT3

    - I0.5/INT0 and I0.6/INT1 also as Pin3 and Pin2. Enable Interrupts turning ON the switches number 3 and 4 of down communication switches.
    - I1.5/INT4 and I1.6/INT5 also as Tx1 and Rx1. Enable Interrupts turning ON the switches number 1 and 2 of up communication switches.
    - I2.5/INT3 and I2.6/INT2 also as SCA and SCL. Enable Interrupts turning ON the switches number 3 and 4 of up communication switches. In this case you won’t be able to use I2C.

To know more about interrupt inputs...


 Code example   

In this example we activate INT0 using pin I0_5 from M-duino board. When there’s a change  

#define INTERRUPT I0_5 //other pins: I0_6, I2_6, I2_5, I1_6, I1_5 (M-Duino) I0_0, I0_3, I0_2, I0_1 (Ardbox)

volatile bool state = false;

void setup() {
  attachInterrupt(digitalPinToInterrupt(INTERRUPT), function_call_back, CHANGE);

void loop() {
  if (state == true){
    Serial.println("Interrupt activated");
    state = false;

void function_call_back(){ //Change led state
  state = true;



Ethernet  is the technology that is most commonly used in  wired local area networks  ( LANs ). 

A LAN is a  network  of computers  
and other electronic devices that covers a small area such as a room, office, or building. It is used in contrast to a  wide area  
network (WAN) , which spans much larger geographical areas.
Ethernet is a  network protocol  that controls how data is  
transmitted over a LAN. Technically it is referred to as the IEEE 802.3 protocol. The protocol has evolved and improved over time  
to transfer data at the speed of a gigabit per second.

Our M-Duino family incorporate the integrated W5500 IC.

WX5500  is a Hardwired TCP/IP embedded Ethernet controller that provides easier Internet connection to embedded systems. This chip enables users to have Internet connectivity in their applications by using the single chip in which  TCP/IP  stack, 10/100  
Ethernet MAC and PHY are embedded. The W5500 chip embeds the 32Kb internal memory buffer for the Ethernet packet  
processing. With this chip users can implement the Ethernet application by adding the simple socket program.  SPI  is provided for 
easy integration with the external microcontroller. 


Hardware configuration 

*IMPORTANT:  Make sure that your Ethernet PLC is powered (12-24Vdc). Just with USB is insufficient power to power up the  
Ethernet communication.


Switch configuration

For the Ethernet communication protocol there isn’t  any switch  that  affects  it. So it does not matter the configuration of the  
switches to implement Ethernet communication. 

Used pins

For Ethernet communication protocol, the defined  Arduino Mega  pin is  pin 10 , which is connected and already internally  
assembled to the  WX5500  Ethernet controller. W5500 IC communicates to the Mega board via  SPI bus  already assembled too.  
You can  
access easily to  Ethernet port  in our Ethernet PLCs, it is located at the top of the communications layer.

Ethernet hardware configuration must be plug and play. 



*IMPORTANT: Make sure to download the Arduino based PLC boards for Arduino IDE.

Software Configuration:

Once the hardware configuration is done, it is possible to proceed with the software configuration and also its usage. Firstable it is necessary to include
the Ethernet2.h library provided by Industrial Shields (has the same functionallity as Ethernet.h and also
the same usage).

#include <Ethernet2.h> 
* Remember that for the V7 version or earlier versions you must use the <Ethernet.h> library.

Ethernet2 Library - functions.

* Ethernet2.h library has the same functions as Ethernet.h.

Example Codes:

Echo TCP Server:

Once the server is running, any client can connect to the server. On this example it is used an M-Duino to generate the server. The
example of TCP client showed before could be one of the clients.

Next it is showed the Arduino IDE code:

// use Ethernet.h if you have a M-Duino V7 version
#include <Ethernet2.h>
// mac address for M-Duino
byte mac[] = { 0xBE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
// Ip address for M-Duino
byte ip[] = { 192, 168, 1, 100 };
int tcp_port = 5566;
EthernetServer server = EthernetServer(5566);
void setup()
  // initialize the ethernet device
  Ethernet.begin(mac, ip);
  // start server for listenign for clients
void loop()
  // if an incoming client connects, there will be bytes available to read:
  EthernetClient client = server.available();
  if (client.available()) {
    // read bytes from the incoming client and write them back
    // to the same client connected to the server

Echo TCP Client:

Once the server is running, M-Duino can connect to the server. On this example it is used an M-Duino to connect with the Node.js
server called server.js, the same as used on previous example link.

To configure the M-Duino, this post just follows the TCP example from Arduino web site with a few changes. To be able to connect to the server we must know the TCP server IP and the port where this server is listening.

Next it is showed the Arduino code:

#include <Ethernet2.h>
#include <SPI.h>
byte mac[] = { 0xBE, 0xAD, 0xBE, 0xEF, 0xFE, 0xED };
byte ip[] = { 192, 168, 1, 100 };
byte server[] = { 192, 168, 1, 105 }; // Touchberry Pi Server
int tcp_port = 5566;
EthernetClient client;
void setup()
  Ethernet.begin(mac, ip);
  if (client.connect(server, tcp_port)) { // Connection to server.js
    Serial.println("Connected to server.js");
  } else {
    Serial.println("connection failed");
void loop()
  if (client.available()) {
      char s =;
      client.write(s); // Send what is reed on serial monitor
      char c =;
      Serial.print(c); // Print on serial monitor the data from server 
  if (!client.connected()) {
    for(;;) ;

To know more about Ethernet communication...

Ethernet with HTTP.
Ethernet with MQTT.
Ethernet with Modbus TCP/IP (PLC = Slave).
Ethernet with Modbus TCP/IP (PLC = Master).