🔌 Custom Serial (7E)
- Speed: 9600 baud
- Distance: Up to 1200m
- Pros: Simple, fixed length messages with checksum
- Cons:Not a standard protocol, weak error checking
- Use case: EPM control, firmware updates, legacy data collection
- Note: Legacy protocol, being gradually replaced by Modbus
📊 Modbus RTU
- Speed: 9600-115200 baud typical
- Distance: Up to 1200m (RS485)
- Pros: Robust, widely supported
- Cons: Limited data types
- Use case: Industrial sensors, PLCs
🚗 CAN Bus
- Speed: Up to 1 Mbps
- Distance: Up to 1000m (at lower speeds)
- Pros: Very robust, real-time capable
- Cons: Limited message size
- Use case: Automotive, industrial automation
🌐 Modbus TCP
- Speed: 10/100/1000 Mbps
- Distance: 100m per segment
- Pros: Network-ready, uses standard Ethernet infrastructure
- Cons: More complex than RTU, inherits TCP/IP overhead
- Use case: Factory automation, SCADA
- Note: Adds industrial protocol layer on top of TCP/IP specifically for control systems
🔗 Ethernet TCP/IP
- Speed: 10/100/1000 Mbps+
- Distance: 100m per segment
- Pros: Universal, high bandwidth, flexible
- Cons: Not deterministic (timing can vary)
- Use case: General networking, IT infrastructure
- Note: General-purpose network protocol for any data type
🌍 REST API
- Speed: Network dependent
- Distance: Global (internet)
- Pros: Standard, widely supported
- Cons: Higher latency
- Use case: Web services, cloud integration
📡 MQTT
- Speed: Network dependent
- Distance: Global (internet)
- Pros: Lightweight, pub/sub model
- Cons: Requires broker
- Use case: IoT, real-time monitoring
🔄 Protocol Comparison: Modbus TCP vs RTU
Protocol Architecture
Modbus TCP
Modbus Application Layer
TCP/IP
Ethernet
Modbus RTU
Modbus Application Layer
RTU Framing
RS485/RS232
Communication Patterns
Modbus TCP: Simultaneous Communication
Client 1
HMI
Client 2
SCADA
Device 1
PLC
Device 2
Sensor
All devices communicate over shared network cable
Modbus RTU: Sequential Communication
Master
Controller
Slave 1
Active
Slave 2
Waiting
Master must wait for response before next request
Frame Structure Comparison
Protocol Encapsulation
Ethernet Frame
Preamble
8 bytes
MAC Dest
6 bytes
MAC Src
6 bytes
Type
2 bytes
Payload (IP Packet)
46-1500 bytes
CRC
4 bytes
IP Packet
IP Header
20 bytes
Payload (TCP Segment)
Variable
TCP Segment
TCP Header
20 bytes
Payload (Modbus TCP)
Variable
Key Points
- •Ethernet frame provides physical addressing (MAC) and error checking
- •IP handles routing between networks using IP addresses
- •TCP ensures reliable delivery and handles port numbers
- •Modbus TCP adds industrial protocol functionality on top
TCP Header Details
- • Source Port (16 bits)
- • Destination Port (16 bits)
- • Sequence Number (32 bits)
- • Acknowledgment Number (32 bits)
- • Control Flags (16 bits)
IP Header Details
- • Source IP Address (32 bits)
- • Destination IP Address (32 bits)
- • Protocol (8 bits)
- • Time to Live (8 bits)
- • Header Checksum (16 bits)
Modbus TCP Frame Structure
Transaction ID
0x0001
2 bytes
Protocol ID
0x0000
2 bytes
Length
0x0006
2 bytes
Unit ID
0x01
1 byte
Function
0x03
1 byte
Address
0x0000
2 bytes
Quantity
0x000A
2 bytes
TCP frame includes additional headers for network routing and connection handling
Modbus RTU Frame Structure
Slave ID
0x01
1 byte
Function
0x03
1 byte
Address
0x0000
2 bytes
Quantity
0x000A
2 bytes
CRC
0xC40B
2 bytes
RTU frame requires 3.5-character time gap between frames for timing-based detection
Technical Comparison
| Feature | Modbus TCP | Modbus RTU |
|---|---|---|
| Transport Layer | Ethernet (TCP/IP) | Serial (RS485, RS232) |
| Speed | 10/100/1000 Mbps | Up to 115.2 kbps |
| Addressing | IP addresses (unlimited) | Slave IDs (0-247) |
| Cable Length | 100m per segment | Up to 1200m |
| Reliability | TCP error checking | CRC error checking |
| Integration | Standard network infrastructure | Specialized serial hardware |
When to Use Modbus TCP
- •Modern, scalable systems
- •Multiple device communication
- •Integration with IT systems
- •High-speed data requirements
When to Use Modbus RTU
- •Legacy system integration
- •Cost-sensitive applications
- •Long cable runs (up to 1200m)
- •Simple point-to-point communication
Summary
Modbus TCP represents a significant advancement over RTU for modern industrial applications, offering superior scalability, simultaneous communication capabilities, and seamless integration with existing network infrastructure. While Modbus RTU remains relevant for specific use cases, TCP's ability to handle concurrent communications and its built-in reliability features make it the preferred choice for new installations and system upgrades.
Modern Protocol Comparison: MQTT vs REST API
MQTT: Publish-Subscribe Pattern
MQTT Broker
Publisher
Sensor
Publisher
Device
Subscriber
Dashboard
Subscriber
Logger
Asynchronous, many-to-many communication
REST API: Request-Response Pattern
Client
Web App
Client
Mobile App
REST Server
Synchronous, request-response communication
| Feature | MQTT | REST API |
|---|---|---|
| Communication Style | Publish-Subscribe | Request-Response |
| Connection | Persistent | Stateless |
| Message Size | Small, optimized | Larger, more verbose |
| Use Case | IoT, real-time data | Web services, CRUD |
| Data Format | Binary or any format | JSON, XML |
| QoS Levels | Built-in (0,1,2) | Not built-in |
MQTT Protocol Stack
MQTT
TCP
IP
Ethernet
REST API Protocol Stack
HTTP
TCP
IP
Ethernet
Key Takeaways
- •Both protocols run on TCP/IP but serve different purposes
- •MQTT is optimized for IoT and real-time data streaming
- •REST API is ideal for traditional web services and CRUD operations
- •Choice depends on use case: real-time data vs web services
💡 Choosing the Right Protocol
When selecting a protocol, consider these key factors:
- What physical connection is available?
- Distance requirements: Physical range needed
- Speed requirements: Data throughput and latency
- Environmental conditions: Noise immunity, reliability
- Cost considerations: Hardware and implementation
- Integration needs: Compatibility with existing systems