ACRIOS M-Bus to NB-IoT converter

Describes how to configure the M-Bus to NB-IoT converter so its data can be parsed using IoT Creators portal

Company introduction

ACRIOS Systems provides an IoT product portfolio designed for remote energy data acquisition over the NB-IoT or LoRaWAN network. These products are ideally suited for organizations looking to optimize their energy usage and reduce costs through real-time monitoring and analysis of energy data.

Our LUA scripting interface allows customers to easily configure their devices to meet their specific needs. This interface allows for fast and flexible customization, enabling customers to fine-tune their device settings and optimize performance. This means they can easily adjust the device's logic and make changes without the need for additional hardware or software.

If you are looking for a powerful and user-friendly way to configure your devices, be sure to check out our LUA scripting interface embedded within our product portfolio.

M-Bus IoT converter introduction

The M-bus to NB-IoT bridge is a powerful solution that enables M-bus devices to connect to the NB-IoT network. This allows organizations to easily and cost-effectively integrate their M-bus systems into the Internet of Things (IoT).

The bridge is easy to install and requires no additional hardware or software. It simply plugs into the M-bus network and connects to the NB-IoT network through a standard SIM card.

Once connected, the M-bus to NB-IoT bridge can transmit data from M-bus devices enabling organizations to monitor and analyze their energy usage and optimize their operations. It can also receive commands from the cloud, allowing for remote control and configuration of M-bus devices.

Overall, the M-bus to NB-IoT bridge is an ideal solution for organizations looking to modernize their M-bus systems and take advantage of the IoT. It is reliable, cost-effective, and easy to use, making it the perfect choice for organizations looking to connect their M-bus systems to the cloud.

📘

Contact ACRIOS Systems directly

In case of any questions which are very specific to ACRIOS devices such as LUA scripting possibilities or downlink configuration, please contact ACRIOS directly at [email protected] or check the Wiki page.

Device configuration

When buying a converter as a sample from ACRIOS Systems you have to change the default configuration to the one compatible with IoT creators. For the specific project, the converter comes configured directly from the manufacturer to avoid any configuration time needed on the customer's side.

📘

Configuration

Please note that to configure the converter you have to use the configuration tool provided by ACRIOS here and you will need a configuration cable ACR-CONFIG.

To configure the converter, please upload the LUA script below by using the ACR-CONFIG configuration cable and the gui.acrios.com configuration software.

Alternatively, you can also pick the LUA script from gui.acrios.com by going to the "LUA FILES" -> "LUA Sample Repository" -> "ACR_CV_101N_M_X_nbiotMbus.lua"

Once the LUA script is open, connect the converter and click on "Write". This will upload the LUA script into the device.

❗️

Make sure that the NB-IoT configuration is:

APN = "auto"
PLMNID = "0"
ip = "172.27.131.100"
port = 15683
protocol = "UDP"

--[[
Application note link: https://wiki.acrios.com/en/app_notes#application-notes-for-the-m-bus-converter
]]--
---- CONFIGURATION ----
------- NB-IoT --------
APN = "auto"            -- "auto" is autodetection per SIM, use "nb.m2mc" for Miotiq 
PLMNID = "0"            -- 0 is autodetection per SIM, use 23003 for Vodafone CZ explicit settings
protocol = "UDP"	    -- UDP or TCP
ip = "172.27.131.100" -- IoT Creators IP address
port = 15683 -- IoT Creators port
receiveTimeout = 15000 -- the maximum execution time in milliseconds
------- M-BUS ---------
baudrate = 2400		-- baudrate: up to 921600 baud
parity = 2			-- communication parity: 0 for none, 1 for odd and 2 for even parity
stopBits = 1		-- number of stop bits: 1 or 2
dataBits = 8		-- number of data bits: 7 or 8
------ Timing ---------
--- wakeup interval ---
periodHours = 2
periodMinutes = 30
-----------------------

function onWake ()

    -- set link parameters - 2400 baud, 8E1
    api.mbusSetup(baudrate,parity,stopBits,dataBits)
    api.mbusState(1)
    api.delayms(2000)


    -- CREATE MBUS QUERY --
    -- UD2
    --b=pack.pack('<b5', 0x10, 0x5B, 0xFE, 0x59, 0x16)
    b=pack.pack('<b5', 0x10, 0x7B, 0xFE, (0x7B+0xFE)%256, 0x16)
    status,c,a,ci,ans = api.mbusTransaction(b,3000,1)
    api.mbusState(0)

    print("From MBus Calorimeter: ")

    api.dumpArray(ans)

    if #ans < 1 then
        buf = "NO DATA RECEIVED"
    else
        buf = ans
    end

    print("To NBIOT: ")

    api.dumpArray(buf)

    print("Sending to NB-IoT")
    api.nbSend(ip, port, buf, receiveTimeout, protocol)

    print("Done sending")
    print("Sleep now, wake in " .. tostring(periodHours) .. "hrs:" .. tostring(periodMinutes) .. "mins.....")

    api.wakeUpIn(0,periodHours,periodMinutes,0)
end

function onStartup()
    print("Starting up NB-IoT default script with APN settings")

    api.nbAT("APN=" .. APN)
    api.nbAT("PLMNID="..PLMNID)
end

Device installation

  1. Unscrew the 4 screws holding the cover and remove the cover.

  2. Remove the battery and run the communication interface wires through the PG gland.

  3. Screw on the NB-IoT antenna and connect the communication interface wires to the WAGO terminal board.

  4. Insert the SIM card with the battery and connect the battery connector to the power connector on the converter board.

  5. Please use the tool available at gui.acrios.com and the ACR-CONFIG configuration cable for any device configuration.

  6. Replace the device cover and tighten the 4 screws holding the cover. Make sure that the PG gland is tightened.

  7. Secure the device at the installation site with screws or cable ties.

Getting the IMEI

The IMEI of the device can be found on the bottom of the device. Alternatively it can be read out remotely via tools provided by ACRIOS Systems.

960

Payload specification

All ACRIOS devices use UDP via NB-IoT protocol. The payload from the M-Bus converter is 1:1 with a connected meter payload. Meaning you can use any M-Bus parser to parse the data from our converter. Alternatively, you can also set up a VIF DIF filter to shorten the payload and receive only the data which interests you. In this case the payload will still be M-Bus compliant.

Payload from the device is in the HEX format:

68f4f46808007258410408a34c1802010000000dfd0a126369727463656c452072656469656e6863530dfd0c0820353331334d45690dfd0e073230302e342e3103fd1758000005fddcff010000000005fddcff020000000005fddcff030000000005fddcff000000000005fdc9ff055bd0ef4205fdc9ff060000000005fdc9ff0793dfef4205fdc9ff084fe59f4205fdc9ff016906704305fdc9ff02fc3ff04205fdc9ff03092ef04205fdc9ff047914204305aeff010000000005aeff020000000005aeff0300000000052e0000000085402e000000008580402e0000000005ff0a0000c0ff05ff0bfa204842070300000000000000001f5d16

After running the data through the M-Bus parser, the outcome looks like this:

{
  "MBusData": {
    "SlaveInformation": {
      "Id": "8044158",
      "Manufacturer": "SEC",
      "Version": "24",
      "ProductName": null,
      "Medium": "Electricity",
      "AccessNumber": "1",
      "Status": "00",
      "Signature": "0000"
    },
    "DataRecord": [
      {
        "@id": "0",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": null,
        "Quantity": "Manufacturer",
        "Value": "Schneider Electric"
      },
      {
        "@id": "1",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": null,
        "Quantity": "Model / Version",
        "Value": "iEM3135"
      },
      {
        "@id": "2",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": null,
        "Quantity": "Firmware version",
        "Value": "1.4.002"
      },
      {
        "@id": "3",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": null,
        "Quantity": "Error flags",
        "Value": "88.000000"
      },
      {
        "@id": "4",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "A",
        "Quantity": "Current",
        "Value": "0.000000"
      },
      {
        "@id": "5",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "A",
        "Quantity": "Current",
        "Value": "0.000000"
      },
      {
        "@id": "6",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "A",
        "Quantity": "Current",
        "Value": "0.000000"
      },
      {
        "@id": "7",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "A",
        "Quantity": "Current",
        "Value": "0.000000"
      },
      {
        "@id": "8",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "V",
        "Quantity": "Voltage",
        "Value": "119.906944"
      },
      {
        "@id": "9",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "V",
        "Quantity": "Voltage",
        "Value": "0.000000"
      },
      {
        "@id": "10",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "V",
        "Quantity": "Voltage",
        "Value": "119.936668"
      },
      {
        "@id": "11",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "V",
        "Quantity": "Voltage",
        "Value": "79.947868"
      },
      {
        "@id": "12",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "V",
        "Quantity": "Voltage",
        "Value": "240.025040"
      },
      {
        "@id": "13",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "V",
        "Quantity": "Voltage",
        "Value": "120.124969"
      },
      {
        "@id": "14",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "V",
        "Quantity": "Voltage",
        "Value": "120.089912"
      },
      {
        "@id": "15",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "V",
        "Quantity": "Voltage",
        "Value": "160.079971"
      },
      {
        "@id": "16",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "W",
        "Quantity": "Power",
        "Value": "0.000000"
      },
      {
        "@id": "17",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "W",
        "Quantity": "Power",
        "Value": "0.000000"
      },
      {
        "@id": "18",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "W",
        "Quantity": "Power",
        "Value": "0.000000"
      },
      {
        "@id": "19",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "W",
        "Quantity": "Power",
        "Value": "0.000000"
      },
      {
        "@id": "20",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Tariff": "0",
        "Device": "1",
        "Unit": "W",
        "Quantity": "Power",
        "Value": "0.000000"
      },
      {
        "@id": "21",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Tariff": "0",
        "Device": "2",
        "Unit": "W",
        "Quantity": "Power",
        "Value": "0.000000"
      },
      {
        "@id": "22",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": null,
        "Quantity": "Manufacturer specific",
        "Value": "-nan"
      },
      {
        "@id": "23",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": null,
        "Quantity": "Manufacturer specific",
        "Value": "50.032204"
      },
      {
        "@id": "24",
        "Function": "Instantaneous value",
        "StorageNumber": "0",
        "Unit": "Wh",
        "Quantity": "Energy",
        "Value": "0.000000"
      },
      {
        "@id": "25",
        "Function": "More records follow",
        "StorageNumber": "0",
        "Unit": null,
        "Quantity": null,
        "Value": null
      }
    ]
  },
  "status": "success"
}

How to decode M-Bus data with IoT Creators parser

A data decoder service is a tool or program that can be used to convert raw data into a structured format, such as JSON. This process is often referred to as "parsing" the data. The specific steps and methods used by a data decoder service will depend on the type of data being parsed and the desired output format.

In this case, we want to take the raw payload from the ACRIOS M-Bus IoT converter and convert it to the JSON format with specific values based on the VIF/DIF values. For this, we can use an Application data decoder service provided by the IoT Creators.

📘

Decoder

For the application data decoder service, please refer to the documentation provided HERE.

Please make sure, that deviceType = "Acrios Mbus" !

Possible modifications - connecting multiple meters to the one M-Bus IoT converter

At the moment, the ACRIOS M-Bus converter is used as a transparent bridge to which you connect 1 meter. This is a perfect solution for NB-IoT converters as there is no configuration needed. The master sends a broadcast query, the meter answers, and the raw payload is sent over the NB-IoT network in the same raw format which is then processed.

The issue might come if you connect more than one meter, you have to figure out the address of the devices and you can not just send a broadcast query. This can be worked around by changing the communication speed on the meters so each meter has a different speed. Then you send a broadcast query with different speeds, one by one.

Alternatively, you can use secondary addressing for each connected meter which will send a request only to the specific meter at a time. The disadvantage is that you have to configure the M-Bus converter and it creates a possibility for human error. The solution might be remote downlink configuration which allows you to set secondary addresses remotely. This is currently not supported within the IoT Creators platform and a custom service must be created. Please get in touch with ACRIOS Systems for details regarding the configuration messages.

📘

Contact ACRIOS Systems directly

In case of any questions which are very specific to ACRIOS devices such as LUA scripting possibilities or downlink configuration, please contact ACRIOS directly at [email protected] or check the Wiki page.