OPC UA protocol support in embedded systems


Industry 4.0


5 min read

What is OPC Unified Architecture (OPC UA)?

OPC Unified Architecture (OPC UA) is a modern standard for data exchange, increasingly used in industrial environments. It is characterized by high scalability and flexibility. One of the most important advantages of OPC UA is strong independence from the hardware layer, which makes it possible to implement this solution regardless of the architecture used. On the market, we can observe a huge emphasis on encrypted communication, essential when maintaining security outside the test environment — that is also one of OPC UA’s strong advantages.

Use of embedded systems in Industry 4.0

Embedded systems are the quiet heroes of our time. They are found in most new electronic devices because, in addition to their low power consumption and high performance, they are characterized by their perfect fit for the given application. They are undeniably the future of Industry 4.0 and the IoT world. Therefore, it was a matter of time before the first implementations of the OPC UA protocol appeared on microprocessors. It is distinguished by reduced requirements for operating memory and CPU time. Hardware support for floating-point numbers or encryption is also significant.

Open-source solutions

One of the free and best-refined implementations of OPC UA is the Open62541 project [1]. In addition to supporting systems such as Windows, Linux, VxWorks, QNX, or Android, it is also suitable for use with microcontrollers, provided the FreeRTOS real-time system and the LwIP TCP/IP stack are running and properly configured.


Using Open62541 on the ESP32 microprocessor from Espressif is quite simple and requires little input from the programmer. ESP32 is a Chinese SoC (System on Chip) with great capabilities. Its low price, good performance, and huge popularity in the IoT world make it a great candidate for the role of a hobbyist OPC UA server. We can choose any microprocessor; however, we should pay attention to a large amount of RAM and FLASH memory needed. Instructions for preparing the Open62541 library to work with microcontrollers are available in the project documentation [2]. In brief, it looks as follows:

These few commands will allow us to download, unpack and prepare the environment for compilation. The library configuration is simple and can be edited using the command:

All parameters are described in detail in the documentation. For ESP32 using ESP-IDF framework, it is necessary to select the following:

We can freely edit the rest of the options as needed. We start the compilation with the command:

The compilation will fail, but this is not a problem at all. For us, the most important are the two files generated before compilation:

  • open62541.c
  • open62541.h

These are the files where the entire implementation of the server is located. Now we can create a new project for ESP32 and copy the received library files there. Following the documentation [3], we can make a simple server and compile the project.

Depending on the processor used and the version of the environment or library, we may encounter minor compilation or linking problems. However, those with a basic knowledge of C programming should be able to deal with them quickly. As soon as the program is uploaded to the microprocessor’s memory, the OPC UA server should be available at the device address on the default port, 4840.


As a result of 30 minutes of work, we got a simple and inexpensive replacement for expensive and highly sophisticated industrial servers. Of course, such a solution will only work in some applications, but it can be an appealing and highly cost-effective alternative for small systems. Especially since, thanks to the OPC UA interface, we have here the same possibilities of integration with SCADA systems as commercial solutions based on servers running on IPC in x86 architecture. Moreover, using microcontrollers will significantly reduce power consumption and can multiply the reliability of such systems. For this reason, this will become a widely used innovation in the near future.

Check out our clients’ case stories!


  1. open62541
  2. Building open62541 — open62541 1.3.0-dirty documentation
  3. Building a Simple Server — open62541 1.3.0-dirty documentation
  4. Introduction — open62541 1.3.0-dirty documentation
  5. GitHub — open62541/open62541: Open source implementation of OPC UA (OPC Unified Architecture) aka IEC 62541 licensed under Mozilla Public License v2.0
  6. Unified Architecture — OPC Foundation

Read more on the Knowledge hub

5 min read

Krzysztof Kaczor

Few Thoughts on IIoT Security

Krzysztof Kaczor

5 min read

Klaudia Kożusznik

Still biotech or already techbio?

Klaudia Kożusznik

5 min read

Karolina Marzantowicz

Getting Ready for Quantum Computing — basics edition

Karolina Marzantowicz