WAGO 750-893 as KNX/Modbus Gateway: Energy Sub-Metering Setup
The WAGO 750-893 PFC100 controller (Linux-based, CODESYS 3.5) is the most versatile gateway for bridging Modbus TCP energy meters to KNX TP in European commercial panels. Unlike dedicated KNX/Modbus gateways (Weinzierl ENO 634, Intesis KNX-MBS), the WAGO PFC100 runs a full IEC 61131-3 CODESYS program — enabling custom logic: demand response, load shedding, alert thresholds, and multi-meter aggregation — all without an external PLC. The 750-893 mounts on DIN-rail (36mm wide), powered from 24V DC panel supply, and connects to KNX TP via integrated KNX TP bus coupler on the main controller board.
Hardware architecture
WAGO 750-893 base controller includes: 24V DC power input, Ethernet (RJ45, 10/100Mbit), 2× serial RS-232/RS-485 (750-653 expansion module for Modbus RTU), USB host for CODESYS program upload, integrated KNX TP bus coupler (750-800 compatible). For Modbus TCP (IP-based meters like Carlo Gavazzi EM340 with Ethernet module): use the Ethernet port directly — no extra module needed. For Modbus RTU (RS-485 meters like Eastron SDM630): add 750-653 RS-485 module in the I/O expansion rack. Standard KNX panel deployment: 750-893 + 750-653 (RS-485) + 750-600 (end module) = 54mm total DIN-rail width.
CODESYS project structure
Create CODESYS project via WAGO e!COCKPIT (free download, Windows). Project tree: Application → PLC_PRG (main cycle, 100ms task) → ModbusHandler (reads all meter registers) → KNXPublisher (writes to KNX group addresses). Standard function block approach: use WAGO FB_ModbusTCP_Master for TCP meters or FB_ModbusRTU_Master for serial. Each meter instantiated separately: fbMeter1: FB_ModbusTCP_Master (IP := '192.168.1.10', Port := 502, UnitID := 1). Call fbMeter1 in ModbusHandler task with 10s polling interval.
Carlo Gavazzi EM340 register map in CODESYS
EM340 Modbus TCP register map: 40001 (Phase 1 voltage, V × 10, uint32 LE), 40007 (Phase 1 current, A × 1000, uint32 LE), 40013 (Active power all phases, W × 10, int32 LE), 40101 (Total active energy kWh, kWh × 10, uint32 LE). CODESYS read: fbMeter1.aRegisters[0] := 40001-1 = 0; length := 2 (32-bit = 2 registers). After read: rVoltageL1 := UINT_TO_REAL(WORD_TO_UINT(SWAP(fbMeter1.aData[0]))) / 10.0; rPowerTotal := INT_TO_REAL(SHL(INT(fbMeter1.aData[0]),16) OR INT(fbMeter1.aData[1])) / 10.0; (signed 32-bit, big-endian). Important: EM340 uses big-endian word order — verify with EM340 manual page 24. rEnergyTotal := DWORD_TO_REAL(SHL(DWORD(fbMeter1.aData[0]),16) OR DWORD(fbMeter1.aData[1])) / 10.0; (kWh, running total).
KNX group address writing from CODESYS
WAGO 750-893 KNX bus coupler exposes KNX group addresses as CODESYS variables via WAGO KNX Library (included in e!COCKPIT). Configuration: add KNX TP bus coupler device in CODESYS hardware tree → configure physical address (e.g. 1.2.5) → add group addresses as I/O variables: GA_Power: REAL := [5/3/0, DPT 9.002]; GA_Energy: REAL := [5/3/1, DPT 14.019]; GA_Voltage: REAL := [5/3/2, DPT 9.020]. In PLC_PRG: GA_Power := rPowerTotal / 1000.0; (convert W to kW for DPT 9.002). GA_Energy := rEnergyTotal; (kWh, DPT 14.019 = energy in kWh). Transmission trigger: write to KNX only when value changes by > 0.1 kW or every 60 seconds — prevents KNX bus flooding.
Multi-meter aggregation
For buildings with 4-8 circuits (apartments, offices): instantiate fbMeter1..fbMeter8, read in sequence (50ms per poll). Aggregate: rTotalPower := fbMeter1.rPower + fbMeter2.rPower + ... + fbMeter8.rPower; Write to KNX GA 5/3/10 (building total power). Individual circuit powers: GA 5/3/1..8. Demand alert: IF rTotalPower > 25000.0 THEN GA_OverloadAlert := TRUE; — triggers KNX binary output to alarm annunciator and email via HA webhook.
Energy tariff optimisation logic
CODESYS time-of-use scheduling: use WAGO RTC (real-time clock in PFC100). IF (TOD() >= TIME_OF_DAY#07:00:00) AND (TOD() < TIME_OF_DAY#11:00:00) THEN bPeakTariff := TRUE; — during peak: set GA_PeakActive := TRUE → KNX logic block shifts EV charger and heat pump to off-peak mode. Monthly energy totals: save REAL energy register to WAGO retain memory (RETAIN VAR rMonthlyEnergy: REAL;) — persists through power cycles. First day of month: write previous month total to KNX GA 5/4/0 for BMS monthly report.
Need help with your KNX or DALI project?
Our certified engineers can discuss panel design, commissioning, integrations and project-specific edge cases. Free initial consultation.
Contact our engineers →