How do I use Node-RED to read Analog Input Module ED-549 with Modbus TCP?

FAQs

1. Summary

This FAQ explains different nodes inside Node-RED, which are used in creating an example for using a BB-400, with an ED-549. The end example is a flow which will be able to read the inputs of a Brainboxes ED-549.

2. Introduction

Nodes used in this FAQ

Image Description
Debug node Debug, for debugging the returned data from the nodes it’s attached to.
Modbus Read node Modbus TCP/Serial read node. Connects to a Modbus TCP or serial to read registers/coils values with a given polling rate.
Function node Function, a JavaScript block to run against the messages being received and output as a msg object.
Gauge node Adds a gauge type widget to the user interface.
Chart node Adds a chart to the user interface.

Requirements

Software/Equipment Details
Brainboxes BB-400 BB-400
BB-Node-RED installed On the BB-400, you must have the software package bb-node-red installed
You can check if it’s installed using bb status.version or install it with sudo apt-get install bb-node-red
Brainboxes ED-549 Brainboxes ED-549

3. ED-549 Setup

A Brainboxes ED-549 comes in a default configuration using the ASCII protocol. The unit needs to be configured to use the Modbus TCP protocol instead. To do that, simply go to the ED-549 Web UI configuration, and change the protocol settings from ASCII to Modbus TCP:

ED-549 Protocol settings

For the examples used in this FAQ, we will be using the:

  • Analog input even numbers as voltage lines (using ±10V)
  • Analog input odd numbers as milliamp lines (using 4-20mA)

ED-549 Analog input

Please note that for the ED-549, you must also change the jumper configuration, which is located inside the case on the physical hardware for each of the inputs:

Jumper configuration

4. Guide

The Modbus TCP/Serial nodes come from a 3rd party NPM package known as « node-red-contrib-modbus ». It comes with many useful tools that can be used with the BB-400 to talk with, and between, other Brainboxes ED devices, but for this FAQ, the only one we need is the Modbus TCP read node:

Modbus Read node Modbus Read node settings

For the  newmodbus-client, you need to configure your ED-549 as the new device. For example:

Modbus Client configuration

Now to add a function node. The Modbus TCP Read Node passes all the values for all the lines, and the function node will be used to split all of the values into 8 separate lanes, 1 for each input on the ED-549. Note that the ‘Outputs’ setting at the bottom has been set to 8. This expands the function node to give it 8 outputs. Each of these outputs will be for each of the input:

Function node Splitting inputs
return msg.payload.map(function(p) {
    return {payload: p};
});

The Modbus Read Node will be connecting to the left side of the function node.
Each of the inputs from the ED-549 will go into the split inputs, and out of the corresponding output, which is where we can display each of the inputs differently and separately:

ED Read Inputs flow

You can immediately test that you are getting a connection to the ED-549 at this point and that data is being displayed and returned correctly. Simply add a debug node to one of the function outputs (for AIn0, we will use the top most output) to see what value it returns:

ED Read Inputs test

After the flow has been deployed, Deploy button the user should immediately notice the active connection on the Modbus Read Node. When looking at the Debug tab Debug icon on the right, it will show the line value coming in on AIn0:

Modbus TCP Read Node Value from Node-RED debug Value from ED-549 Web UI
ED Read Inputs active Value from Node-RED debug ED-549 value

In an ED-549 factory default configuration, with this Node-RED setup, 9.499 is equal to 9.499V on the AIn0 input.

Now add some UI nodes for each of the inputs, and configure them how you desire. These UI nodes will appear on your Node-RED dashboard for each of the Analog Inputs.

The examples have the Full Scale Range on the inputs configured to ±10V. That means that the UI nodes will also need to be configured to match this, and from the debug information above, it shows that the range should be between -10000 and 10000, for -10V to 10V:

Channel configuration

Node Configuration
Gauge node Gauge configuration
Chart node Chart configuration

Another good example would be the configuration used for one of the milliamp gauge and charts:

Milliamp Channel configuration

Further Milliamp Channel configuration

Node Configuration
Gauge node Gauge Milliamp configuration
Chart node Chart Milliamp configuration

All of these configuration settings can be changed to how you see fit. The colours can change depending on what range it is, or make the chart/gauge record across an hourly or daily basis. The choice is yours!:

ED Read Inputs flow

After you have completed everything and tied everything together, Deploy button it and test it out:

Input receiving data

When you have copied it across and created UI for each of your Analog Inputs, you’ll be able to see everything that is going on:

All inputs registering data

5. Full Flow

Show full flow example

[
    {
        "id": "14a1a272.213d1e",
        "type": "tab",
        "label": "[ED-Analog] Modbus",
        "disabled": true,
        "info": "# Modbus ExamplenThis flow gives you an example on how you can use Modbus in Node-RED, talking to a Brainboxes ED device from a BB-400.nnFor this flow to work:n* Your Brainboxes ED device needs to be configured to use the Modbus TCP protocol.n* The IP address for your Brainboxes ED device, needs to be configured inside each of the Modbus nodes found on this flow.nn# **Brainboxes Node-RED FAQ**nNeed more help or tutorials on using Node-RED? Go to: nhttps://www.brainboxes.com/faqs/search/Node-RED"
    },
    {
        "id": "d679e58.f1a9618",
        "type": "function",
        "z": "14a1a272.213d1e",
        "name": "Split Inputs",
        "func": "// Split the payload from an array of 8n// analog input values into 8 messages withn// a value and an IO numbernreturn msg.payload.map(function(ioValue, ioNumber) {n    ioValue=ioValue/1000n    return {payload: ioValue, topic: ioNumber};n});",
        "outputs": 8,
        "noerr": 0,
        "x": 350,
        "y": 320,
        "wires": [
            [
                "9b83d68f.cf96c8",
                "ebf90e0.f7cfdf"
            ],
            [
                "b66633bd.cdd2",
                "5b3c27bc.144ae8"
            ],
            [
                "f688dfb6.e3cfd",
                "7edebe57.3b68f"
            ],
            [
                "88343792.2dc368",
                "ecefc57.4a1fa38"
            ],
            [
                "db3217b7.2add48",
                "a33f73d.ca3169"
            ],
            [
                "2c38e77a.0c1e98",
                "46574b7f.95f124"
            ],
            [
                "22ba140a.3f746c",
                "81d84239.f8c86"
            ],
            [
                "220b0459.f1d5bc",
                "8c187e97.a20fe"
            ]
        ]
    },
    {
        "id": "2f11f8a2.756e28",
        "type": "comment",
        "z": "14a1a272.213d1e",
        "name": "2. Then make sure to DEPLOY this flow by clicking the button located in the top right",
        "info": "",
        "x": 310,
        "y": 60,
        "wires": []
    },
    {
        "id": "f327cd5d.30dc9",
        "type": "modbus-read",
        "z": "14a1a272.213d1e",
        "name": "ED Read Inputs",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "unitid": "",
        "dataType": "HoldingRegister",
        "adr": "0",
        "quantity": "8",
        "rate": "1000",
        "rateUnit": "ms",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "447f3ae2.d53104",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "x": 120,
        "y": 280,
        "wires": [
            [
                "d679e58.f1a9618",
                "499aea89.6c06d4"
            ],
            []
        ]
    },
    {
        "id": "9b83d68f.cf96c8",
        "type": "ui_gauge",
        "z": "14a1a272.213d1e",
        "name": "AIn0",
        "group": "6838a81b.c3bbc8",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "donut",
        "title": "AIn0",
        "label": "V",
        "format": "",
        "min": "-10",
        "max": "10",
        "colors": [
            "#00a800",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "2",
        "seg2": "5",
        "x": 550,
        "y": 160,
        "wires": []
    },
    {
        "id": "b66633bd.cdd2",
        "type": "ui_gauge",
        "z": "14a1a272.213d1e",
        "name": "AIn1",
        "group": "6838a81b.c3bbc8",
        "order": 2,
        "width": 0,
        "height": 0,
        "gtype": "donut",
        "title": "AIn1",
        "label": "mA",
        "format": "",
        "min": "4",
        "max": "20",
        "colors": [
            "#00a800",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "10",
        "seg2": "16",
        "x": 550,
        "y": 360,
        "wires": []
    },
    {
        "id": "f688dfb6.e3cfd",
        "type": "ui_gauge",
        "z": "14a1a272.213d1e",
        "name": "AIn2",
        "group": "6838a81b.c3bbc8",
        "order": 3,
        "width": 0,
        "height": 0,
        "gtype": "donut",
        "title": "AIn2",
        "label": "V",
        "format": "",
        "min": "-10",
        "max": "10",
        "colors": [
            "#00a800",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "2",
        "seg2": "5",
        "x": 550,
        "y": 200,
        "wires": []
    },
    {
        "id": "88343792.2dc368",
        "type": "ui_gauge",
        "z": "14a1a272.213d1e",
        "name": "AIn3",
        "group": "6838a81b.c3bbc8",
        "order": 4,
        "width": 0,
        "height": 0,
        "gtype": "donut",
        "title": "AIn3",
        "label": "mA",
        "format": "",
        "min": "4",
        "max": "20",
        "colors": [
            "#00a800",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "10",
        "seg2": "16",
        "x": 550,
        "y": 400,
        "wires": []
    },
    {
        "id": "ebf90e0.f7cfdf",
        "type": "ui_chart",
        "z": "14a1a272.213d1e",
        "name": "",
        "group": "dc5d43e0.5931",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "AIn0",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "-10",
        "ymax": "10",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 670,
        "y": 163,
        "wires": [
            []
        ]
    },
    {
        "id": "5b3c27bc.144ae8",
        "type": "ui_chart",
        "z": "14a1a272.213d1e",
        "name": "",
        "group": "dc5d43e0.5931",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "AIn1",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "4",
        "ymax": "20",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 670,
        "y": 363,
        "wires": [
            []
        ]
    },
    {
        "id": "7edebe57.3b68f",
        "type": "ui_chart",
        "z": "14a1a272.213d1e",
        "name": "",
        "group": "dc5d43e0.5931",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "AIn2",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "-10",
        "ymax": "10",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 670,
        "y": 203,
        "wires": [
            []
        ]
    },
    {
        "id": "ecefc57.4a1fa38",
        "type": "ui_chart",
        "z": "14a1a272.213d1e",
        "name": "",
        "group": "dc5d43e0.5931",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "AIn3",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "4",
        "ymax": "20",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 670,
        "y": 403,
        "wires": [
            []
        ]
    },
    {
        "id": "9a9773d5.737c4",
        "type": "comment",
        "z": "14a1a272.213d1e",
        "name": "3. Visit your dashboard! http://bb400-xxxx:1880/ui (where bb400-xxxx is your BB-400 hostname or IP address)",
        "info": "",
        "x": 390,
        "y": 800,
        "wires": []
    },
    {
        "id": "2c38e77a.0c1e98",
        "type": "ui_gauge",
        "z": "14a1a272.213d1e",
        "name": "AIn5",
        "group": "20aa9b2a.7dab04",
        "order": 2,
        "width": 0,
        "height": 0,
        "gtype": "donut",
        "title": "AIn5",
        "label": "mA",
        "format": "",
        "min": "4",
        "max": "20",
        "colors": [
            "#00a800",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "10",
        "seg2": "16",
        "x": 550,
        "y": 440,
        "wires": []
    },
    {
        "id": "22ba140a.3f746c",
        "type": "ui_gauge",
        "z": "14a1a272.213d1e",
        "name": "AIn6",
        "group": "20aa9b2a.7dab04",
        "order": 3,
        "width": 0,
        "height": 0,
        "gtype": "donut",
        "title": "AIn6",
        "label": "V",
        "format": "",
        "min": "-10",
        "max": "10",
        "colors": [
            "#00a800",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "2",
        "seg2": "5",
        "x": 550,
        "y": 280,
        "wires": []
    },
    {
        "id": "220b0459.f1d5bc",
        "type": "ui_gauge",
        "z": "14a1a272.213d1e",
        "name": "AIn7",
        "group": "20aa9b2a.7dab04",
        "order": 4,
        "width": 0,
        "height": 0,
        "gtype": "donut",
        "title": "AIn7",
        "label": "mA",
        "format": "",
        "min": "4",
        "max": "20",
        "colors": [
            "#00a800",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "10",
        "seg2": "16",
        "x": 550,
        "y": 480,
        "wires": []
    },
    {
        "id": "db3217b7.2add48",
        "type": "ui_chart",
        "z": "14a1a272.213d1e",
        "name": "",
        "group": "a2c176bc.cade88",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "AIn4",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "-10",
        "ymax": "10",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 670,
        "y": 240,
        "wires": [
            []
        ]
    },
    {
        "id": "46574b7f.95f124",
        "type": "ui_chart",
        "z": "14a1a272.213d1e",
        "name": "",
        "group": "a2c176bc.cade88",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "AIn5",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "4",
        "ymax": "20",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 670,
        "y": 443,
        "wires": [
            []
        ]
    },
    {
        "id": "81d84239.f8c86",
        "type": "ui_chart",
        "z": "14a1a272.213d1e",
        "name": "",
        "group": "a2c176bc.cade88",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "AIn6",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "-10",
        "ymax": "10",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 670,
        "y": 283,
        "wires": [
            []
        ]
    },
    {
        "id": "8c187e97.a20fe",
        "type": "ui_chart",
        "z": "14a1a272.213d1e",
        "name": "",
        "group": "a2c176bc.cade88",
        "order": 1,
        "width": 0,
        "height": 0,
        "label": "AIn7",
        "chartType": "line",
        "legend": "false",
        "xformat": "HH:mm:ss",
        "interpolate": "linear",
        "nodata": "",
        "dot": false,
        "ymin": "4",
        "ymax": "20",
        "removeOlder": 1,
        "removeOlderPoints": "",
        "removeOlderUnit": "60",
        "cutout": 0,
        "useOneColor": false,
        "colors": [
            "#1f77b4",
            "#aec7e8",
            "#ff7f0e",
            "#2ca02c",
            "#98df8a",
            "#d62728",
            "#ff9896",
            "#9467bd",
            "#c5b0d5"
        ],
        "useOldStyle": false,
        "outputs": 1,
        "x": 670,
        "y": 483,
        "wires": [
            []
        ]
    },
    {
        "id": "499aea89.6c06d4",
        "type": "modbus-response",
        "z": "14a1a272.213d1e",
        "name": "",
        "registerShowMax": "8",
        "x": 170,
        "y": 380,
        "wires": []
    },
    {
        "id": "f2d8dc6e.c17c6",
        "type": "function",
        "z": "14a1a272.213d1e",
        "name": "Modbus Payload",
        "func": "msg.payload = { n    value: msg.payload, n    'fc': 6, n    'unitid': 255, n    'address': msg.topic, n    'quantity': 1 n} nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "x": 850,
        "y": 600,
        "wires": [
            [
                "93c3d451.6fba78"
            ]
        ]
    },
    {
        "id": "93c3d451.6fba78",
        "type": "modbus-flex-write",
        "z": "14a1a272.213d1e",
        "name": "Set Output",
        "showStatusActivities": true,
        "showErrors": true,
        "server": "e0dfcc8.bcc183",
        "x": 870,
        "y": 640,
        "wires": [
            [],
            []
        ]
    },
    {
        "id": "704df223.3d476c",
        "type": "modbus-read",
        "z": "14a1a272.213d1e",
        "name": "ED Read Outputs",
        "topic": "",
        "showStatusActivities": false,
        "logIOActivities": false,
        "showErrors": false,
        "unitid": "",
        "dataType": "HoldingRegister",
        "adr": "0",
        "quantity": "4",
        "rate": "1000",
        "rateUnit": "ms",
        "delayOnStart": false,
        "startDelayTime": "",
        "server": "2d38213a.e96ace",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "x": 120,
        "y": 580,
        "wires": [
            [
                "86f63f9e.d5e25"
            ],
            []
        ]
    },
    {
        "id": "a16d6e33.57ff8",
        "type": "ui_slider",
        "z": "14a1a272.213d1e",
        "name": "",
        "label": "AOut0",
        "tooltip": "",
        "group": "d7e21aab.3b8a28",
        "order": 5,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "end",
        "topic": "0",
        "min": 0,
        "max": "10000",
        "step": "50",
        "x": 550,
        "y": 540,
        "wires": [
            [
                "f2d8dc6e.c17c6"
            ]
        ]
    },
    {
        "id": "93c9a3f6.5d54a",
        "type": "ui_slider",
        "z": "14a1a272.213d1e",
        "name": "",
        "label": "AOut1",
        "tooltip": "",
        "group": "d7e21aab.3b8a28",
        "order": 6,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "end",
        "topic": "1",
        "min": 0,
        "max": "10000",
        "step": "100",
        "x": 550,
        "y": 580,
        "wires": [
            [
                "f2d8dc6e.c17c6"
            ]
        ]
    },
    {
        "id": "c98ef5f6.8ab388",
        "type": "ui_slider",
        "z": "14a1a272.213d1e",
        "name": "",
        "label": "AOut2",
        "tooltip": "",
        "group": "d7e21aab.3b8a28",
        "order": 7,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "end",
        "topic": "2",
        "min": 0,
        "max": "10000",
        "step": "100",
        "x": 550,
        "y": 620,
        "wires": [
            [
                "f2d8dc6e.c17c6"
            ]
        ]
    },
    {
        "id": "f0a00f55.de487",
        "type": "ui_slider",
        "z": "14a1a272.213d1e",
        "name": "",
        "label": "AOut3",
        "tooltip": "",
        "group": "d7e21aab.3b8a28",
        "order": 8,
        "width": 0,
        "height": 0,
        "passthru": true,
        "outs": "end",
        "topic": "3",
        "min": 0,
        "max": "10000",
        "step": "100",
        "x": 550,
        "y": 660,
        "wires": [
            [
                "f2d8dc6e.c17c6"
            ]
        ]
    },
    {
        "id": "86f63f9e.d5e25",
        "type": "function",
        "z": "14a1a272.213d1e",
        "name": "Split Outputs",
        "func": "return msg.payload.map(function(ioValue, ioNumber) {n    return {payload: ioValue, topic: ioNumber};n});",
        "outputs": 4,
        "noerr": 0,
        "x": 350,
        "y": 600,
        "wires": [
            [
                "a16d6e33.57ff8",
                "54554ea3.a62c4"
            ],
            [
                "93c9a3f6.5d54a",
                "818e6e99.e6d8c"
            ],
            [
                "c98ef5f6.8ab388",
                "3bf9da0c.610996"
            ],
            [
                "f0a00f55.de487",
                "27f0093b.e7d126"
            ]
        ]
    },
    {
        "id": "54554ea3.a62c4",
        "type": "ui_text_input",
        "z": "14a1a272.213d1e",
        "name": "AOut0",
        "label": "AOut0",
        "tooltip": "",
        "group": "d7e21aab.3b8a28",
        "order": 16,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "0",
        "x": 670,
        "y": 540,
        "wires": [
            [
                "f2d8dc6e.c17c6"
            ]
        ]
    },
    {
        "id": "818e6e99.e6d8c",
        "type": "ui_text_input",
        "z": "14a1a272.213d1e",
        "name": "AOut1",
        "label": "AOut1",
        "tooltip": "",
        "group": "d7e21aab.3b8a28",
        "order": 16,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "1",
        "x": 670,
        "y": 580,
        "wires": [
            [
                "f2d8dc6e.c17c6"
            ]
        ]
    },
    {
        "id": "3bf9da0c.610996",
        "type": "ui_text_input",
        "z": "14a1a272.213d1e",
        "name": "AOut2",
        "label": "AOut2",
        "tooltip": "",
        "group": "d7e21aab.3b8a28",
        "order": 16,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "2",
        "x": 670,
        "y": 620,
        "wires": [
            [
                "f2d8dc6e.c17c6"
            ]
        ]
    },
    {
        "id": "27f0093b.e7d126",
        "type": "ui_text_input",
        "z": "14a1a272.213d1e",
        "name": "AOut3",
        "label": "AOut3",
        "tooltip": "",
        "group": "d7e21aab.3b8a28",
        "order": 16,
        "width": 0,
        "height": 0,
        "passthru": true,
        "mode": "text",
        "delay": "0",
        "topic": "3",
        "x": 670,
        "y": 660,
        "wires": [
            [
                "f2d8dc6e.c17c6"
            ]
        ]
    },
    {
        "id": "a33f73d.ca3169",
        "type": "ui_gauge",
        "z": "14a1a272.213d1e",
        "name": "AIn4",
        "group": "20aa9b2a.7dab04",
        "order": 1,
        "width": 0,
        "height": 0,
        "gtype": "donut",
        "title": "AIn4",
        "label": "V",
        "format": "",
        "min": "-10",
        "max": "10",
        "colors": [
            "#00a800",
            "#e6e600",
            "#ca3838"
        ],
        "seg1": "2",
        "seg2": "5",
        "x": 550,
        "y": 237,
        "wires": []
    },
    {
        "id": "f561bd3c.32d82",
        "type": "comment",
        "z": "14a1a272.213d1e",
        "name": "milliAmps (4-20mA)",
        "info": "",
        "x": 590,
        "y": 320,
        "wires": []
    },
    {
        "id": "d5fd82d1.ed8bc",
        "type": "comment",
        "z": "14a1a272.213d1e",
        "name": "Voltage (±10V)",
        "info": "",
        "x": 580,
        "y": 120,
        "wires": []
    },
    {
        "id": "6472c7a0.8808d8",
        "type": "comment",
        "z": "14a1a272.213d1e",
        "name": "Brainboxes ED-549 8x Analog Inputs",
        "info": "[Brainboxes ED-549 8 Analogue Inputs](http://www.brainboxes.com/product/ed-549/ethernet-to-8-analogue-inputs-rs485-gateway)nn[Brainboxes ED-560 4 Analogue Outputs](http://www.brainboxes.com/product/ed-560/ethernet-to-4-analogue-outputs-rs485-gateway)n![image.png](http://www.brainboxes.com/files/catalog/product/ED/ED-549/img/analogue-range.jpg)",
        "x": 170,
        "y": 240,
        "wires": [],
        "icon": "font-awesome/fa-lightbulb-o"
    },
    {
        "id": "97235015.23152",
        "type": "comment",
        "z": "14a1a272.213d1e",
        "name": "Brainboxes ED-560 4x Analogue Outputs",
        "info": "[Brainboxes ED-560 4x Analogue Outputs](http://www.brainboxes.com/product/ed-549/ethernet-to-8-analogue-inputs-rs485-gateway)n",
        "x": 180,
        "y": 540,
        "wires": [],
        "icon": "font-awesome/fa-lightbulb-o"
    },
    {
        "id": "3e31efe4.c4f5e",
        "type": "ui_template",
        "z": "14a1a272.213d1e",
        "group": "d7e21aab.3b8a28",
        "name": "",
        "order": 2,
        "width": 0,
        "height": 0,
        "format": "",
        "storeOutMessages": false,
        "fwdInMessages": false,
        "templateScope": "local",
        "x": 100,
        "y": 20,
        "wires": [
            []
        ]
    },
    {
        "id": "f76734f4.d9dd28",
        "type": "comment",
        "z": "14a1a272.213d1e",
        "name": "1. Enable this flow by double clicking "[ED-Analogue] Modbus" above",
        "info": "",
        "x": 260,
        "y": 20,
        "wires": []
    },
    {
        "id": "447f3ae2.d53104",
        "type": "modbus-client",
        "z": "",
        "name": "Analogue Inputs",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "tcpHost": "192.168.127.254",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "unit_id": 255,
        "commandDelay": 1,
        "clientTimeout": 2000,
        "reconnectTimeout": 2000
    },
    {
        "id": "6838a81b.c3bbc8",
        "type": "ui_group",
        "z": "",
        "name": "Gauge (0-3)",
        "tab": "f17a1f08.c1195",
        "order": 2,
        "disp": false,
        "width": "5",
        "collapse": false
    },
    {
        "id": "dc5d43e0.5931",
        "type": "ui_group",
        "z": "",
        "name": "Chart (0-3)",
        "tab": "f17a1f08.c1195",
        "order": 3,
        "disp": false,
        "width": "6",
        "collapse": false
    },
    {
        "id": "20aa9b2a.7dab04",
        "type": "ui_group",
        "z": "",
        "name": "Gauge (4-7)",
        "tab": "f17a1f08.c1195",
        "order": 4,
        "disp": false,
        "width": "5",
        "collapse": false
    },
    {
        "id": "a2c176bc.cade88",
        "type": "ui_group",
        "z": "",
        "name": "Chart (4-7)",
        "tab": "f17a1f08.c1195",
        "order": 5,
        "disp": false,
        "width": "6",
        "collapse": false
    },
    {
        "id": "e0dfcc8.bcc183",
        "type": "modbus-client",
        "z": "",
        "name": "Digital Outputs",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "tcpHost": "192.168.127.254",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "unit_id": 1,
        "commandDelay": 1,
        "clientTimeout": 2000,
        "reconnectTimeout": 2000
    },
    {
        "id": "2d38213a.e96ace",
        "type": "modbus-client",
        "z": "",
        "name": "Analogue Outputs",
        "clienttype": "tcp",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "tcpHost": "192.168.127.254",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "/dev/ttyUSB",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "unit_id": 255,
        "commandDelay": 1,
        "clientTimeout": 2000,
        "reconnectTimeout": 2000
    },
    {
        "id": "d7e21aab.3b8a28",
        "type": "ui_group",
        "z": "",
        "name": "Sliders [&] Numbers",
        "tab": "f17a1f08.c1195",
        "order": 1,
        "disp": false,
        "width": "8",
        "collapse": false
    },
    {
        "id": "f17a1f08.c1195",
        "type": "ui_tab",
        "z": "",
        "name": "Modbus: Brainboxes ED-Analogue",
        "icon": "dashboard",
        "order": 5,
        "disabled": false,
        "hidden": false
    }
]

6. Modbus Registers & Value Encoding

ED-549 Registers

Modbus access type Modbus function codes Logical address 984 style address IEC 61131 address
Analogue inputs (as integer) Holding register 3 0x0000 – 7 40001 – 8 %MW0 – 7
Analogue inputs (as integer) Input register 4 0x0000 – 7 30001 – 8 N/A
Analogue inputs (as float) Holding register 3 0x0020 – 7 40033 – 40 %MF32 – 39
Analogue inputs (as float) Input register 4 0x0020 – 7 30033 – 40 N/A
Input error flags Discrete input 2 0x0400 – 7 11025 – 1032 N/A
Input error flags Input register 4 0x0400 31025 N/A
Input error flags Holding register 3 0x0400 41025 %MW1024
Input channel enable Holding register 3, 6, 16 0x0040 40065 %MW64
Input channel enable Coil 1, 5, 15 0x0040 – 7 00065 – 72 %M64 – 71
Input type/range Holding register 3, 6, 16 0x0060 – 7 40097 – 104 %MW96 – 103
Integer format Holding register 3, 6, 16 0x0080 40129 %MW128
Integer format Coil 1, 5, 15 0x0080 129 %M128

Brainboxes Value Encoding

Integer values are encoded in one of two formats, depending on the integer format setting.

  • “Hexadecimal” (integer format register = 0, integer format coil OFF): the input range is scaled to fill the range of a 16-bit integer value, either as a 2’s complement number for ranges which extend to negative values, or as an unsigned number for ranges which do not go below zero.
  • “Engineering units” (integer format register = 1, integer format coil ON): the measurement, in mA, mV or V, is scaled up to as high a power of 10 as possible while allowing the full range of values to fit in a 16-bit integer. For example, the ±2.5V range is expressed as the reading in Volts multiplied by 10000: if it were multiplied by 100000 then some values would be too large to fit in a 16-bit register.

Floating-point values are encoded according to the IEEE 754 standard for 32-bit floating-point numbers. Each value takes two sequential 16-bit Modbus registers, with the least-significant bits of the 32-bit value being held in the lower register address (“little-endian” format). Both Modbus registers must be read in the same Modbus request. The units of the float values are Volts or milliAmps.

Under-range inputs result in a reading equal to the –Full Scale value, and over-range inputs result in a reading equal to the +Full Scale value. The type/range codes which can be set using Modbus, and the data ranges they result in, are tabulated below. The codes are the same as for the ASCII protocol.

Type Code Input Type Data Format + Full Scale – Full Scale
05 ±2.5V Float engineering unit +2.5 -2.5
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit 25000 -25000
06 or 0D ±20mA Float engineering unit +20.0 -20.0
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit -20000 20000
07 +4 to +20mA Float engineering unit +20.0 +4.0
Integer hexadecimal 0xFFFF = 65536 0x0000 = 0
Integer engineering unit 4000 20000
08 ±10V Float engineering unit +10.0 -10.0
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit 10000 -10000
09 ±5V Float engineering unit +5.0 -5.0
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit 5000 -5000
04 or 0A ±1V Float engineering unit +1.0 -1.0
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit 10000 -10000
03 or 0B ±500mV Float engineering unit +500.0 -500.0
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit 5000 -5000
0C ±150mV Float engineering unit +150.0 -150.0
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit 15000 -15000
1A 0 to +20mA Float engineering unit +20.0 +0.0
Integer hexadecimal 0xFFFF = 65536 0x0000 = 0
Integer engineering unit 20000 0
3A ±75mV Float engineering unit +75.0 -75.0
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit 7500 -7500
3B ±250mV Float engineering unit +250.0 -250.0
Integer hexadecimal 0x7FFF = 32767 0x8000 = -32768
Integer engineering unit 25000 -25000
FAQs