M-Bus – Heat meter – Kamstrup MULTICAL 402

Info

MULTICAL 402 can be read from the clear LED display or remotely using a variety of communication methods including, wired and wireless M-Bus, radio and pulse output. This allows for scalable network solutions from handheld to full AMR. This ensures safe reading for export to billing packages, less labour costs, low installation costs and reading at any time. The meter has a user-friendly interface, which has a helpful set/re-set function that can easily be adjusted using the two front keys allowing various settings to be changed. Data loggers ensure that valuable data is stored allowing analysis of energy consumption and evidence of any problems such as pressure loss and tamper detection. With meter sizes up to DN50, MULTICAL 402 answers most sub-metering requirements. The mix of high accuracy ultrasonic measuring technology, common AMR options, data logger and up to 16 years battery lifetime makes MULTICAL 402 a very price competitive energy meter suited for almost any residential application.

kamstrup-402-datasheet

Kamstrup MULTICAL 402 Technical Description


Uitlezen via Raspberry Pi (libmbus)

Hardware nodig: MBUS naar USB of RS232/TTL converter
Software nodig: libmbus

Boudrate: 2400
Adres: 68

Commando voor XML telegram:  mbus-serial-request-data -b 2400 /dev/ttyUSB0 68

Commands sent to the MBUS device need to be even parity 1 stop bit, the arduino hardware serial library supports this but the softserial arduino library does not. I tried various suggested modifications to the softserial library but couldnt get it to work so in the end settled on the temporary solution of sending the command string on the hardware serial tx line and receiving the reply on the softserial rx line. This at least kept most of the activity off the hardware serial port used to communicate with the computer.

Here’s an example of the print out from the arduino reader showing the part of the kamstrup heatmeter data frame that we where most interested in:

Energy (kWh): 10
Volume (m3): 2.72
Ontime (hours): 2423
Flow temperature: 18.36
Return temperature: 18.16
Temperature difference (K): 0.20
Power (W): 0
Max Power (W): 47
Volume flow (m3/h): 0
Max volume flow (m3/h): 1390

To decode the data frame its a matter of reading each byte in the frame and understanding from the data frame specification what each byte corresponds too. For example the first part of the header that specifies the frame type, data length and address is read like this:

start1 = bytes[0]
length1 = bytes[1]
length2 = bytes[2]
start2 = bytes[3]
control = bytes[4]
address = bytes[5]
control_information = bytes[6]

The first record starts at byte 25 and is 6 bytes long, the first 2 bytes corresponding to type and units and the last 4 bytes the value. Which can be decoded with, where i is the start byte of the record (i.e 25)

value = bytes[i+2] + (bytes[i+3]<<8) + (bytes[i+4]<<16) + (bytes[i+5]<<24)

It would be good to do some more reading up on the protocol in order to create a more generic less hardcoded arduino library for reading MBUS meters and sort the software serial library even parity bit issue but the above gives a working initial solution that can be built upon and integrated into the OpenEnergyMonitor system. Data could now be sent via RFM12/69 to an emonbase for logging in emoncms.

A small step-up converter can be used to provide the 34V required for the MBUS


Arduino Script to read-out:

Source: https://openenergymonitor.org/forum-archive/sites/default/files/kamstrup402_mbus_reader_rf12.html