Carlo Gavazzi EM340 Energy Meter: Modbus Setup and KNX Integration
The Carlo Gavazzi EM340 is the most widely installed MID-certified 3-phase energy meter in European commercial and residential KNX panels. DIN-rail 4-module (72mm wide), direct connection up to 65A (or CT input for higher currents), and Modbus RTU (RS-485) as standard — with optional Modbus TCP Ethernet module (EM300-LAN). MID certification (Measuring Instruments Directive 2014/32/EU) makes it legally valid for tenant sub-metering and energy billing in EU countries. This guide covers Modbus register mapping, WAGO/Weinzierl gateway configuration, and KNX group address integration.
EM340 hardware variants
EM340-DIN AV5 3x230V+N (article EM340DINAV53XOSX): 3-phase 4-wire, 65A direct, RS-485 Modbus RTU, MID Class B, 4 DIN modules. For currents over 65A: EM340DINAV53XOSX1X with CT input (5A secondary, 0.5s accuracy class with class 0.5 CTs). For Modbus TCP: add EM300-LAN Ethernet module (DIN-rail, connects to EM340 expansion port, provides 10/100Mbit Ethernet on RJ45, port 502, up to 4 simultaneous Modbus TCP clients). For single-phase loads (lighting circuits, socket circuits): EM111-DIN AV5 1X (single-phase, 1 DIN module, Modbus RTU, MID B) — same Modbus register map structure.
Modbus RTU configuration on EM340
Front-panel pushbuttons set Modbus parameters: baud rate (1200, 2400, 4800, 9600, 19200, 38400), parity (None, Even, Odd), stop bits (1 or 2), slave address (1-247). Recommended: 9600 baud, No parity, 2 stop bits (matches WAGO 750-893 RS-485 defaults). RS-485 wiring: 120-ohm termination resistor at both ends of bus. Maximum 32 EM340 units on one RS-485 bus without repeater. Cable: Belden 3106A or equivalent (120-ohm impedance, twisted pair, screened). Maximum bus length at 9600 baud: 1200m. Wire screen to earth at one point only (meter panel earth bar) to prevent ground loop.
EM340 Modbus register map — key registers
All EM340 registers are 32-bit IEEE 754 floating-point, stored in 2 consecutive 16-bit holding registers, big-endian byte order. Function code 03 for read. Register addresses (Modbus protocol address, 0-based = register number - 1): 0x0000/0 = V L1 (Volts), 0x0002/2 = V L2, 0x0004/4 = V L3, 0x0006/6 = V average, 0x000C/12 = A L1 (Amps), 0x000E/14 = A L2, 0x0010/16 = A L3, 0x0012/18 = A neutral, 0x0028/40 = W L1 (active power), 0x002A/42 = W L2, 0x002C/44 = W L3, 0x0034/52 = W total, 0x003C/60 = var total (reactive power), 0x0046/70 = VA total (apparent power), 0x0048/72 = PF L1 (cos-phi), 0x004C/76 = PF average, 0x0052/82 = Hz (frequency). Energy registers: 0x0100/256 = kWh total import (32-bit float), 0x0102/258 = kWh total export (for PV grid-export metering), 0x0104/260 = kvarh import, 0x0108/264 = kVAh total.
WAGO 750-893 CODESYS integration
In CODESYS (WAGO e!COCKPIT): FB_ModbusRTU_Master instance for each EM340 on RS-485 bus. Example for EM340 slave address 3: fbEM340_3(eSlave := 3, eFunction := FC_READ_HOLDING_REGISTERS, iStartAddress := 16#0034, iLength := 2, bExecute := bReadNow); After read completes (fbEM340_3.bDone): rPowerTotalW := ModbusFloatBE_TO_REAL(fbEM340_3.aData[0], fbEM340_3.aData[1]); Helper function ModbusFloatBE_TO_REAL: converts 2 WORD values (big-endian) to REAL using WAGO standard library function. Write to KNX: GA_Power_Circuit3 := rPowerTotalW / 1000.0; (convert W to kW, DPT 9.002). Energy total: read registers 256-257 (kWh): GA_Energy_Circuit3 := ModbusFloatBE_TO_REAL(aData[0], aData[1]); (DPT 14.019, kWh).
Weinzierl ENO 634 gateway configuration
For projects without WAGO PLC: Weinzierl ENO 634 (DIN-rail, ETS6 plug-in, no CODESYS required). In ETS6 ENO 634 plug-in: add Modbus TCP connection → IP = EM340-LAN module IP, port 502. Add communication object: Name = Power_Total_kW, Start register = 52 (0x0034), Length = 2 registers, Data type = Float 32-bit BE, Scaling = ÷1000, DPT = 9.002 (2-byte float), KNX GA = 5/3/1. Polling interval: 60s (energy monitoring does not need real-time). For kWh energy total: register 256 (0x0100), length 2, float 32-bit BE, DPT = 14.019, no scaling. The ENO 634 automatically handles float conversion internally when Data type = Float 32-bit is selected.
KNX group address structure for metering
Recommended 3-level structure for 8-circuit metering panel: 5 (Energy) / 3 (Building Circuits) / 0 = Total building power (kW). 5/3/1..8 = Circuit 1-8 power (kW). 5/4/0 = Total building energy (kWh, cumulative). 5/4/1..8 = Circuit 1-8 energy (kWh). 5/5/0 = Building cos-phi. 5/5/1 = L1 voltage. 5/5/2 = L2 voltage. 5/5/3 = L3 voltage. 5/6/0 = Building reactive power (kvar). Visualisation: Gira X1 dashboard with time-trend graphs for power and energy. Alert: ETS6 comparator function block on 5/3/0 — if total power > 20kW for 5 minutes → send KNX telegram to flash alarm indicator (5/9/0) and trigger HA notification.
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 →