M-Bus

M-Bus (Meter-Bus) is a European standard for the remote reading of gas or electricity meters.

Requirements

  • Hardware to connect the M-Bus to your controller
  • Library to interface to the M-bus protocol

Hardware

You needs some hardware to connect the M-Bus to your controller

  • USB to RS-232 connected to raspberry pi
  • RS-232 extender connected to the end of the RS-232 going out of the raspberry via usb
  • Other end of extender RS-232 peeled to just 3 cables, rx(blue), tx(white), gnd(yellow) going into the Mbus10 (Colors may change, it's not always in that order, beep with multimeter to be sure)
  • From Mbus10, 2 wires going into Multicam 602
  • Another device that has been confirmed to work instead of Mbus10 is "ADTweb Mbus Master to USB HD67024-B2-20"

Example interface hardware

  • USB to RS-232, link
  • RS232 extender, cut with rx, tx, gnd going out - other wires unnecessary, link
  • MBus10 RS-232/mbus converter, link
  • Kamstrup Multical 602, link
  • ADTweb Mbus Master to USB HD67024-B2-20, link

Libmbus

The role of libmbus is to decode/encode M-bus data, and to handle the communication with M-Bus devices, for more information see https://github.com/rscada/libmbus.

Installation:

$ sudo apt-get install libtool automake
$ wget https://github.com/rscada/libmbus/archive/0.8.0.zip
$ unzip 0.8.0.zip
$ cd libmbus-0.8.0
$ autoheader && aclocal && libtoolize --ltdl --copy --force && automake --add-missing --copy && autoconf
$ ./configure
$ make
$ sudo make install
$ sudo ln -s /usr/local/lib/libmbus.so.0 /usr/lib/libmbus.so.0

Test the connection

Scan for device:

 mbus-serial-scan /dev/ttyUSB0 (your usb number might be different) 

Bring out information:

$ mbus-serial-request-data /dev/ttyUSB0 <device number>

Sample output:

<MBusData>

    <SlaveInformation>
        <Id>69599538</Id>
        <Manufacturer>KAM</Manufacturer>
        <Version>15</Version>
        <ProductName></ProductName>
        <Medium>Heat: Outlet</Medium>
        <AccessNumber>2</AccessNumber>
        <Status>00</Status>
        <Signature>0000</Signature>
    </SlaveInformation>

    <DataRecord id="0">
        <Function>Instantaneous value</Function>
        <Unit>Fabrication number</Unit>
        <Value>69599538</Value>
        <Timestamp>2014-11-17T14:54:29</Timestamp>
    </DataRecord>

    <DataRecord id="1">
        <Function>Instantaneous value</Function>
        <Unit>Energy (10 kWh)</Unit>
        <Value>0</Value>
        <Timestamp>2014-11-17T14:54:29</Timestamp>
    </DataRecord>

...

    <DataRecord id="26">
        <Function>Instantaneous value</Function>
        <Unit>Time Point (date)</Unit>
        <Value>2000-00-00</Value>
        <Timestamp>2014-11-17T14:54:29</Timestamp>
    </DataRecord>

    <DataRecord id="27">
        <Function>Manufacturer specific</Function>
        <Value>00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 0E B0 A6 02 98 53 00 00 C3 FC 24 00 32 01 26 04 00 00 00 00 11 13 01 08 01 70 01 0C 00 00 00 00 00</Value>
        <Timestamp>2014-11-17T14:54:29</Timestamp>
    </DataRecord>

</MBusData>



Resources

    Updated by: ado464, Updated over 1 year ago
    Access count: 39384 since 2014-11-18

    Attached Files

    M-Bus.png (7.03 KB) danfos, 11/18/2014 12:32 PM

    Also available in: PDF HTML TXT