tefod
Hi everyone,

I'm using OpenPLC on an ESP32 board and would like to add a small web server alongside it. The idea is to create a simple web interface (e.g., accessible from a smartphone) to change parameters like pulse time and pause time - basically using a webpage as a mini HMI or SCADA.

There are many ESP32 projects where a web server is included by default (like Tasmota, WLED etc).

Is it possible to run OpenPLC and a custom web server at the same time on an ESP32? And how can I pass values from the web interface (like sliders or input fields) into OpenPLC variables, such as %MW0 or %MW1, so I can use them in my ladder logic?
Has anyone done this before, or are there any examples or tips on how to integrate OpenPLC with a web front end on ESP32?
Thanks a lot!
Reply 0 0
Draxcat
I'd like to know that as well ta
Reply 0 0
thiagoralves
You might be able to do that using an Arduino Extension on your program. OpenPLC does not provide any native support for a webserver. You will have to write the webserver code yourself in the Arduino Extension. There are several Arduino Extension examples at the file->example menu for you to check
Reply 1 0
tefod
Thx hanks for ur reply 😊
Actually I know how to run a webserver with Arduino Extension or PlatformIO. My issue is coexistence: once I flash OpenPLC, it overwrites the whole ESP32, so the webserver is gone.  What I’m looking for is a way to run both at the same time - the compiled OpenPLC logic plus a small web frontend to interact per Web with this logic.

I guess it might also be enough if I can just take the C code that OpenPLC generates from IEC61131 and somehow integrate that into a PlatformIO project.
Reply 0 0
thiagoralves
That’s exactly what an Arduino Extension does. It allows you to run Arduino code alongside your PLC code on the same board at the same time.
Reply 1 0
tefod
Ah, now I get what you meant - the Arduino Extension inside OpenPLC itself. I hadn’t noticed that before (and I think it’s not really documented, or at least I totally missed it). I just searched a bit and found this blog post respectively this video about it, and it looks exactly like what I was trying to do.
That’s a really good hint, thanks a lot - and also for the hint with the examples!

I’ll go throughgive it a try and will post here how far I get with it. Appreciated!
Reply 1 0
Reply