OpenPLC-on-SL-AIoT-BOX-SpaceSOM-8Mplus
From SomLabs Wiki
OpenPLC on SL-AIoT-BOX with SpaceSOM-8Mplus
OpenPLC runtime
The default Debian Flexbuild system image for SL-AIoT-BOX with SpaceSOM-8Mplus has OpenPLC runtime installed and enabled (https://autonomylogic.com/docs/openplc-overview/). After running the system, the OpenPLC webserver can be accessed using the network name or IP address with 8080 port:
- http://somlabs-aiot-box-8mplus:8080
- <IP address>:8080
The IP address can be checked after logging to the serial console as root (no password) and calling ip a command.
The default webserver login credentials are:
- username: openplc
- password: openplc

Setting hardware
OpenPLC requires correct hardware driver to support hardware inputs and outputs. The driver for the SL-AIoT-BOX is called SoMLabs IoT Box and should be selected in Hardware window. After clicking Save changes the driver will be compiled.


SL-IoT-BOX has six binary outputs and four binary inputs configured for OpenPLC programs. They are mapped as follows:
| OpenPLC address | GPIO | Connector | Function |
|---|---|---|---|
| %IX0.0 | GPIO1_IO4 | J7A_2 | Digital input |
| %IX0.1 | GPIO1_IO05 | J7A_3 | Digital input |
| %IX0.2 | GPIO1_IO6 | J7A_4 | Digital input |
| %IX0.3 | GPIO1_IO7 | J7A_5 | Digital input |
| %QX0.0 | GPIO1_IO08 | J7B_2 | Digital output |
| %QX0.1 | GPIO1_IO09 | J7B_3 | Digital output |
| %QX0.2 | GPIO1_IO10 | J7B_4 | Digital output |
| %QX0.3 | GPIO1_IO11 | J7B_5 | Digital output |
| %QX0.4 | GPIO1_IO00 | J7D_7-9 | Relay output |
| %QX0.5 | GPIO1_IO01 | J7D_10-12 | Relay output |
Demo application
OpenPLC runtime executes programs built using OpenPLC IDE (https://autonomylogic.com/). The example project and pre-compiled program can be downloaded here: Openplc_demo.zip
This example uses all four binary inputs to control binary outputs and two relays as shown on the project scheme.

It can be uploaded to SL-AIoT-BOX OpenPLC runtime in the Programs window:


After compilation the project can be run using the Start PLC button in Dashboard window

The program autostart after system boot can be enabled in the Settings window
