Analysis of the ESP32 PLC 14 pinout time response

September 2, 2024 by
Analysis of the ESP32 PLC 14 pinout time response
Boot & Work Corp. S.L., Queralt del Águila Munté

Introduction

The ESP32 PLC 14 is a programmable logic controller (PLC) that utilizes an ESP32 microcontroller and features a total of 14 inputs and outputs. Among these, there are 4 digital outputs, 7 digital inputs, 2 analog inputs, and 1 relay output.


The ESP32 PLC 14 is a powerful and versatile industrial controller that offers a wide range of functionalities. In this article, you will learn more about its pin-out features, measuring aspects such as maximum switching frequency and rise or fall times.


Understanding these aspects is crucial for interacting with external peripherals and developing applications that requires precise timing.


Requirements

To measure the following specifications, we have used the following products:      

  • If you want to measure the open source based PLC characteristics, you will also need a precise oscilloscope capable of reading at the 100ns scale.

Digital Outputs

The following code creates a task named "Task1" in a system using FreeRTOS. The task toggles the pin Q0_0, configured as an output, between a high and low state every 10 ms. This oscillation pattern can control external devices connected to the pin. The task has a priority of 25 and a stack size of 10000 bytes.

TaskHandle_t Task1;

void setup() {
pinMode(Q0_0, OUTPUT);
xTaskCreate(Task1code,"Task1",10000,NULL,25,&Task1);
}
void loop() {}

void Task1code( void * parameter ) {
for(;;) {
digitalWrite(Q0_0, HIGH);
delay(10);
digitalWrite(Q0_0, LOW);
delay(10);
}
}

The available digital output pins are defined between Q0_0 and Q0_3. 

Output frequency

Period

Delay

Duty cycle​

19,53 kHz

51 μs

25 μs

82,23 %

333,3 Hz

3 ms

1,5 ms

50 %

Rise time

Fall time

15,40 ns

5,36 μs


The first digital output operates at a high frequency of 19.53 kHz, with a short period of 51 μs and a relatively high duty cycle of 82.23%. In contrast, the second digital output exhibits a lower frequency of 333.3 Hz, featuring a longer period of 3 ms and a balanced duty cycle of 50%. These distinctions in frequency and duty cycle suggest different operational characteristics, catering to varied application requirements, from rapid switching to a more balanced state distribution for external device control.

The rise time for the signal is exceptionally fast at 15.40 ns, indicating how quickly the signal transitions from low to high. In contrast, the fall time is significantly slower at 5.36 μs, suggesting a comparatively slower transition from high to low. These observations highlight the asymmetrical behavior of the signal, with a much quicker rise than fall time, which could impact the signal's stability and response time in certain applications.

Digital Inputs

The following code creates a task in a system using FreeRTOS to measure the execution time of a digitalRead operation on a specific pin. Variables for maximum and average time are defined, the task is set up to read the pin a specified number of times, the execution time of each operation is measured, and the maximum and average time are printed via serial communication. Once the task is completed, it deletes itself, thus ending the application.

TaskHandle_t Task1;
unsigned long t1, t2, t_max, t_average;

#define PIN I0_7
#define READ_TYPE digitalRead
#define N_AVERAGE 10000

void setup() {
Serial.begin(115200);
pinMode(PIN, INPUT);
xTaskCreate(Task1code, "Task1", 10000, NULL, 25, &Task1);
}
void loop() {}

void Task1code( void * parameter ) {
t_max = 0;
t_average = 0;
for (long i = 0; i < N_AVERAGE; i++) {
t1 = micros();
READ_TYPE(PIN);
t2 = micros();
t_average += (t2 - t1);
if (t_max < t2 - t1) t_max = t2 - t1;
}
Serial.print("Max time: ");
Serial.println(t_max);
Serial.print("Average time: ");
Serial.println(t_average / (float)N_AVERAGE);

vTaskDelete(NULL);
}

The available digital input pins are defined between I0_0 and I0_6. Moreover, pins I0_7 and I0_8 can also be used as digital.


Average (μs)

Max time (μs)​

Digital input

455

660

This approach allows for accurate timing analysis of digital input operations. In a specific scenario where the digital input pin I0_7 is being monitored, the average execution time is measured at approximately 455 microseconds, with a maximum execution time of 660 microseconds.

Analog Inputs

The following code creates a task in a system using FreeRTOS to measure the execution time of an analogRead operation on a specific pin. Variables for maximum and average time are defined, the task is set up to read the pin a specified number of times, the execution time of each operation is measured, and the maximum and average time are printed via serial communication. Once the task is completed, it deletes itself, thus ending the application.

TaskHandle_t Task1;
unsigned long t1, t2, t_max, t_average;

#define PIN I0_7
#define READ_TYPE analogRead
#define N_AVERAGE 10000

void setup() {
Serial.begin(115200);
pinMode(PIN, INPUT);
xTaskCreate(Task1code, "Task1", 10000, NULL, 25, &Task1);
}
void loop() {}

void Task1code( void * parameter ) {
t_max = 0;
t_average = 0;
for (long i = 0; i < N_AVERAGE; i++) {
t1 = micros();
READ_TYPE(PIN);
t2 = micros();
t_average += (t2 - t1);
if (t_max < t2 - t1) t_max = t2 - t1;
}
Serial.print("Max time: ");
Serial.println(t_max);
Serial.print("Average time: ");
Serial.println(t_average / (float)N_AVERAGE);

vTaskDelete(NULL);
}

The available analog input pins are defined as I0_7 and I0_8.

As a

Average (μs)

Max time (μs)

Digital input

1

23

Analog input (4-20mA)

94

524

Analog input (0-10V)

90

517

In summary, digital input operations on an ESP32 PLC 14 I/Os exhibit low latency and consistency, with an average of 1 μs and a maximum of 23 μs. Analog input readings, whether in the 4-20mA or 0-10V range, show higher execution times, averaging 94 μs and 90 μs respectively, with peaks up to 524 μs and 517 μs, indicating slower and more variable performance compared to digital inputs.

Summary

Inputs

Input type

Sampling frequency - Average

Sampling frequency - Highest read time

Digital (IX.0-6)

455 μs

660 μs

Digital (IX.7-8)

1 μs

23 μs

Analog (IX.7-8)

94 μs

524 μs

Outputs

Output type

Maximum stable frequency

Signal Frequency - Maximum

Rise time

Fall time

Digital (QX.0-3)

333,3 Hz

19,53 kHz

15,40 ns

5,36 μs

Conclusion

The ESP32 PLC displays a wide range of performance characteristics across its inputs and outputs. Digital inputs, spanning IX.0-6, showcase moderate read times with an average sampling frequency of 455 μs and a maximum of 660 μs, while the faster IX.7-8 inputs demonstrate rapid response times averaging 1 μs and peaking at 23 μs. Analog inputs in the IX.7-8 range exhibit slower read times, averaging 94 μs and peaking at 524 μs, emphasizing a longer duration for analog signal processing. On the output side, digital outputs (QX.0-3) can achieve a maximum stable frequency of 333.3 Hz and signal frequencies up to 19.53 kHz. However, these outputs display asymmetrical behavior with a fast rise time of 15.40 ns and a slower fall time of 5.36 μs. This diverse array of characteristics underscores the versatility of the ESP32 PLC, requiring careful consideration and optimization to meet specific application demands effectively.

In conclusion, the ESP32 PLC with its 14 I/Os offers a plethora of features and precise timing capabilities, rendering it a robust and versatile choice for various applications. Understanding the pin-out characteristics, including maximum switching speed, rise and fall times, and read times, is crucial for seamless integration with external devices. The PLC has different performance features for its digital outputs, digital inputs, and analog outputs. These aspects need careful consideration when developing applications. By using these features well and paying attention to their details, the ESP32 PLC can give reliable and accurate results for industrial automation and control needs.


​Search in our Blog

Analysis of the ESP32 PLC 14 pinout time response
Boot & Work Corp. S.L., Queralt del Águila Munté September 2, 2024
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 >>>