Skip to content

Instantly share code, notes, and snippets.

@SankariNL
Last active November 18, 2021 07:54
Show Gist options
  • Save SankariNL/32f5f77bf01728bb135d73c948fecb54 to your computer and use it in GitHub Desktop.
Save SankariNL/32f5f77bf01728bb135d73c948fecb54 to your computer and use it in GitHub Desktop.
Turck IM18-CCM50 Modbus read

This flow polls a modbus-read node to read out the temperature of a Banner QM30VT2 sensor connect via modbus RTU to a Turck IM18-CCM50. This flow polls the temperature register every 30 seconds (this can be changed after importing) and converts the temperature register to a JSON object.

VibrationSensor_read-flow

[
{
"id": "7adfcca41334b23a",
"type": "tab",
"label": "VibrationSensor_Read",
"disabled": false,
"info": ""
},
{
"id": "516658eaeb338f3c",
"type": "debug",
"z": "7adfcca41334b23a",
"name": "",
"active": true,
"tosidebar": true,
"console": false,
"tostatus": false,
"complete": "payload",
"targetType": "msg",
"statusVal": "",
"statusType": "auto",
"x": 890,
"y": 200,
"wires": []
},
{
"id": "2461d2b4c0a66a0d",
"type": "function",
"z": "7adfcca41334b23a",
"name": "",
"func": "var temperature = msg.responseBuffer.data[0];\ntemperature = temperature/100;\n//delete msg.payload;\nmsg = {};\nmsg.timestamp = new Date().valueOf();\nmsg.payload = {};\n// Use parseFloat to convert string to float\nmsg.payload.temperature = temperature;\nreturn msg;",
"outputs": 1,
"noerr": 0,
"initialize": "",
"finalize": "",
"libs": [],
"x": 660,
"y": 200,
"wires": [
[
"516658eaeb338f3c"
]
]
},
{
"id": "ca36aa3f826d5f51",
"type": "modbus-read",
"z": "7adfcca41334b23a",
"name": "",
"topic": "",
"showStatusActivities": false,
"logIOActivities": false,
"showErrors": false,
"unitid": "",
"dataType": "HoldingRegister",
"adr": "5203",
"quantity": "1",
"rate": "30",
"rateUnit": "s",
"delayOnStart": true,
"startDelayTime": "10",
"server": "2a6c230d1b558f62",
"useIOFile": false,
"ioFile": "",
"useIOForPayload": false,
"emptyMsgOnFail": false,
"x": 430,
"y": 200,
"wires": [
[
"2461d2b4c0a66a0d"
],
[]
]
},
{
"id": "2a6c230d1b558f62",
"type": "modbus-client",
"name": "",
"clienttype": "serial",
"bufferCommands": true,
"stateLogEnabled": false,
"queueLogEnabled": false,
"tcpHost": "127.0.0.1",
"tcpPort": "502",
"tcpType": "DEFAULT",
"serialPort": "/dev/ttyO1",
"serialType": "RTU-BUFFERD",
"serialBaudrate": "19200",
"serialDatabits": "8",
"serialStopbits": "1",
"serialParity": "none",
"serialConnectionDelay": "100",
"unit_id": "1",
"commandDelay": "1",
"clientTimeout": "1000",
"reconnectOnTimeout": true,
"reconnectTimeout": "2000",
"parallelUnitIdsAllowed": true
}
]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment