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”)
- Energy Meter Terminals: Locate the A/B terminals (usually marked 3 and 8)
- PLC Terminals: Connect pin 3 of the DB9 interface to A, and pin 8 to B
- 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)
- Enter Setup Mode: Long press the “SET” button on the energy meter for 3 seconds
- Set Address: Change the default address from 1 to 11 (to avoid conflicts)
- Communication Parameters: • Baud Rate: 9600 • Data Bits: 8 • Parity: None • Stop Bits: 1
4. PLC Parameter Configuration (Software Operation)
- Open STEP 7-Micro/WIN SMART
- System Block → Communication Port 0: • Baud Rate: 9600 • Data Format: 8 No Parity 1 Stop Bit
- 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)
- Serial Port Assistant: View raw messages (e.g., 01 03 00 00 00 01 84 0A)
- Data Block Monitoring: Check if voltage values appear in VB300-VB303
- 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
- Daisy Chain Connection: Use RS485 repeaters to expand to 32 devices
- Master-Slave Architecture: One PLC controls 16 energy meters
- 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
- Physical Layer: Connect the right wires (A to 3, B to 8)
- Protocol Layer: Set the right parameters (9600/8N1)
- Application Layer: Read the correct address (40001+1)
Practical Suggestions:
- Debug a single energy meter successfully before expanding
- Back up important data to a USB drive daily
- Use color coding to mark communication cables for different functions
- 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!