Skip to main content
Version: 1.0.0

Protocols & Connections

TwinEdge Edge supports a wide range of industrial communication protocols to connect with your equipment.

Supported Protocols

ProtocolTypeCommon Use Cases
OPC UAClient/ServerPLCs, SCADA, modern equipment
Modbus TCPClientPLCs, sensors, actuators
Modbus RTUSerialLegacy sensors, meters
MQTTPub/SubIoT sensors, custom devices
EtherNet/IPClientAllen-Bradley, Rockwell
S7ClientSiemens PLCs
BACnetClientBuilding automation

OPC UA

Overview

OPC UA (Unified Architecture) is the modern standard for industrial interoperability, providing secure, reliable data exchange.

Connecting to OPC UA Server

  1. Go to Data SourcesAdd Data Source
  2. Select OPC UA
  3. Enter connection details:
    • Name: Descriptive name
    • Endpoint URL: opc.tcp://192.168.1.100:4840
    • Security Mode: None, Sign, SignAndEncrypt
    • Security Policy: Basic256Sha256 (recommended)

Authentication

Anonymous:

endpoint: opc.tcp://server:4840
security_mode: None

Username/Password:

endpoint: opc.tcp://server:4840
security_mode: SignAndEncrypt
security_policy: Basic256Sha256
username: operator
password: ********

Certificate:

endpoint: opc.tcp://server:4840
security_mode: SignAndEncrypt
security_policy: Basic256Sha256
certificate_path: /certs/client.pem
private_key_path: /certs/client.key

Browsing Tags

After connecting:

  1. Click Browse Tags
  2. Navigate the namespace tree
  3. Expand Objects → Your Device → Variables
  4. Check tags to monitor
  5. Click Add Selected

Tag Configuration

For each tag, configure:

  • Polling Interval: How often to read (100ms - 1h)
  • Deadband: Minimum change to report (absolute or %)
  • Alias: Friendly name for dashboards

Subscriptions

For real-time data, use OPC UA subscriptions:

subscription:
publishing_interval_ms: 1000
lifetime_count: 10000
max_keep_alive_count: 10
max_notifications_per_publish: 1000

Modbus TCP

Overview

Modbus TCP is widely supported by industrial equipment for register-based communication.

Connection Setup

  1. Go to Data SourcesAdd Data Source
  2. Select Modbus TCP
  3. Enter details:
    • Name: Device name
    • Host: 192.168.1.50
    • Port: 502 (default)
    • Unit ID: 1 (slave address)

Register Types

TypeFunction CodeAddress RangeData Type
Coils01, 05, 1500001-09999Boolean
Discrete Inputs0210001-19999Boolean
Input Registers0430001-3999916-bit
Holding Registers03, 06, 1640001-4999916-bit

Configuring Registers

Add registers to monitor:

registers:
- name: temperature
address: 40001
type: holding
data_type: float32
byte_order: big_endian
scale: 0.1
unit: "°C"

- name: pressure
address: 40003
type: holding
data_type: uint16
scale: 0.01
unit: "bar"

Data Types

TypeRegistersExample
int161-32768 to 32767
uint1610 to 65535
int322Signed 32-bit
uint322Unsigned 32-bit
float322IEEE 754 float
float644IEEE 754 double
stringNASCII string

Byte Order

Configure based on device manufacturer:

  • big_endian: Most significant byte first (AB CD)
  • little_endian: Least significant byte first (CD AB)
  • big_endian_swap: Word swap (CD AB)
  • little_endian_swap: Word swap (AB CD)

Modbus RTU (Serial)

Hardware Setup

Connect via RS-485 adapter:

  1. USB to RS-485 converter
  2. Connect A+/B- terminals
  3. Configure termination if needed

Connection Settings

serial:
port: /dev/ttyUSB0
baudrate: 9600
parity: none
stopbits: 1
bytesize: 8
timeout_seconds: 1

Multi-Drop Setup

Connect multiple devices on same bus:

devices:
- name: meter_1
unit_id: 1
registers: [...]

- name: meter_2
unit_id: 2
registers: [...]

MQTT

Connecting to MQTT Broker

  1. Go to Data SourcesAdd Data Source
  2. Select MQTT
  3. Enter broker details:
    • Host: mqtt.company.com
    • Port: 1883 (or 8883 for TLS)
    • Username: Optional
    • Password: Optional

Topic Subscriptions

Subscribe to topics:

subscriptions:
- topic: factory/line1/+/temperature
qos: 1

- topic: sensors/#
qos: 0

Payload Parsing

JSON:

{"temperature": 25.5, "humidity": 60.2, "timestamp": "2026-01-06T10:00:00Z"}
payload_format: json
mappings:
- json_path: $.temperature
tag_name: temperature
- json_path: $.humidity
tag_name: humidity

Raw Value:

payload_format: raw
data_type: float

EtherNet/IP

Connection Setup

For Allen-Bradley and Rockwell controllers:

host: 192.168.1.100
slot: 0
timeout_ms: 5000

Tag Reading

tags:
- name: LocalTags:Temperature
alias: temp
poll_ms: 1000

- name: Program:MainProgram.Speed
alias: motor_speed
poll_ms: 500

S7 Protocol

Connection Setup

For Siemens S7-300/400/1200/1500:

host: 192.168.1.100
rack: 0
slot: 1
port: 102

Data Block Reading

data_blocks:
- db_number: 1
items:
- name: temperature
offset: 0
type: real

- name: status
offset: 4
type: int

Connection Health

Monitoring Connections

View connection status:

  • Connected: Active communication
  • Reconnecting: Attempting to restore
  • Disconnected: No communication
  • Error: Configuration or network issue

Automatic Reconnection

TwinEdge automatically handles:

  • Network interruptions
  • Device restarts
  • Temporary failures
reconnection:
enabled: true
initial_delay_ms: 1000
max_delay_ms: 60000
backoff_multiplier: 2

Connection Alerts

Configure alerts for connection issues:

alerts:
- condition: disconnected > 5 minutes
severity: critical
notification: email, slack

Troubleshooting

OPC UA Issues

Certificate rejected:

  • Export server's certificate
  • Add to trusted certificates folder
  • Or use security mode: None for testing

Connection timeout:

  • Verify endpoint URL
  • Check firewall settings
  • Confirm server is running

Modbus Issues

No response:

  • Verify IP address and port
  • Check unit ID matches device
  • Confirm device is powered on

Wrong values:

  • Check byte order settings
  • Verify register addresses
  • Confirm data type configuration

Network Issues

Intermittent connection:

  • Check network stability
  • Increase timeout values
  • Review switch/router configuration

Best Practices

Security

  1. Use encrypted connections (OPC UA SignAndEncrypt, MQTTS)
  2. Use strong authentication
  3. Isolate industrial networks
  4. Keep firmware updated

Performance

  1. Set appropriate polling intervals
  2. Use subscriptions for OPC UA
  3. Batch Modbus reads when possible
  4. Monitor network bandwidth

Reliability

  1. Configure automatic reconnection
  2. Set up connection alerts
  3. Use redundant network paths
  4. Test failover scenarios

Next Steps