ISO-MBUS IO Card Configuration
The ISO-MBUS adapter board uses the serial lines on pins 32/33
The following line needs to be added to /boot/config.txt to enable UART0 to appear on the correct pins for the adapter card :
dtoverlay=mypi-uart0,txd1_pin=32,rxd1_pin=33
This enables /dev/ttyAMA0
Next we need to download and compile the latest version of the mbus utils from the git repo below, this contains demo programs for reading serial and TCP based devices :
https://github.com/rscada/libmbus/
wget https://github.com/rscada/libmbus/archive/master.zip
If not aready installed the following packages should be installed before continuing:
apt-get install build-essential libtool autoconf m4
After unzipping the source code follow the installation instructions by running the commands below:
# ./build.sh # make install
You may also need to make a symlink for the libmbus library (see below) to allow the installed binaries to run, run the below if you get an error when running the application programs.
ln -s /usr/local/lib/libmbus.so.0 /lib/libmbus.so.0
MBus serial requires the master (us) to provide the line voltage, you can either supply this from an external source and link into to the card or use the internal 34V PSU. To use the internal PSU make the 34V OUT to 34V IN link on the IO connector.
The card/PSU should be adequate to drive 1-3 slaves without problem.
Note that the mbus serial utils do not have an option to deal with parity, so ensure the comms settings within the meter being used have the parity option set to "None" or "N" or you'll get no reply or errors from the bus.
The baud rate for the mbus util commands can be specified via the -b option, see the man pages for more info, the default is 9600.
Here's a sample interaction with a Sensonic II MBUS meter :
login as: root root@192.168.1.143's password: The programs included with the Debian GNU/Linux system are free software; the exact distribution terms for each program are described in the individual files in /usr/share/doc/*/copyright. Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent permitted by applicable law. Last login: Fri May 25 16:40:52 2018 from user-hp.fritz.box SSH is enabled and the default password for the 'pi' user has not been changed. This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password. root@raspberrypi:~# mbus-serial-scan -b 2400 /dev/ttyAMA0 Found a M-Bus device at address 0 ^C root@raspberrypi:~# mbus-serial-request-data -b 2400 /dev/ttyAMA0 0 <?xml version="1.0" encoding="ISO-8859-1"?> <MBusData> <SlaveInformation> <Id>90870044</Id> <Manufacturer>RKE</Manufacturer> <Version>106</Version> <ProductName></ProductName> <Medium>Heat: Outlet</Medium> <AccessNumber>174</AccessNumber> <Status>02</Status> <Signature>0000</Signature> </SlaveInformation> <DataRecord id="0"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Fabrication number</Unit> <Value>90870044</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="1"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Time Point (time & date)</Unit> <Value>2014-09-18T10:55:00</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="2"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Volume (m m^3)</Unit> <Value>18304601</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="3"> <Function>Instantaneous value</Function> <StorageNumber>1</StorageNumber> <Unit>Volume (m m^3)</Unit> <Value>18304601</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="4"> <Function>Instantaneous value</Function> <StorageNumber>2</StorageNumber> <Tariff>0</Tariff> <Device>0</Device> <Unit>Volume (m m^3)</Unit> <Value>18304601</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="5"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Tariff>1</Tariff> <Device>0</Device> <Unit>Volume (m m^3)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="6"> <Function>Instantaneous value</Function> <StorageNumber>1</StorageNumber> <Tariff>1</Tariff> <Device>0</Device> <Unit>Volume (m m^3)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="7"> <Function>Instantaneous value</Function> <StorageNumber>2</StorageNumber> <Tariff>1</Tariff> <Device>0</Device> <Unit>Volume (m m^3)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="8"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Energy (100 Wh)</Unit> <Value>3620709</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="9"> <Function>Instantaneous value</Function> <StorageNumber>1</StorageNumber> <Unit>Energy (100 Wh)</Unit> <Value>3620709</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="10"> <Function>Instantaneous value</Function> <StorageNumber>2</StorageNumber> <Tariff>0</Tariff> <Device>0</Device> <Unit>Energy (100 Wh)</Unit> <Value>3620709</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="11"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Tariff>1</Tariff> <Device>0</Device> <Unit>Energy (100 Wh)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="12"> <Function>Instantaneous value</Function> <StorageNumber>1</StorageNumber> <Tariff>1</Tariff> <Device>0</Device> <Unit>Energy (100 Wh)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="13"> <Function>Instantaneous value</Function> <StorageNumber>2</StorageNumber> <Tariff>1</Tariff> <Device>0</Device> <Unit>Energy (100 Wh)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="14"> <Function>Instantaneous value</Function> <StorageNumber>1</StorageNumber> <Unit>Time Point (date)</Unit> <Value>2014-09-18</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="15"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Time Point (date)</Unit> <Value>2018-11-30</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="16"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Volume flow (m m^3/h)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="17"> <Function>Maximum value</Function> <StorageNumber>0</StorageNumber> <Unit>Volume flow (m m^3/h)</Unit> <Value>1880</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="18"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Power (W)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="19"> <Function>Maximum value</Function> <StorageNumber>0</StorageNumber> <Unit>Power (W)</Unit> <Value>42842</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="20"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Flow temperature (deg C)</Unit> <Value>61</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="21"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Return temperature (deg C)</Unit> <Value>41</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="22"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Temperature Difference (m deg C)</Unit> <Value>20576</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="23"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>On time (hours)</Unit> <Value>0</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="24"> <Function>Instantaneous value</Function> <StorageNumber>1</StorageNumber> <Unit>On time (days)</Unit> <Value>2691</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="25"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>On time (days)</Unit> <Value>3382</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="26"> <Function>Instantaneous value</Function> <StorageNumber>5</StorageNumber> <Tariff>0</Tariff> <Device>0</Device> <Unit>Time Point (date)</Unit> <Value>2009-02-19</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="27"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Error flags</Unit> <Value>8</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="28"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Volume (my m^3)</Unit> <Value>1000</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> <DataRecord id="29"> <Function>Instantaneous value</Function> <StorageNumber>0</StorageNumber> <Unit>Reserved VIF extension</Unit> <Value>90</Value> <Timestamp>2018-05-25T16:47:38Z</Timestamp> </DataRecord> </MBusData>