You can’t use the UART pins and OpenPLC Raspberry Pi driver at the same time, since OpenPLC will try to control the UART pins as regular I/O. You have to either disable the Raspberry Pi driver (use Blank for example) or connect the Arduino through the USB
Hello Thiago. I do it!!! I've modified hardware layer (raspberrypi.cpp) to liberate UART PINs.
Next, i disable bluetooth and asign ttyAMA0 to serial 0.
With this, i have 8 inputs and 8 outputs on Raspberry GPIOs. For the other hand, via modbus RTU, i made an slave (with an Arduino to probe),
and through modbus I have extended the outputs writing in Coils.
Also, one output is reserved to indicate PLC RUN. With this, when PLC stops, all slaves can deactivate your outputs.
To comunicate Raspberry to Arduino (slave Modbus RTU device) i used to MAX485.
I plan to create slave input and output devices, both digital and analog, to extend those of the CPU. With this you have the options of having a base PLC with 8 digital inputs and 8 digital outputs, and if you need more, you can add slave modules.
please tell me if this is interesting, to put together a tutorial on how to do it.