Skip to content

ESP32 PLC Family

The ESP32 PLC Family is a range of programmable logic controllers (PLCs) based on the ESP32 dual-core microcontroller. These PLCs are programmable using the Arduino IDE, enabling flexible development, real-time monitoring, and efficient integration into advanced industrial systems.
This family includes multiple configurations, from the ESP32 PLC 19R to the ESP32 PLC 58, combining analog I/O, digital isolated and non-isolated I/O, PWM, and relay outputs.
All PLC models include built-in communication interfaces such as Ethernet, Wi-Fi, Bluetooth, RS485 (Half Duplex), RS232, dual Serial TTL, SPI, and I²C. Additionally, expansion slots allow the integration of optional communication boards such as LoRa, CAN, 4G, and more.
These features make the ESP32 PLC Family a bridge between industrial automation and monitoring systems.

ESP32 PLC Family device image
What is included on purchase (default product)
  • 1x ESP32 PLC model
  • 1x External Wi-Fi/Bluetooth antenna (SMA connector)
  • 1x CR1220 3 V coin cell battery for the RTC

The pack includes all the required connectors for the specific model

Requirements to use

  • 1x ESP32 PLC (any model)
  • 1x USB-A to Micro-USB 2.0 cable (for programming)
  • 1x DC power supply (12V-24V)

Model Overview

The family combines one communications zone (zone A) with one to three I/O zones (zones B, C and D). Each I/O zone is either an Analog/Digital zone or a Relay zone. All models share the same communication stack and expansion slots.

Model Analog Input Digital Isolated Input Digital Isolated Output Digital/Analog Output Relay Output
21 6 7 5 3 0
42 12 14 10 6 0
58 16 21 15 9 0
19R 4 2 0 3 8
38R 8 4 0 6 16
57R 12 6 0 9 24
38AR 10 9 5 6 8
57AAR 16 16 10 9 8
50RRA 12 11 5 9 16

Note

All Analog Inputs can work as Digital Inputs.

All Digital Outputs can also work as PWM Outputs.

The number in the model name is the commercial name of the model; the table lists the terminals available of each type.

Model Zone B Zone C Zone D
21 Analog/Digital - -
42 Analog/Digital Analog/Digital -
58 Analog/Digital Analog/Digital Analog/Digital
19R Relay - -
38R Relay Relay -
57R Relay Relay Relay
38AR Analog/Digital Relay -
57AAR Analog/Digital Analog/Digital Relay
50RRA Relay Relay Analog/Digital

Pinout

ESP32 PLC Communication Pinout

ESP32 PLC Analog Pinout

ESP32 PLC Relay Pinout

Technical Features

Processing and Memory

Feature Specification
Module ESP32-WROOM-32UE-N16
Clock speed 80 MHz - 240 MHz (adjustable)
Dual-core CPU 2x Xtensa 32-bit LX6 microprocessors
SRAM 520 KB
Flash storage 16 MB, plus microSD card slot
RTOS FreeRTOS (open-source, real-time)
RTC DS3231M real-time clock with CR1220 backup coin cell (included)

Connectivity

Interface Details
USB 1x Micro-USB Type B (for programming)
Ethernet 1x 10/100 Mbps Ethernet, RJ45
Wi-Fi 802.11 b/g/n, 2.4 GHz, provided by the ESP32 (external antenna)
Bluetooth/BLE Bluetooth v4.2 BR/EDR and BLE, provided by the ESP32
RS485 1x Half Duplex interface
RS232 1x Full Duplex interface
Serial TTL 2x TTL interfaces
I²C 5 V I²C bus
SPI 1x SPI interface (3.3 V - see warning below)
Expansion slots 2x slots (EXP1, EXP2) for optional communication boards such as LoRa, CAN or 4G; available boards depend on the model

Warning - SPI voltage level

The SPI works at a 3.3V voltage level. Any higher voltage might damage the PLC.

Warning - SPI bus shared with Ethernet

The Ethernet controller, the microSD card and the external SPI terminals share the same SPI bus. External SPI devices need their own chip select, which must stay inactive while the PLC uses Ethernet or the microSD card.

Block Diagram

ESP32 block diagram of how the PLC pins in zone A are connected to the ESP32 board

ESP32 block diagram of how the PLC pins in zone B are connected to the ESP32 board

ESP32 block diagram of how the PLC pins in zone C are connected to the ESP32 board

ESP32 block diagram of how the PLC pins in zone D are connected to the ESP32 board

ESP32 block diagram of how the PLC pins, including relays, in zone B are connected to the ESP32 board

ESP32 block diagram of how the PLC pins, including relays, in zone C are connected to the ESP32 board

ESP32 block diagram of how the PLC pins, including relays, in zone D are connected to the ESP32 board

Usage environments

Parameter Value
IP protection IP20
Ambient temperature (operating) 0 ºC to 60 ºC
Ambient humidity (operating) 10% to 90% (no condensation)
Ambient environment (operating) Free from corrosive gas
Ambient temperature (storage) -20 ºC to 60 ºC

Measures

Maximum envelope of the housing, from the 3D model of the product (H = along the DIN rail, D = from the DIN rail to the front).

Configuration H × W × D (mm) D with terminal plugs (mm)
21 and 19R 123.0 × 70.1 × 103.2 117.8
42, 38R and 38AR 123.0 × 94.7 × 103.2 117.8
58, 57R, 57AAR and 50RRA 123.0 × 119.3 × 103.2 117.8

DIN rail mounting.

Safety distance between the PLC, when mounted, and the rest of machinery

Warning

Inside the housing, cabinet or electric control room, keep at least the free space shown in the figure around the PLC: 30 mm above and 10 mm on each side.

Danger

Failure to follow these installation requirements could result in severe personal injury and/or property damage. Always follow these requirements when installing the ESP32 PLC Family.

Power supply

The ESP32 PLC Family is designed to be used with an external power supply of 12 to 24 Vdc (operating range 11.4 to 25.4 Vdc). The power input has reverse polarity protection.

Warning

Although at first glance it may seem like the PLC works when powered with the USB port, this is not the case. The usage of an external power supply is mandatory for the PLC to perform properly.

Next, a simple diagram is shown to illustrate the necessary connections to properly power an ESP32 PLC.

Diagram of the necessary connections, and how to connect them, to properly power an ESP32 PLC

Important

Respect the polarity: connect the positive of the power supply to Vdc and the negative to GND.

Warning

Once the equipment is installed inside an electrical cabinet, the low-voltage (SELV) cables of the equipment must be separated from the high-voltage cables.

Analog outputs

To reach the full 0-10 V range of the analog outputs, power the PLC at about 15 Vdc or more (see I/Os).

Initial Software Installation

The ESP32 PLC Family is programmed using Arduino IDE with the industrialshields-esp32 boards package. Follow these steps to prepare your development environment.

Step 1 - Download Arduino IDE

Download and install the latest version of Arduino IDE for your operating system from the official Arduino website.

Step 2 - Install the Industrial Shields boards package

  1. Open Arduino IDE.
  2. Go to File → Preferences
  3. In the Additional Boards Manager URLs field, add the Industrial Shields boards URL. Refer to the official installation tutorial for the current URL.
  4. Go to Tools → Boards Manager
  5. Search for industrialshields-esp32, select the latest version, and click Install.

Step 3 - Select your board and port

  1. Connect the PLC to your computer via Micro-USB.
  2. Connect and switch on the external DC power supply.
  3. In Arduino IDE, go to Tools → Boards and select your specific ESP32 PLC model.
  4. Go to Tools → Port and select the COM or serial port assigned to the PLC.

Step 4 - Upload your first sketch

Open any example sketch from File → Examples → IndustrialShields and click Upload to verify your setup.

// Minimal blink example - toggle digital output Q0.0 every second

void setup() {
  pinMode(Q0_0, OUTPUT);
}

void loop() {
  digitalWrite(Q0_0, HIGH);
  delay(1000);
  digitalWrite(Q0_0, LOW);
  delay(1000);
}

Note

Pin names such as Q0_0 are defined in the Industrial Shields board packages. Do not use raw ESP32 GPIO numbers - use the named constants for your model.

Hardware Configuration

DIP Switches

The ESP32 based PLCs have some switches that can be used to configure certain functionalities of the PLC. This section explains how to use them properly. The following nomenclature is used to locate every switch:

  • Zone A: the communications zone (Ethernet, USB and communication terminals).
  • Zones B, C and D: the I/O zones. Their terminals are numbered X.Y with X = 0 in zone B, X = 1 in zone C and X = 2 in zone D.

In each zone there are one or more switches, used to configure PLC functionalities. The following tables indicate the purpose of each switch and how to configure them.

Zone A

There is only one switch located on the bottom left responsible for selecting the type of communication.

Diagram of the bottom left switch in zone A's front
Switch RS485 TX1/RX1 RS232 TX2/RX2 EXP2
1 X X X X X
2 X X OFF ON ON
3 OFF ON X X X
4 X X X OFF ON
  1. Not used.
  2. This switch is used to select between RS232, Serial 2 and EXP 2 (expansion slot 2), used together with switch 4. RS232 is selected when the switch is OFF. When ON, Serial 2 or EXP 2 will be active, depending on switch 4 value (see switch 4 configuration).
  3. This switch is used to select among RS485 (OFF) and Serial 1 (ON).
  4. Used to select between EXP 2 (ON) and Serial 2 (OFF) when switch 2 is ON.

Zones B, C and D

Each Analog/Digital zone has an analog switch.

Diagram of the switch in zones B, C, and D's back
Switch Off On
1 AX.5 QX.5
2 AX.6 QX.6
3 AX.7 QX.7
4 X X

These switches are used to choose between digital or analog output, according to the previous table. If it is set to OFF, only the corresponding analog output will be available. If it is set to ON, only the corresponding digital output will be available. The switches behave the same way in zones B, C and D, with the "X" value being different depending on the zone:

  • Zone B: X = 0
  • Zone C: X = 1
  • Zone D: X = 2

Troubleshooting

Symptoms Likely cause Resolution
PLC does not boot when USB is connected No external power supply connected Connect and switch on a 12-24 V DC supply before use
Upload fails in Arduino IDE Wrong board or port selected Verify board selection and COM/serial port in the Tools menu
Upload fails in Arduino IDE External power supply not connected The USB port alone is insufficient - connect DC supply first
Ethernet stops working when an external SPI device is used The SPI bus is shared with the Ethernet controller Give the external device its own chip select and keep it inactive (HIGH) when not in use
Analog output not responding DIP switch set to digital output mode Set the relevant Zone B/C/D switch to OFF for that channel
Analog output does not reach 10 V Power supply below about 15 Vdc Power the PLC at 24 Vdc or use a high-impedance load
RTC loses time after power cycle Coin-cell battery missing or depleted Insert or replace the CR1220 battery
Device overheating or unstable behaviour Insufficient clearance inside cabinet Respect the clearances shown in the assembly recommendations