santhosh
I was wondering if it would be possible to create a program that would be downloadable to an Arduino or Rasberry Pi and would run without the PC connected as a master.

The Rasberry Pi and Arduino being quite capable devices should be able to handle the I/O reading and writing and also running the PLC program.

I find it a bit cumbersome and a waste of resources to have a laptop or PC to run a PLC program and use
a Rasberry Pi (a fully loaded PC)or Arduino as a Slave.

Please tell me if it is even possible to have I/O checking and PLC program running on the so called slave devices without  a PC to run the PLC program.
Quote 0 0
thiagoralves
The Raspberry Pi does not run as a slave device. It runs full OpenPLC runtime standalone. Check openplc website for installation instructions.

Arduino on the other hand is a very limited platform (8 bit architecture with just a few kB of RAM) and therefore can only run as a slave device
Quote 0 0
santhosh
Thanks I will try with the Pi...
Quote 0 0
sergei
when i "tick the box" : "load OpenPLC on boot" in "settings" and save.
then, when i return in setting , "load OpenPLC " is Off.

The only solution i've found is with "screen"
in SSH, i run screen, and then OPenPLC.
then, in my browser i "start PLC" and quit.
then in the terminal i "detach" the screen session and quit SSH.

But how to make that when i start the PI the program with OpenPLC work directly ?
Quote 0 0
thiagoralves
I put the switch in there but never implemented the code to actually make it work, sorry. My idea was to use some scripting to automatically add OpenPLC to your /etc/rc.local file, but it seems that recent Debian versions dropped rc.local support completely. I'm thinking about having a more "robust" implementation and actually install OpenPLC as a service. This can be turned on and off during boot pretty easily. On my next round of free time I will work on that.
Quote 0 0
tim292stro
This is what I do on my upgraded Debian boxes so that I don't have to recode everything...

https://www.itechlounge.net/2017/10/linux-how-to-add-rc-local-in-debian-9/

You don't have to do it in rc.local, you can take their template and if you detect systemD versus systemV (do a "which" command and look for the one that returns a value), you can spawn a service at installation that does what rc.local would have.
Quote 0 0
thiagoralves
That's what OpenPLC v3 is doing since a while ago. =)
Quote 0 0