Critical Scaling and Output Forcing Issues with ESP32 in OpenPLC
Hello everyone,
I'm working on an OpenPLC project using an ESP32 as the main hardware platform and have encountered two distinct, persistent issues related to analog I/O during commissioning. These problems are making setup very difficult.
1. Critical Scaling Problem on Analog Input (
)
We've detected an
extreme inconsistency in the scaling for the analog input's maximum voltage value. While low input voltages map relatively correctly to OpenPLC's internal range (
![]()
to
![]()
), and mid-range values show mixed consistency, the maximum voltage of
![]()
generates an absurdly low reading of only
![]()
, instead of the expected
![]()
. This is not attributable to noise, as the value is stable. We can confidently rule out physical hardware issues because we
tested the exact same connection and pin using the Arduino IDE, and the analog read function performed correctly across its full range (
![]()
to
![]()
for the ESP32's
![]()
-bit ADC). This leads us to believe the problem lies within the
OpenPLC Micro Runtime's software layer for the ESP32. Specifically, the
ADC Attenuation might not be correctly configured to read up to
![]()
. Since this issue occurred using the
OpenPLC version 2024, I'm wondering if this is a known bug that has been patched in subsequent Micro Runtime updates.
2. Output Forcing Failure in Live Debug Mode
I'm also facing issues when attempting to
force analog output values (i.e., changing the value of the memory variable,
![]()
, that moves to the output
![]()
) using the
Live Debug Remote PLC mode (the "Monitoring" section of the Runtime). This forcing worked perfectly in the
Editor's simulation; however, after transferring the program to the ESP32 and accessing the
live Runtime interface, forcing the memory variable had no effect on the physical analog output.
My key question here is: How can I force these outputs in the real execution environment?
Must I use the OpenPLC Runtime on my PC and register the ESP32 as a Modbus/RTU slave for output forcing to work correctly? Or, is there a known limitation in the ESP32 firmware that prevents forcing the internal memory variables (
![]()
) when it is running as the main PLC?
Any guidance or confirmation on whether the forcing mechanism requires a Master/Slave architecture (PC as Master/Runtime, ESP32 as Slave/I/O) would be greatly appreciated, as would any advice on the ADC scaling issue. Thank you very much for your help!