How to program the 10 I/Os ESP32 industrial PLC via WiFi

How to upload a program to the 10 I/Os PLC controller using a WiFi connection
December 7, 2020 by
How to program the 10 I/Os ESP32 industrial PLC via WiFi
Boot & Work Corp. S.L., Marti Guillem Cura


1. OTA
2. Requirements
3. Configuration
    3.1 First Steps
    3.2 Initial Configuration
4. OTA configuration

Thanks to the use of the ESP32 module to control the Industrial Shields 10 I / Os industrial controller Arduino, you will be able to access the Wifi / Bluetooth connections without having to implement an external device. By using its Wi-Fi connection, you will be able to work with it remotely, to the point of being able to reprogram it without the need to use the computer's serial port by executing the OTA process.


OTA (Over the Air) is the process of uploading a program to the ESP32 module using the Wi-Fi connection instead of the serial port. This functionality will allow you to reprogram your PLC Arduino for industrial automation without the need to be nearby, solving situations where access to the module is limited or physically inaccessible.

The OTA process can be configured using the Arduino IDE, a Web browser, or an HHTPS server, although in our case we will use the Arduino IDE thanks to its simplicity and efficiency.

In any case, in order to configure the module via Wifi, the first program will have to be uploaded through the serial port to enable the Wifi option.


The requirements for the development of the implementation of the program using the Wifi network are as follows:


First Steps

First of all, to be able to work with the OTA process, make sure you have an ESP32 module as incorporated in PLCs of our brand. The "Arduino IDE" program must be installed together with our libraries, otherwise, you can prepare the work environment at the following link:

Click here >>

You can also check our blog where we explain all the steps to set up all the environment correctly. In these examples, we will work with an Industrial Shields PLC of the 10 I / OS ESP32 family.

Initial Configuration

Once the industrial Arduino IDLE has been configured and the necessary libraries have been installed, you will proceed to configure the ESP32 module of the programmable logic controller so that it can work, receive and upload programs via Wifi connection. The first time you work with it, you will need to use the serial port to be able to configure it. Therefore, you will connect the PLC to your computer and select the 10 IOS PLC FAMILY board -> "10 IOS PLC DIGITAL" together with the COM port that appears. Once selected, open the “BASICOTA” example program located in File -> Examples -> ARDUINO OTA.

Initial Configuration

The program will have to be uploaded for the initial setup. In it, you will define a sequence of parameters that you will have to keep for future modifications. The example uses the original Arduino ESP32 libraries:

#include <WiFi.h>
#include <ESPmDNS.h>
#include <WiFiUdp.h>
#include <ArduinoOTA.h>

 The first lines of code that you will find will be the most important for you. They define the parameters of the configuration of our local Wifi network, so you will have to modify them for your particular case by putting the name of the network and its password. Once these two parameters have been changed, the program should not be modified again.

const char* ssid = "…………";
const char* password = "…………*";  
Once changed, you will proceed to upload the program and, once uploaded, you will press the ENABLE button on the ESP32 (depending on the operating system used, this step can be skipped). If you open the serial monitor, you can see how it displays a message confirming that it has been connected correctly and showing the IP address that has been assigned to it. This IP address must be saved as it will be necessary later to identify the device on which you are working.

Initial Configuration

OTA Configuration

After completing the initial configuration, the ESP32 module of the PLC 10 I/Os will be configured to be remotely reconfigured via Wi-Fi connection. Now, you will proceed to upload a new program using the OTA process.

NOTE: it is necessary to include the OTA configuration in each new program that is uploaded to the ESP32 module, otherwise, after uploading the new program the ESP32 cannot be reconfigured using OTA. To re-enable the OTA process, the module must be reloaded with the initial configuration using the serial port.

It is recommended to modify the sample program so as not to leave any essential parameters of the Over The Air configuration. As an example, we will modify the initial sample program by adding the function of writing the phrase "Hello World!" Through the serial port. Moreover, we will get a voltage of 12V through the digital output Q0_9.

In the Loop () function, after the ArduinoOTA.handle() line, add a Serial.println () as shown below. The print will be called every second thanks to the original non-blocking function millis () from Arduino. In addition, you will do a digitalWrite () to be able to alternate the power supply with the state variables. Remember that, to use iteration, you must have previously declared an unsigned long constant for the time at the beginning of the program (in our case it will be the variable “Time”) and you must have declared pin Q0_9 as output by making a pinMode (Q0_9, OUTPUT ). The lLoop() function must be as it is shown:

void loop() {
state = !state;
Time = millis(); }
Once the program has been modified, in the tools for selecting the port (tools --> port) you can see how a new option has been added. It will appear as “Network Ports” with the name "esp32-xxxxxx at <your_esp_ip_address>". If the option is not visible, you must restart the Arduino IDE. To upload the new program make sure you are on the same Wi-Fi network as the PLC and select the new port located in "Network Ports". If the connections has been successful , you will see it as the next image. If there has been an error while uploading the program, please repeat the uploading operation as sometimes the first connection goes wrong.

OTA configuration

Doubts when using our open source based devices?

Our Customer Care department will answer all your questions.

​Search in our Blog

How to program the 10 I/Os ESP32 industrial PLC via WiFi
Boot & Work Corp. S.L., Marti Guillem Cura December 7, 2020
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 >>>