How to reset a PLC using the Ethernet Shield

December 24, 2018 by
How to reset a PLC using the Ethernet Shield
Alejandro Jabalquinto


In this post, it will be seen how to configure the Ethernet Shield to allow the user to send a reset via Ethernet, instead of pressing the button manually. 


Ethernet or 20 I/Os PLC:      Ethernet PLC             20 I/Os PLC     

Industrial Shields boards:   Industrial Shields Boards


This configuration is useful in order to upload a sketch using the Ethernet shield instead of the USB. Typically the upload is made via USB, in this case, the Arduino IDE sends an order to the Arduino shield to reset it. When it is via Ethernet this is not possible by default. I mean that you have to send a command which the Ethernet shield will accept in order to reset. This is why it has to be configured. 

This configuration is made using the own software of the sketch. This means that in the sketch you need to add some configuration telling that when you talk with the PLC via Ethernet using a certain port, it will reset automatically.


Let’s see how it is done this configuration in the software:

#include <avr/wdt.h>                                              //library to enable the remote reset
#include <Ethernet2.h>                                            //library to configure the Ethernet Shield

uint8_t mac[] = {0xde, 0xad, 0xbe, 0xef, 0xfe, 0xed};             //mac name
uint8_t ip[] = {192, 168, 1, 211};                                //ip name

EthernetServer server(2000);                                      //port for the communication

void setup() {
    wdt_disable();                                               //disabled remote reset in the setup
    Serial.println("remote-reset started");
    Ethernet.begin(mac, ip);                                     //configure the ethernet shield with mac,ip name
    server.begin();                                              //enable the server communication

void loop() {
    wdt_reset();                                                 //reset the library to prepare the remote reset
    EthernetClient client = server.available();                  //looks if there is something on port 2000
    if (client) {
        wdt_enable(WDTO_4S);                                     //force the reset
        while (true);
   //Code for the Arduino 

Using this sketch we will be configuring the shield to give it a name in order to talk to the PLC using Ethernet. Now the PLC is able to reset by the time you send a single character (“a”) after establishing conexion using the IP and the port 2000.  

Keep in mind the reset itself will be done after the current loop is finished, so in large programs the reset may no be done instantly and may take a while.

Search in our Blog

How to reset a PLC using the Ethernet Shield
Alejandro Jabalquinto December 24, 2018
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

Industrial PLC comparison >>>