IU Predict for Motors - rotation speed
IU Predict for Motors - rotation speed
This flow extract data from the IFM rotation speed sensor (di5031) for IU Predict for motors:
- Extract regularly (every few seconds or minutes) rotation speed.
Data is then send to InUse MQTT Broker.
How to use it?
First you need to set up the following variables:
- In the
inject
node:- Choose the topic to send rotation speec data to InUse MQTT Broker
- Use the correct IOLink port (by default on
port[2]
)
- In
fetch rotation_speed data
:- Update the IO link master IP address
[{"id":"b54b7071f17eae6b","type":"tab","label":"iupm_speed","disabled":false,"info":"# IU Predict for Motors - rotation speed\n\nThis flow extract data from the IFM rotation speed sensor (di5031) for [IU Predict for motors](https://inuse.eu/iu-predict-predictive-maintenance/):\n- Extract regularly (every few seconds or minutes) rotation speed.\n\nData is then send to InUse MQTT Broker.\n\n# How to use it?\nFirst you need to set up the following variables:\n- In the `inject` node:\n - Choose the topic to send rotation speec data to InUse MQTT Broker\n - Use the correct IOLink port (by default on `port[2]`)\n- In `fetch rotation_speed data`:\n - Update the IO link master IP address\n","env":[]},{"id":"53c13269f50b0e76","type":"debug","z":"b54b7071f17eae6b","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"true","targetType":"full","statusVal":"","statusType":"auto","x":830,"y":40,"wires":[]},{"id":"1c56eee212203eb4","type":"inject","z":"b54b7071f17eae6b","name":"30 seconds","props":[{"p":"ts","v":"","vt":"date"},{"p":"topic","vt":"str"},{"p":"payload"}],"repeat":"30","crontab":"","once":false,"onceDelay":0.1,"topic":"my_producer_code/my_site_code/my_machine_code/di5031/X02/data","payload":"{\"code\":\"request\",\"cid\":4,\"adr\":\"/iolinkmaster/port[2]/iolinkdevice/pdin/getdata\"}","payloadType":"json","x":130,"y":120,"wires":[["81a79880649c1d90"]]},{"id":"81a79880649c1d90","type":"http request","z":"b54b7071f17eae6b","name":"fetch rotation_speed data","method":"POST","ret":"obj","paytoqs":"ignore","url":"192.168.0.10","tls":"","persist":false,"proxy":"","authType":"","senderr":false,"x":350,"y":120,"wires":[["dadb91363c07f023"]]},{"id":"b1a633b2634920a9","type":"mqtt out","z":"b54b7071f17eae6b","name":"","topic":"","qos":"0","retain":"false","respTopic":"","contentType":"","userProps":"","correl":"","expiry":"","broker":"2708e9b5c016f96f","x":990,"y":120,"wires":[]},{"id":"a0c006928c16ac0b","type":"queue","z":"b54b7071f17eae6b","name":"queue","connected":"^connected","connectedType":"re","disconnected":"","disconnectedType":"re","sqlite":"db_iupm_speed.sqlite","x":830,"y":120,"wires":[["b1a633b2634920a9"]]},{"id":"dadb91363c07f023","type":"function","z":"b54b7071f17eae6b","name":"process rotation speed","func":"// status speed on last hex\nvar statusSpeed = msg.payload.data.value.slice(-1);\n//convert to binary\nvar base2 = parseInt(statusSpeed, 16).toString(2).padStart(4, '0');\n\nmsg.payload = {\n ts: new Date(msg.ts).toISOString(),\n data: {\n rotation_speed: parseInt(\"0x\" + msg.payload.data.value.slice(0, 4)),\n di503_status: parseInt(\"0x\" + msg.payload.data.value[6]),\n di503_target: !!parseInt(base2[1]),//conversion to boolean\n di503_ssc2: !!parseInt(base2[2]),//conversion to boolean\n di503_ssc1: !!parseInt(base2[3]),//conversion to boolean\n } \n}\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":590,"y":120,"wires":[["a0c006928c16ac0b","53c13269f50b0e76"]],"info":"## DI5031\nThis node extact the Vitesse, Status of the sensor, and 3 Boolean. form the sensor DI5031\n\n- sensor type: [IFM DI5031](https://www.ifm.com/fr/fr/product/DI5031)\n - [iolink interface doc](https://www.ifm.com/download/files/ifm-DI5031-20171023-IODD11-fr/$file/ifm-DI5031-20171023-IODD11-fr.pdf) "},{"id":"32c611f54f2b1217","type":"status","z":"b54b7071f17eae6b","name":"","scope":["b1a633b2634920a9"],"x":670,"y":240,"wires":[["a0c006928c16ac0b"]]},{"id":"2708e9b5c016f96f","type":"mqtt-broker","name":"InUse MQTT Broker","broker":"mqtts://mycompany.mqtt.productinuse.com","port":"1883","tls":"273daffe.81304","clientid":"my_company_node_red_1","autoConnect":true,"usetls":true,"protocolVersion":"4","keepalive":"60","cleansession":true,"birthTopic":"","birthQos":"0","birthPayload":"","birthMsg":{},"closeTopic":"","closeQos":"0","closePayload":"","closeMsg":{},"willTopic":"","willQos":"0","willPayload":"","willMsg":{},"sessionExpiry":""},{"id":"273daffe.81304","type":"tls-config","name":"","cert":"","key":"","ca":"","certname":"","keyname":"","caname":"inuse.cer","servername":"","verifyservercert":false,"alpnprotocol":""}]