Matlab simulation of ESP32 integration with a Raspberry PI soft-PLC via MQTT
Authors/Creators
Description
This paper presents a MATLAB-based simulation framework for evaluating the temporal behaviour of an ESP32–MQTT–Soft-PLC integration intended for future deployment on a Raspberry Pi Soft-PLC platform. The proposed setup emulates a typical industrial IoT chain in which a virtual ESP32 node acquires synthetic ADC-like sensor data with Gaussian noise, performs preprocessing and normalisation, injects software jitter at task level, and publishes timestamped JSON messages via a Python MQTT client over a TLS-secured connection to a cloud-based MQTT broker. On the control side, a MATLAB Soft-PLC subscribes to the same MQTT topic, updates a process image at the beginning of each scan cycle and executes an ON-delay (TON) timing logic, while logging all relevant timestamps for performance analysis. End-to-end latency is defined as the time difference between publication at the ESP32 node and processing in the Soft-PLC, whereas jitter is evaluated as the deviation of the actual scan time from a nominal scan period. For a 30-second experiment with a 50 ms nominal scan time, the measured end-to-end latency exhibits a mean of 568.06 ms, with values ranging from 64.11 ms to 1144.76 ms, while the Soft-PLC scan time shows an average of 62.64 ms and a maximum of 172.03 ms. These results characterise the architecture as a soft real-time solution suitable for monitoring, data acquisition and supervisory control, but not for hard real-time applications with strict millisecond-level deadlines. The framework thus provides a practical basis for analysing latency and scan jitter before migrating the ESP32–Soft-PLC integration to real Raspberry Pi-based controllers.
Files
117-128_MAROSAN.pdf
Files
(1.2 MB)
| Name | Size | Download all |
|---|---|---|
|
md5:839bb8a1e97b7cbcd97bc3781b7c600b
|
1.2 MB | Preview Download |