How realtimelogic/opc-ua-examples works
1. This repository is a set of self-contained OPC UA example deployments for Real Time Logic’s OPC-UA stack, intended to run on the Mako Server runtime. The architectural unit is usually a single example directory started with mako -l::Directory-Name.
2. The repo is split into three primary domains: server examples under servers/, client examples under client/, and embedded/device examples under esp32/. That separation is the main architectural boundary: each domain demonstrates a different role in the OPC UA ecosystem.
3. The server-side examples are mostly Lua-based OPC UA servers. Files such as servers/*/opcua_server.lua and servers/*/opcua_server.lsp define the server behavior, while .preload markers indicate Mako-managed startup hooks and module loading. These examples cover data exposure, node creation, browsing, reading/writing, and server configuration.
4. Several server examples include an embedded web UI. In those cases, index.html, ua_server.js, and vue.js sit beside the OPC UA server logic, showing a two-tier model: browser UI on top, OPC UA endpoint underneath. The embed_web_server and server_http / server_basic128rsa15 examples illustrate this integration.
5. Security is a distinct architectural concern in the server examples. The presence of .pem and .key files, along with example names like basic128rsa15, indicates secured OPC UA endpoints using certificates and encrypted channels. There is also a server_config example that likely focuses on runtime configuration rather than application logic.
6. The client side demonstrates OPC UA consumers rather than providers. client/auth_username and client/auth_x509 show different authentication paths against OPC UA servers, while client/start contains the entry script for a browser-synchronized or interactive client flow. The inclusion of certificates in auth_x509 reinforces the security/authentication boundary.
7. The ESP32 examples represent the hardware/device edge. esp32/1wire contains Lua modules for 1-wire sensor access, DS18B20 temperature reading, MQTT publishing, and an OPC UA server bridge. This is the clearest end-to-end data pipeline in the repo: physical sensor → Lua driver → MQTT publish / OPC UA exposure.
8. esp32/ignition is a separate embedded control example built around an LED and button. Its assets and opc-led-button-server.xlua suggest a hardware control loop where the microcontroller exposes or reacts to OPC UA variables/events tied to local GPIO state.
9. The data flow patterns are intentionally simple and repetitive across examples: device state or application variables are made available through OPC UA nodes; clients browse/read/write those nodes; optional web UIs render or control the same state through JavaScript calling into the server layer. This makes the repo useful for understanding OPC UA from both producer and consumer perspectives.
10. The repo relies on the Mako Server plugin model rather than a standalone application framework. That runtime choice matters architecturally because each example is packaged as a deployable directory with startup hooks, static assets, Lua logic, and optional certificates all co-located.
11. At the root, index.lsp and local_server.lua act as top-level helpers or entry points for local/demo execution. They are not the main application boundary so much as convenience scaffolding around the example directories.
12. For diagramming, the key boxes are: Mako Server runtime, OPC UA server examples, OPC UA client examples, browser/web UI examples, ESP32 device examples, and external dependencies such as certificates, MQTT, and physical sensors/buttons. The important arrows are server/client OPC UA sessions, browser-to-server HTTP/JS interaction, and hardware-to-server data acquisition/control.
Main entry points: start_server.lua Server start · opcua_server_mqtt.lua 1-wire · server_basic128rsa15/opcua_server.lsp Secure server · embed_web_server/opcua_server.lsp Embedded web UI
Components 21
Runtime
Mako Server packaging and shared demo entry points
- Mako Server · Directory-based runtime for launching each example
- Root entry · Top-level local/demo helpers
index.lsp - Local helper · Convenience local server script
local_server.lua
Server examples
OPC UA provider examples and server-side UI integrations
- Server start · Entry point for server example directories
servers/start/start_server.lua - Add nodes · Server example focused on node creation
servers/add_nodes/opcua_server.lua - Browse · Server example for browsing the address space
servers/browse/opcua_server.lua - Data source · Server example exposing dynamic data
servers/data_source/opcua_server.lua - Read data · Server example centered on read access
servers/read_data/opcua_server.lua - Write data · Server example centered on write access
servers/write_data/opcua_server.lua - Server config · Server example focused on runtime configuration
servers/server_config/opcua_server.lua - Embedded web UI · OPC UA server paired with browser UI
servers/embed_web_server/opcua_server.lsp - Secure server · OPC UA server with basic128rsa15 security and web UI
servers/server_basic128rsa15/opcua_server.lsp - HTTP server · Browser UI example backed by OPC UA logic
servers/server_http/opcua_server.lsp
Client examples
OPC UA consumer examples and authentication flows
- Client start · Entry point for interactive client flow
client/start/start_broswing_sync.lua - Username auth · Client example using username authentication
client/auth_username/auth_username.lua - X509 auth · Client example using certificate-based authentication
client/auth_x509/auth_x509.lua
ESP32 examples
Embedded device and hardware-edge examples
- 1-wire · ESP32 sensor bridge with Lua modules and MQTT/OPC UA integration
esp32/1wire/.lua/opcua_server_mqtt.lua - Ignition · ESP32 LED/button control example
esp32/ignition/opc-led-button-server.xlua - Sensors · 1-wire temperature sensor input
esp32/1wire/.lua/ds18b20.lua - LED & button · Local GPIO control and input
esp32/ignition/ignition-led-and-button-images - MQTT · Optional publish path from device example
esp32/1wire/.lua/mqtt_publish.lua
Connections 27
- Mako Server → Root entry: hosts · Runs top-level demo helpers
- Mako Server → Local helper: hosts · Runs local server helper
- Mako Server → Server start: launches · Starts server example directories
- Mako Server → Client start: launches · Starts client example directories
- Mako Server → 1-wire: launches · Runs embedded device example packages
- Mako Server → Ignition: launches · Runs embedded control example packages
- Server start → Add nodes: example · Server-side node creation demo
- Server start → Browse: example · Server-side browse demo
- Server start → Data source: example · Server-side data source demo
- Server start → Read data: example · Server-side read demo
- Server start → Write data: example · Server-side write demo
- Server start → Server config: example · Server configuration demo
- Server start → Embedded web UI: example · Hybrid OPC UA plus browser UI demo
- Server start → Secure server: example · Secured server demo
- Server start → HTTP server: example · HTTP and browser integration demo
- Embedded web UI → Secure server: shares UI pattern · Both combine OPC UA server logic with web assets
- HTTP server → Secure server: shares UI pattern · Both pair browser UI with server-side OPC UA logic
- Client start → Username auth: auth flow · Username/password client path
- Client start → X509 auth: auth flow · Certificate-based client path
- Username auth → Add nodes: connects to · Consumes OPC UA server endpoints
- X509 auth → Secure server: connects to · Consumes secured OPC UA endpoints
- 1-wire → Sensors: reads · Acquires temperature and sensor data
- 1-wire → MQTT: publishes · Sends device data over MQTT
- 1-wire → Data source: exposes · Bridges device data into OPC UA nodes
- Ignition → LED & button: controls · Maps OPC UA state to LED/button GPIO
- Data source → Username auth: served by · Data source example consumed by clients
- Embedded web UI → Root entry: browser sync · Web UI synchronized through server-side entry points