You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: content/hardware/07.opta/opta-family/opta/tutorials/01.user-manual/content.md
+181
Original file line number
Diff line number
Diff line change
@@ -1211,6 +1211,187 @@ You should be able now to connect to your Opta™ using a central device. The Bl
1211
1211
1212
1212

1213
1213
1214
+
## OPC Unified Architecture (OPC UA)
1215
+
1216
+
This section explains the use of the [**OPC UA library**](https://github.com/arduino-libraries/Arduino_OPC_UA) designed for Opta.
1217
+
1218
+
1219
+

1220
+
1221
+
The library is based on the [**Fraunhofer open62541**](https://github.com/open62541/open62541) implementation of [**OPC UA**](https://en.wikipedia.org/wiki/OPC_Unified_Architecture), created specifically for the Opta family.
1222
+
1223
+
The [**OPC Unified Architecture (OPC UA)**](https://en.wikipedia.org/wiki/OPC_Unified_Architecture) is an industrial communication protocol widely used in automation and Industrial Internet of Things (IIoT) systems.
1224
+
1225
+
It provides a platform independent and secure method for exchanging information between devices and systems. **OPC UA** supports features like custom data modeling, authentication, encryption, and scalable architecture, making it a preferred choice for modern industrial applications.
1226
+
1227
+
The [**open62541** library](https://github.com/open62541/open62541) is an open-source implementation of the **OPC UA** standard. It is lightweight, efficient and written in C, making it ideal for embedded systems like the Opta. The library provides a flexible framework to create **OPC UA** servers and clients, ensuring compatibility with the standard while maintaining high performance.
1228
+
1229
+
The [**OPC UA library**](https://github.com/arduino-libraries/Arduino_OPC_UA) supports secure communication and interoperability for industrial automation applications, with the capability to automatically detect, configure, and expose up to **two** Arduino Opta Expansion Boards via **OPC UA**. Supported expansion boards include:
1230
+
1231
+
- Digital Expansion with mechanical relays (D1608E)
1232
+
- Digital Expansion with solid-state relays (D1608S)
1233
+
- Analog Expansion (A0602)
1234
+
1235
+
***The OPC UA library supports a maximum of __two__ Opta expansions connected simultaneously.***
1236
+
1237
+
### Setting up the OPC UA Server
1238
+
1239
+
To set up the **OPC UA** server, upload the [**`opta_opcua_server`** example](https://github.com/arduino-libraries/Arduino_OPC_UA/blob/main/examples/opta_opcua_server/opta_opcua_server.ino) to your Opta. This can be done using either the Arduino IDE or the Arduino CLI.
1240
+
1241
+

1242
+
1243
+
Run the following command to compile and upload the example if used with the Arduino CLI:

1250
+
1251
+
***If you are not familiar with the __Arduino CLI tool__, you can refer to the getting started documentation found [here](https://arduino.github.io/arduino-cli/1.1/getting-started/).***
1252
+
1253
+
Next, connect the Opta to a network via its Ethernet port. Please make sure the network has a DHCP-enabled router or switch to assign an IP address to the device.
1254
+
1255
+
Use a serial monitor to check the server status and retrieve the device's IP address. You can use the Arduino IDE Serial Monitor or other programs like [**Putty**](https://www.putty.org/) to establish a serial connection.
1256
+
1257
+
The output will display details such as the **discovery URL**. Below is an example of the server log output on the Arduino IDE Serial Monitor:
1258
+
1259
+

1260
+
1261
+
With [**Putty**](https://www.putty.org/), the following serial connection shows the server information:
1262
+
1263
+

1264
+
1265
+
The output information is as follows and you should see similar information:
1266
+
1267
+
```bash
1268
+
[2024-12-11 22:19:08.000 (UTC+0000)] [32minfo/eventloop[0m Starting the EventLoop
1269
+
[2024-12-11 22:19:08.000 (UTC+0000)] [33mwarn/server[0m AccessControl: Unconfigured AccessControl. Users have all permissions.
1270
+
[2024-12-11 22:19:08.000 (UTC+0000)] [32minfo/server[0m AccessControl: Anonymous login is enabled
1271
+
[2024-12-11 22:19:08.000 (UTC+0000)] [33mwarn/server[0m x509 Certificate Authentication configured, but no encrypting SecurityPolicy. This can leak credentials on the network.
[2024-12-11 22:19:08.000 (UTC+0000)] [33mwarn/server[0m Maximum SecureChannels count not enough for the maximum Sessions count
1287
+
[2024-12-11 22:19:08.000 (UTC+0000)] [32minfo/network[0m TCP | Listening on all interfaces
1288
+
[2024-12-11 22:19:08.000 (UTC+0000)] [32minfo/network[0m TCP 604424824 | Creating listen socket for "192.168.100.191" (with local hostname "192.168.100.191") on port 4840
1289
+
[2024-12-11 22:19:08.000 (UTC+0000)] [32minfo/server[0m New DiscoveryUrl added: opc.tcp://192.168.100.191:4840
In this example, the output displays the **IP address**:
1294
+
1295
+
```bash
1296
+
192.168.100.191
1297
+
```
1298
+
1299
+
The **discovery URL** is as follows, which indicates the OPC UA server is running at:
1300
+
1301
+
```bash
1302
+
opc.tcp://192.168.100.191:4840
1303
+
```
1304
+
1305
+
You can now connect to the OPC UA server running on Opta.
1306
+
1307
+
### Connecting to the OPC UA Server
1308
+
1309
+
Once the server is running, you can use any OPC UA compatible client to connect to the server using the discovery URL. This allows interaction with the device and any connected expansion modules.
1310
+
1311
+
The [**opcua-client-gui**](https://github.com/FreeOpcUa/opcua-client-gui) client will be used to connect to the OPC UA server running on Opta in this section.
1312
+
1313
+
### Using OPC UA GUI Client for Testing
1314
+
1315
+
The [**opcua-client-gui**](https://github.com/FreeOpcUa/opcua-client-gui) client can be used if you are interested in testing or further interaction with the OPC UA server. To install the tool, please use the following commands:
1316
+
1317
+
```bash
1318
+
cd /tmp
1319
+
```
1320
+
1321
+
```bash
1322
+
git clone https://github.com/FreeOpcUa/opcua-client-gui && cd opcua-client-gui
1323
+
```
1324
+
1325
+
```bash
1326
+
python -m venv .venv
1327
+
```
1328
+
```bash
1329
+
source .venv/bin/activate
1330
+
```
1331
+
1332
+
```bash
1333
+
python3 -m pip install --upgrade pyopenssl
1334
+
```
1335
+
1336
+
```bash
1337
+
python3 -m pip install --upgrade .
1338
+
```
1339
+
1340
+
If you are on a Windows OS platform, please follow the next steps:
1341
+
1342
+
1. Install [**WinPython**](https://winpython.github.io/) and install the version including **`pyqt5`**.
1343
+
1344
+
2. Use `pip` to install **opcua-client**:
1345
+
1346
+
```bash
1347
+
pip install opcua-client
1348
+
```
1349
+
1350
+
It is recommended that the command be run within the *`WinPython Command Prompt`* downloaded with [winpython](https://winpython.github.io/).
1351
+
1352
+
3. Run via the script `pip` created: `YOUR_INSTALL_PATH\Python\Python35\Scripts\opcua-client.exe`
1353
+
1354
+
It will launch the GUI and connect to the OPC UA server running on the Opta using the discovery URL. You will be able to see similar results as in the following clip:
1355
+
1356
+

1357
+
1358
+
With this, Opta is ready to handle the OPC UA protocol through simple [OPC UA GUI client](https://github.com/FreeOpcUa/opcua-client-gui). The interface allows browsing, subscribing to variables, writing values, and performing other interactions.
1359
+
1360
+
***For more information about the simple OPC UA GUI client and dedicatd installation instruction sets, please refer to [__opcua-client-gui__ repository](https://github.com/FreeOpcUa/opcua-client-gui).***
1361
+
1362
+
### Memory Debugging Insight
1363
+
1364
+
Additional configuration is possible for developers requiring detailed heap and stack memory usage information. The `mbed_app.json` configuration file should be modified to include memory and stack statistics macros to enable this feature.
1365
+
1366
+
The `mbed_app.json` file is found within [**`ArduinoCore-mbed`**](https://github.com/arduino/ArduinoCore-mbed/tree/main) at:
1367
+
1368
+
```bash
1369
+
variants/OPTA/conf/mbed_app.json
1370
+
```
1371
+
1372
+
Or the location can be referenced [here](https://github.com/arduino/ArduinoCore-mbed/blob/main/variants/OPTA/conf/mbed_app.json).
1373
+
1374
+
Add the following macros to enable memory and stack statistics:
1375
+
1376
+
```bash
1377
+
"target.macros_add": [
1378
+
...
1379
+
+ "MBED_HEAP_STATS_ENABLED=1",
1380
+
+ "MBED_STACK_STATS_ENABLED=1",
1381
+
+ "MBED_MEM_TRACING_ENABLED=1"
1382
+
]
1383
+
```
1384
+
1385
+
After making these changes, recompile the core library using the following commands:
1386
+
1387
+
```bash
1388
+
cd ArduinoCore-mbed
1389
+
```
1390
+
1391
+
```bash
1392
+
./mbed-os-to-arduino -a -g OPTA:OPTA
1393
+
```
1394
+
1214
1395
## Interrupts
1215
1396
1216
1397
**Opta's analog/digital programmable inputs and user-programmable button are interrupt-capable**. An interrupt is a signal that prompts Opta's microcontroller to stop its execution and start executing a special routine known as the Interrupt Service Routine (ISR). Once the ISR finishes, the microcontroller resumes executing its previous routine.
0 commit comments