Industrial M2M protocols – OPC UA
In this section, we will try to build a simple IoT app for sending data from a sensor simulator module to a receiver device (a PC or a cloud), using a Raspberry Pi hub and the OPC UA protocol:
The OPC UA protocol is similar to Modbus, but works with more data types, and has no serious limitations, while providing for security, compression, and low latency.
The protocol was developed by the OPC Foundation as an industrial machine-to-machine communication protocol. OPC UA is an improved version of the Open Platform Communications (OPC) protocol, with one of the major changes being that the new protocol is available free of charge without any restrictions.
In the following table, you can find a more detailed description of the protocol to understand whether it is suitable for your needs:
Key Value
Open source Yes
The OSI layer Transport or application
Data types Integer, float, string, Boolean, date, time, and so on
Limitations Not suitable for a complex architecture
Possible operations Read/write/monitor/query variables
Latency Low
Usage IIoT
Security Yes
Compression Yes
For building the application, we will need the following:
- Required software:
- Node.js 6+ (https://nodejs.org/en/download/)
- PostgreSQL (https://www.postgresql.org/download/)
- The Cloud Foundry CLI (https://github.com/cloudfoundry/cli#downloads)
- Request (https://www.npmjs.com/package/request)
- NodeOPCUA (https://www.npmjs.com/package/node-opcua)
- Async (https://www.npmjs.com/package/async)
- Docker (https://docs.docker.com/engine/installation/)
- Required hardware:
- Raspberry Pi 3 (model B)
- A power adapter (2A/5V)
- A microSD card (8 GB+) and an SD adapter
- Ethernet cable for a wired network connection