Sitelet https://github.com/rwbl/rOpen62541
Skip to content

Latest commit

 

History

68 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

rOpen62541

Warning

Final Testing & Documentation In Progress
The core server functionality is implemented and the API is approaching stability. Final testing, documentation, and project examples are still in progress, and minor API changes may occur before the v1.0.0 release.

rOpen62541 is an open-source B4R library wrapper for the industrial open62541 OPC UA protocol stack, specifically optimized for the ESP32-S3 Dual-Core architecture. It provides thread-safe cross-core communication, dynamic string-node creation with a flat hierarchy, and type-agnostic runtime write diagnostics.


Project Overview & Background

Author's Note & Personal Context (Click to expand)

This library was developed purely for personal educational use, born out of a desire to dive deep into industrial connectivity and tackle the challenging feat of wrapping the open62541 stack for B4R. It wasn't easy to build, but exploring cross-platform client integration — such as B4J with the PyBridge and opcua-asyncio or Node-RED — and seeing the dual-core hardware spring to life made it an incredibly rewarding project. Moving forward, this proof-of-concept server framework will serve as a foundational wireless gateway component for the author's open-source several MAKE projects.

What is OPC UA & What is it used for? (Click to expand)

OPC UA (Open Platform Communications Unified Architecture) is a robust, platform-independent, and highly secure industrial machine-to-machine (M2M) communication protocol framework widely deployed in Industry 4.0 / Industrial IoT (IIoT) environments. Unlike standard message-based IoT protocols (like MQTT), OPC UA provides a unified Address Space allowing devices to structurally expose complex object folders, variable data nodes, and custom tracking methods with rich data metadata. It is extensively used to interconnect hardware sensors, embedded controllers, PLCs, industrial SCADA systems, and high-level enterprise MES/ERP software architectures seamlessly over modern Ethernet/Wi-Fi networks.


Purpose & Scope

  • Server-Only Architecture: This library is dedicated exclusively to acting as an OPC UA Server data provider; it does not include client connection parsing capabilities.
  • Proof of Concept & Learning Project: This framework was explicitly developed as a personal educational project to learn the foundational basics of OPC UA by creating a custom standalone hardware device from scratch.
  • No Professional Intent: There is absolutely no intention for this codebase to be deployed in mission-critical environments, production facilities, or professional commercial installations.

Note: For a detailed breakdown of the underlying dual-core task design and memory synchronization layers, see the Developer Notes.


Node Hierarchy

rOpen62541 uses a simple, flat node hierarchy.

All application nodes are added directly below the root object:

Objects (ns=0;i=85)
└── Factory_Floor (ns=1;s=Factory_Floor)
    ├── Temperature
    ├── Humidity
    ├── Pump1_Status
    ├── Pump1_Speed
    ├── Valve1_Status
    ├── Production_Count
    └── Trigger

Folders and additional hierarchical levels are not supported by the current B4R wrapper. This is an intentional design choice to keep the B4R API simple and to minimize RAM usage and processing overhead on ESP32-class microcontrollers.

For applications requiring a logical structure, prefix naming can be used to organize nodes while retaining the flat hierarchy. This is similar to the tag-naming approach commonly used in industrial automation systems:

Factory_Floor
├── Tank1_Temperature
├── Tank1_Level
├── Tank1_Pressure
├── Pump1_Status
├── Pump1_Speed
├── Pump2_Status
└── Pump2_Speed

For example:

OPCUAServer.AddFloatNode("Tank1_Temperature", "Tank 1 Temperature", 22.5)
OPCUAServer.AddFloatNode("Tank1_Level", "Tank 1 Level", 75.0)
OPCUAServer.AddBooleanNode("Pump1_Status", "Pump 1 Status", False)

This approach provides a simple and predictable OPC UA address space while keeping the wrapper lightweight and well suited for embedded ESP32 applications.


Compatibility & Verified Clients

Hardware & Platform Compatibility

  • Supported Hardware: Optimized for Espressif ESP32-S3 high-memory microcontrollers (specifically the N16R8 format featuring 16MB Flash and 8MB PSRAM).
  • Network Layer: Requires standard embedded network lwIP socket frameworks to be initialized on boot.

Verified OPC UA Clients

This server implementation complies strictly with core industrial data-modeling specs and has been successfully verified across multiple desktop, terminal, and automation client ecosystems:

  • Node-RED - Fully interoperable using the standard node-red-contrib-opcua flow palette node module.
  • opcua-commander - Validated using the interactive, keyboard-driven terminal curses explorer (TUI).
  • B4J (Native Client) - Integration with OPC UA Client library for B4J.
  • B4J with PyBridge - Working via Python-backend socket communication routing bridges PyBridge framework.
  • Node.js OPC UA Stack — Working via simple TypeScript client example.

Install

Download the repository from GitHub.

  • Copy the src sub-folder rOpen62541 into your B4R Additional Libraries folder, keeping the folder structure fully intact.
  • Copy the src file rOpen62541.xml into your B4R Additional Libraries folder. Note: B4R installation instructions in case not installed.

Project Code Examples

The repository includes complete, ready-to-run environment folders tracking specific implementation patterns:

  • Go to the Project Examples Index — Explore runnable source code frameworks for Environment Simulation, Method Callbacks, Peripheral I/O Mapping, and System Node ID lookups.

Project Screenshot Example

InOut


Guides & Documentation

For detailed tutorials, API blueprints, and environment configurations, please visit our centralized documentation hub:


License

  • rOpen62541 Library * MIT License as stated in the LICENSE file provided with rOpen62541.
  • Open62541 Library * Mozilla Public License v2.0 as stated in the LICENSE file provided with open62541.

Credits


Disclaimer

  • All product names, logos, protocols, and brands are property of their respective owners.
  • This B4R library is an independent open-source wrapper tracking standard open62541 architectures.
    • It is neither officially endorsed nor maintained by the primary open62541 project core maintainers.
  • This codebase represents a strict standalone proof-of-concept / learning exercise and is explicitly not intended for professional, commercial, or critical industrial application.
  • This wrapper, its cross-core FreeRTOS mutex mappings, and its data type interceptor routines were designed and polished with the specialized interactive assistance of an AI engineering collaborator, achieving optimal compatibility with the B4R pre-compiler stack.

About

rOpen62541 is an open-source library wrapper for the industrial open62541 OPC UA protocol stack, specifically optimized for the ESP32-S3 Dual-Core architecture.

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages