Can Not Get Float value from Energy Meter using Modbus RTU serial




4

I am unable to Get Float value from Energy Meter using Modbus RTU serial.
I am getting completely wrong value.

Set address to 100 & check again.

Edit...

Just noticed you have a multiplier of 0.01 -- remove that.

Lastly, this value might be little endian (so try that too)

6

With 100 Address i am getting this Error

And With 101 Address i am getting Some Random Value
7

Ok, the device might be one of those 1 based index addressing.

Could you add another 2 rows to buffer parser...

  • Uint16be offset 0, length 2, no multiplier
  • Uint16le offset 0, length 2, no multiplier

Show me the debug output & the modbus application values from the same moment in time. In short, I want to see how the node-red data aligns with the modbus app values

9
Sir , I am getting Integer value as shown in......but this is voltage value so it should be around 240.00V......

I need to also see the values from your modbus application to see if the address registered align. A snapshot of both the values you see in node-red and in the app.

Also, what start address are you using?

As you can see in Modbus Scanner the Holding Register H40100......but in node-red i have to add 101 then Data is coming in some decimal form.......if i use 100 or H40100 then it is showing illegal address........

I realise what you are saying however please indulge me.
Please show a screenshot showing the values sampled at roughly the same time so that I can verify the alignment of addresses.



here is the complete screen shot.

Sir 99 Address is matching with 101 random value

As i suspected, addressing is off by 1 - this is a common phenomena in Modbus.

So in which case, take the values from Address 99 & it should work.

From address 99, read 4 values

In buffer parser...

  • FloatBE offset 0, length 2, no multiplier
  • FloatLE offset 0, length 2, no multiplier

:point_up_2: inspect these - 1 set will look right, the other will look wrong.


Still look some issue....

[
    {
        "id": "b4132d0e1950d012",
        "type": "tab",
        "label": "Flow 1",
        "disabled": false,
        "info": "",
        "env": []
    },
    {
        "id": "83a85713fa0151bc",
        "type": "inject",
        "z": "b4132d0e1950d012",
        "name": "",
        "props": [
            {
                "p": "payload"
            },
            {
                "p": "topic",
                "vt": "str"
            }
        ],
        "repeat": "",
        "crontab": "",
        "once": false,
        "onceDelay": 0.1,
        "topic": "",
        "payload": "",
        "payloadType": "date",
        "x": 320,
        "y": 280,
        "wires": [
            [
                "735e7aca3b0ed1b0"
            ]
        ]
    },
    {
        "id": "735e7aca3b0ed1b0",
        "type": "function",
        "z": "b4132d0e1950d012",
        "name": "address:0",
        "func": "msg.payload ={\n    'fc':3,\n     'unitid':1,\n    'address':99,\n    'quantity':4\n    \n}\nreturn msg;",
        "outputs": 1,
        "noerr": 0,
        "initialize": "",
        "finalize": "",
        "libs": [],
        "x": 500,
        "y": 280,
        "wires": [
            [
                "13260c154cb8689f"
            ]
        ]
    },
    {
        "id": "13260c154cb8689f",
        "type": "modbus-flex-getter",
        "z": "b4132d0e1950d012",
        "name": "SPM",
        "showStatusActivities": false,
        "showErrors": true,
        "logIOActivities": false,
        "server": "2a0ca9ebcafdd397",
        "useIOFile": false,
        "ioFile": "",
        "useIOForPayload": false,
        "emptyMsgOnFail": false,
        "keepMsgProperties": false,
        "x": 690,
        "y": 280,
        "wires": [
            [
                "d3c1b24edad3f5f3"
            ],
            []
        ]
    },
    {
        "id": "d3c1b24edad3f5f3",
        "type": "buffer-parser",
        "z": "b4132d0e1950d012",
        "name": "C-1",
        "data": "payload",
        "dataType": "msg",
        "specification": "spec",
        "specificationType": "ui",
        "items": [
            {
                "type": "floatbe",
                "name": "item3",
                "offset": 0,
                "length": 2,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            },
            {
                "type": "floatle",
                "name": "item2",
                "offset": 0,
                "length": 2,
                "offsetbit": 0,
                "scale": "1",
                "mask": ""
            }
        ],
        "swap1": "",
        "swap2": "",
        "swap3": "",
        "swap1Type": "swap",
        "swap2Type": "swap",
        "swap3Type": "swap",
        "msgProperty": "payload",
        "msgPropertyType": "str",
        "resultType": "value",
        "resultTypeType": "output",
        "multipleResult": true,
        "fanOutMultipleResult": false,
        "setTopic": false,
        "outputs": 1,
        "x": 870,
        "y": 280,
        "wires": [
            [
                "43bd8f12eadcd87f"
            ]
        ]
    },
    {
        "id": "43bd8f12eadcd87f",
        "type": "debug",
        "z": "b4132d0e1950d012",
        "name": "",
        "active": true,
        "tosidebar": true,
        "console": false,
        "tostatus": false,
        "complete": "false",
        "statusVal": "",
        "statusType": "auto",
        "x": 1050,
        "y": 280,
        "wires": []
    },
    {
        "id": "2a0ca9ebcafdd397",
        "type": "modbus-client",
        "name": "Secure",
        "clienttype": "simpleser",
        "bufferCommands": true,
        "stateLogEnabled": false,
        "queueLogEnabled": false,
        "tcpHost": "127.0.0.1",
        "tcpPort": "502",
        "tcpType": "DEFAULT",
        "serialPort": "COM2",
        "serialType": "RTU-BUFFERD",
        "serialBaudrate": "9600",
        "serialDatabits": "8",
        "serialStopbits": "1",
        "serialParity": "none",
        "serialConnectionDelay": "100",
        "serialAsciiResponseStartDelimiter": "0x3A",
        "unit_id": "1",
        "commandDelay": "100",
        "clientTimeout": "1000",
        "reconnectOnTimeout": true,
        "reconnectTimeout": "2000",
        "parallelUnitIdsAllowed": true
    }
]

In order to make code readable and usable it is necessary to surround your code with three backticks (also known as a left quote or backquote ```)

``` 
   code goes here 
```

You can edit and correct your post by clicking the pencil :pencil2: icon.

See this post for more details - How to share code or flow json

image

Can you please capture the data coming out of modbud node by adding a debug where shown (set to show complete message) - then, use the "Copy Value" button on the debug tools to capture a full good message.

Dont forget the code formatting.


flows.json (4.2 KB)

I cant copy text from a picture.

I asked you to set the debug to show complete message..
image

and to use the copy value from the debug tools

Greenshot_JklYKgZ47j

Dear sir,

I read your old post from below link and my problem solved.....

" Modbus TCP float to value - General - Node-RED Forum (nodered.org)"

Thank you very much for your support.