In-Depth Explanation of Modbus Communication: A Case Study of S7-200 SMART and Energy Meter Integration

Introduction: The “Telephone System” of Industrial Energy Meters

Imagine hundreds of energy meters in a factory like silent soldiers, and you have no way of knowing their real-time data—this information black hole is something every engineer has experienced. Today, we will reveal in simple terms how to build an “industrial telephone system” using the S7-200 SMART PLC, allowing energy meter data to flow to your computer, understandable and operable even by a middle school student.

1. Hardware Preparation: Setting Up the “Communication Line”

1. Essential Equipment List (A Must-Read for Beginners)

PLC: S7-200 SMART SR20 (with RS485 port) • Energy Meter: Chint DDSU666 (with Modbus protocol) • Communication Cable: Shielded twisted pair (wire diameter ≥ 0.5mm²) • Converter: USB to RS485 (for connecting the PLC to the computer)

2. Wiring Practice (Guide to Prevent “Disconnection”)

  1. Energy Meter Terminals: Locate the A/B terminals (usually marked 3 and 8)
  2. PLC Terminals: Connect pin 3 of the DB9 interface to A, and pin 8 to B
  3. Key Action: Ground the shield of the communication cable at a single point (connect to the PLC casing)

2. Parameter Settings: Giving Devices the “Secret Code”

3. Energy Meter Parameter Configuration (Three Steps)

  1. Enter Setup Mode: Long press the “SET” button on the energy meter for 3 seconds
  2. Set Address: Change the default address from 1 to 11 (to avoid conflicts)
  3. Communication Parameters: • Baud Rate: 9600 • Data Bits: 8 • Parity: None • Stop Bits: 1

4. PLC Parameter Configuration (Software Operation)

  1. Open STEP 7-Micro/WIN SMART
  2. System Block → Communication Port 0: • Baud Rate: 9600 • Data Format: 8 No Parity 1 Stop Bit
  3. Load Modbus library instructions (memory allocation starts at VB286)

3. PLC Programming: Building the “Data Pipeline”

5. Core Instruction Configuration (Step-by-Step Teaching)

Step 1: Initialize the Master Station

// Master station initialization program
MBUS_CTRL  // Call master station instruction
EN   : SM0.1  // Power-on initialization
MODE : 1      // Master station mode
BAUD : 9600   // Baud rate
PORT : 0      // Use port 0
DONE : M0.0   // Completion flag
ERROR: M0.1   // Error code

Step 2: Read Energy Meter Data

// Voltage reading program
MBUS_MSG  // Call read instruction
EN   : M0.0   // Trigger after initialization is complete
SLAVE: 11     // Energy meter address
ADDR : 40001  // Voltage register address
COUNT: 1      // Read 1 data
DATA : &VB300 // Store in VB300 starting
DONE : M0.2   // Completion flag
ERROR: M0.3   // Error code

Step 3: Poll Multiple Energy Meters (Advanced Technique)

// Polling control program
LD M0.2       // Last read completed
MOV 11, 12    // Switch energy meter address
MOVB 12, VD100// Store new address
SET M0.0      // Trigger next read

4. Debugging Practice: Getting Data to “Run”

6. Monitoring and Verification (Three Essentials)

  1. Serial Port Assistant: View raw messages (e.g., 01 03 00 00 00 01 84 0A)
  2. Data Block Monitoring: Check if voltage values appear in VB300-VB303
  3. Forced Testing: Manually modify VB300 values to simulate energy meter anomalies

7. Common Problem Solutions (First Aid Kit)

Phenomenon Solution
No Data Returned Check if the address is +1 (40001→40002)
Data Garbled Confirm baud rate matches the energy meter
Communication Interruption Check if the shielded wire is grounded at a single point

5. Advanced Applications: From Standalone to Network

8. Multi-Device Networking Solutions

  1. Daisy Chain Connection: Use RS485 repeaters to expand to 32 devices
  2. Master-Slave Architecture: One PLC controls 16 energy meters
  3. Cloud Integration: Upload to cloud platform via OPC UA

9. Data Processing Techniques

Floating Point Conversion: Combine VD300+VD302 to form a complete value • Energy Accumulation: Use TON timer to calculate hourly electricity consumption • Alarm Settings: Trigger audible and visual alarms when voltage > 250V

Conclusion: Mastering Modbus in Three Steps

  1. Physical Layer: Connect the right wires (A to 3, B to 8)
  2. Protocol Layer: Set the right parameters (9600/8N1)
  3. Application Layer: Read the correct address (40001+1)

Practical Suggestions:

  1. Debug a single energy meter successfully before expanding
  2. Back up important data to a USB drive daily
  3. Use color coding to mark communication cables for different functions
  4. Regularly use a multimeter to check line continuity

From today, you too can make the silent energy meters speak. Remember: Modbus is not magic, but the universal language of industrial communication. Connect the first wire correctly, and you are now a communication engineer for smart factories!

Leave a Comment