Protocols & Connections
TwinEdge Edge supports a wide range of industrial communication protocols to connect with your equipment.
Supported Protocols
| Protocol | Type | Common Use Cases |
|---|---|---|
| OPC UA | Client/Server | PLCs, SCADA, modern equipment |
| Modbus TCP | Client | PLCs, sensors, actuators |
| Modbus RTU | Serial | Legacy sensors, meters |
| MQTT | Pub/Sub | IoT sensors, custom devices |
| EtherNet/IP | Client | Allen-Bradley, Rockwell |
| S7 | Client | Siemens PLCs |
| BACnet | Client | Building 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
- Go to Data Sources → Add Data Source
- Select OPC UA
- 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:
- Click Browse Tags
- Navigate the namespace tree
- Expand Objects → Your Device → Variables
- Check tags to monitor
- 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
- Go to Data Sources → Add Data Source
- Select Modbus TCP
- Enter details:
- Name: Device name
- Host:
192.168.1.50 - Port:
502(default) - Unit ID:
1(slave address)
Register Types
| Type | Function Code | Address Range | Data Type |
|---|---|---|---|
| Coils | 01, 05, 15 | 00001-09999 | Boolean |
| Discrete Inputs | 02 | 10001-19999 | Boolean |
| Input Registers | 04 | 30001-39999 | 16-bit |
| Holding Registers | 03, 06, 16 | 40001-49999 | 16-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
| Type | Registers | Example |
|---|---|---|
int16 | 1 | -32768 to 32767 |
uint16 | 1 | 0 to 65535 |
int32 | 2 | Signed 32-bit |
uint32 | 2 | Unsigned 32-bit |
float32 | 2 | IEEE 754 float |
float64 | 4 | IEEE 754 double |
string | N | ASCII 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:
- USB to RS-485 converter
- Connect A+/B- terminals
- 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
- Go to Data Sources → Add Data Source
- Select MQTT
- Enter broker details:
- Host:
mqtt.company.com - Port:
1883(or8883for TLS) - Username: Optional
- Password: Optional
- Host:
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
- Use encrypted connections (OPC UA SignAndEncrypt, MQTTS)
- Use strong authentication
- Isolate industrial networks
- Keep firmware updated
Performance
- Set appropriate polling intervals
- Use subscriptions for OPC UA
- Batch Modbus reads when possible
- Monitor network bandwidth
Reliability
- Configure automatic reconnection
- Set up connection alerts
- Use redundant network paths
- Test failover scenarios
Next Steps
- Local Dashboard - View data on the edge device
- OTA Updates - Keep protocol adapters updated
- Troubleshooting - Diagnose connection issues