Modbus Control of Danfoss Variable Speed Drive

A flow to control a Danfoss Variable Speed Drive using modbus. This was tested on a Raspberry Pi with a USB serial adapter. The drive was a FC51 Microdrive but it should work with most Danfoss products. Thanks to Klaus Landsdorf for the excellent modbus node for Node Red

[{"id":"bb08cb06.8edf18","type":"modbus-write","z":"54aea192.13ecc","name":"Speed 50009","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"HoldingRegister","adr":"50009","quantity":"1","server":"9978294f.243928","x":876,"y":99,"wires":[[],[]]},{"id":"df06cef6.c552b","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"7300","payloadType":"num","repeat":"","crontab":"","once":false,"x":618,"y":112,"wires":[["bb08cb06.8edf18"]]},{"id":"742a430.a48bfbc","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"0","payloadType":"num","repeat":"","crontab":"","once":false,"x":615,"y":154,"wires":[["bb08cb06.8edf18"]]},{"id":"8140be56.89a9e","type":"modbus-write","z":"54aea192.13ecc","name":"Coasting 3","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"3","quantity":"1","server":"9978294f.243928","x":408,"y":145,"wires":[[],[]]},{"id":"8b72d28b.f2c81","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"x":81,"y":162,"wires":[["8140be56.89a9e"]]},{"id":"b8fd00d3.da23d","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":80,"y":244,"wires":[["8140be56.89a9e"]]},{"id":"2efadb5f.f63c64","type":"ui_slider","z":"54aea192.13ecc","name":"","label":"Speed Control","group":"acac51cc.816d","order":1,"width":0,"height":0,"passthru":true,"topic":"","min":0,"max":"100","step":"1","x":497,"y":42,"wires":[["f1d1df5c.f0b94","dba57916.c20648"]]},{"id":"f1d1df5c.f0b94","type":"ui_gauge","z":"54aea192.13ecc","name":"","group":"d786d8f6.a8b768","order":0,"width":0,"height":0,"gtype":"gage","title":"Speed %","label":"%","format":"{{value}}","min":0,"max":"100","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":735,"y":24,"wires":[]},{"id":"9ca05957.4ccd68","type":"modbus-write","z":"54aea192.13ecc","name":"Quick Stop Ramp 4","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"4","quantity":"1","server":"9978294f.243928","x":381,"y":330,"wires":[[],[]]},{"id":"fe88afd5.317d7","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"x":85,"y":287,"wires":[["9ca05957.4ccd68"]]},{"id":"698a983b.868d68","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":84,"y":370,"wires":[["9ca05957.4ccd68"]]},{"id":"8905f79d.42f978","type":"modbus-write","z":"54aea192.13ecc","name":"Freeze Ouput 5","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"5","quantity":"1","server":"9978294f.243928","x":324,"y":463,"wires":[[],[]]},{"id":"e1f37157.41c41","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":87,"y":413,"wires":[["8905f79d.42f978"]]},{"id":"2869b264.de79ee","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":80,"y":494,"wires":[["8905f79d.42f978"]]},{"id":"236e2c46.fbd144","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":80,"y":623,"wires":[["8b13130f.3c6d2"]]},{"id":"8b13130f.3c6d2","type":"modbus-write","z":"54aea192.13ecc","name":"Ramp Stop Start 6","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"6","quantity":"1","server":"9978294f.243928","x":332,"y":572,"wires":[[],[]]},{"id":"95d4d665.be3918","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":false,"x":88,"y":545,"wires":[["8b13130f.3c6d2"]]},{"id":"cbecebea.5371e8","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":91,"y":787,"wires":[["4ee06d74.c84c84"]]},{"id":"f552327b.1f486","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"x":84,"y":677,"wires":[["4ee06d74.c84c84"]]},{"id":"4ee06d74.c84c84","type":"modbus-write","z":"54aea192.13ecc","name":"Reset 7","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"7","quantity":"1","server":"9978294f.243928","x":258,"y":739,"wires":[[],[]]},{"id":"d85bf9ef.f09298","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"x":90,"y":26,"wires":[["1ddae5c8.55267a"]]},{"id":"99aabac3.2c1d98","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":78,"y":117,"wires":[["1ddae5c8.55267a"]]},{"id":"1ddae5c8.55267a","type":"modbus-write","z":"54aea192.13ecc","name":"DC Brake 2","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"2","quantity":"1","server":"9978294f.243928","x":449,"y":83,"wires":[[],[]]},{"id":"dd7b8d9e.f38b3","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"true","payloadType":"bool","repeat":"","crontab":"","once":true,"x":664,"y":736,"wires":[["da7a650c.12c268"]]},{"id":"3d03a8d0.1fa688","type":"inject","z":"54aea192.13ecc","name":"","topic":"","payload":"false","payloadType":"bool","repeat":"","crontab":"","once":false,"x":675,"y":780,"wires":[["da7a650c.12c268"]]},{"id":"da7a650c.12c268","type":"modbus-write","z":"54aea192.13ecc","name":"Data Valid 11","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"10","quantity":"1","server":"9978294f.243928","x":978,"y":744,"wires":[[],[]]},{"id":"dba57916.c20648","type":"range","z":"54aea192.13ecc","minin":"0","maxin":"100","minout":"0","maxout":"7300","action":"scale","round":true,"name":"","x":672,"y":70,"wires":[["bb08cb06.8edf18"]]},{"id":"e84cfec5.814a4","type":"modbus-read","z":"54aea192.13ecc","name":"Control Ready","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"33","quantity":"1","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9978294f.243928","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":398,"y":205,"wires":[["9e2faf9d.81a7f"],[]]},{"id":"4a94886c.31af48","type":"modbus-read","z":"54aea192.13ecc","name":"Unit Ready","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"34","quantity":"1","rate":"5","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9978294f.243928","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":415,"y":273,"wires":[["ff3ae484.1c9338"],[]]},{"id":"d62461ac.f029d","type":"modbus-read","z":"54aea192.13ecc","name":"Speed On Reference","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"40","quantity":"1","rate":"1","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9978294f.243928","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":335,"y":399,"wires":[["3cbdef51.1136f"],[]]},{"id":"af78b509.6e1d88","type":"modbus-read","z":"54aea192.13ecc","name":"Frequency","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"HoldingRegister","adr":"16129","quantity":"1","rate":"1","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9978294f.243928","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":395,"y":681,"wires":[["114191e8.e1dc8e"],[]]},{"id":"5233a65.2eb8358","type":"modbus-read","z":"54aea192.13ecc","name":"Hand Auto","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"41","quantity":"1","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9978294f.243928","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":411,"y":513,"wires":[["a1c04714.e7a008"],[]]},{"id":"d08b8335.93d37","type":"modbus-read","z":"54aea192.13ecc","name":"Running","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"Coil","adr":"43","quantity":"1","rate":"1","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9978294f.243928","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":396,"y":623,"wires":[["1d4ef095.e9044f"],[]]},{"id":"114191e8.e1dc8e","type":"function","z":"54aea192.13ecc","name":"","func":"msg.payload = msg.payload[0]/10;\nreturn msg;","outputs":1,"noerr":0,"x":586,"y":673,"wires":[["6d565568.4c779c"]]},{"id":"6d565568.4c779c","type":"ui_gauge","z":"54aea192.13ecc","name":"","group":"d786d8f6.a8b768","order":0,"width":0,"height":0,"gtype":"gage","title":"Frequency","label":"Hz","format":"{{value}}","min":0,"max":"50","colors":["#00b500","#e6e600","#ca3838"],"seg1":"","seg2":"","x":765,"y":673,"wires":[]},{"id":"2ece3bda.62f604","type":"change","z":"54aea192.13ecc","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"Running","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"Stopped","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":768,"y":617,"wires":[["41f62d69.e5d014"]]},{"id":"1d4ef095.e9044f","type":"function","z":"54aea192.13ecc","name":"","func":"msg.payload = msg.payload[0];\nreturn msg;","outputs":1,"noerr":0,"x":586,"y":618,"wires":[["2ece3bda.62f604"]]},{"id":"41f62d69.e5d014","type":"ui_text","z":"54aea192.13ecc","group":"d786d8f6.a8b768","order":0,"width":0,"height":0,"name":"","label":"Run Status","format":"{{msg.payload}}","layout":"row-spread","x":993,"y":620,"wires":[]},{"id":"a1c04714.e7a008","type":"function","z":"54aea192.13ecc","name":"","func":"msg.payload = msg.payload[0];\nreturn msg;","outputs":1,"noerr":0,"x":588,"y":509,"wires":[["4a082817.14da58"]]},{"id":"4a082817.14da58","type":"change","z":"54aea192.13ecc","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"Auto","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"Hand","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":785,"y":505,"wires":[["4aea279f.a2fc38"]]},{"id":"4aea279f.a2fc38","type":"ui_text","z":"54aea192.13ecc","group":"d786d8f6.a8b768","order":0,"width":0,"height":0,"name":"","label":"Hand / Auto","format":"{{msg.payload}}","layout":"row-spread","x":1002,"y":501,"wires":[]},{"id":"3cbdef51.1136f","type":"function","z":"54aea192.13ecc","name":"","func":"msg.payload = msg.payload[0];\nreturn msg;","outputs":1,"noerr":0,"x":594,"y":387,"wires":[["57e408f.dd2b4f8"]]},{"id":"57e408f.dd2b4f8","type":"change","z":"54aea192.13ecc","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"At Reference","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"Not at Reference","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":780,"y":385,"wires":[["128a4790.ec0d08"]]},{"id":"128a4790.ec0d08","type":"ui_text","z":"54aea192.13ecc","group":"d786d8f6.a8b768","order":0,"width":0,"height":0,"name":"","label":"Speed at Reference","format":"{{msg.payload}}","layout":"row-spread","x":1031,"y":386,"wires":[]},{"id":"d49be377.fe361","type":"ui_text","z":"54aea192.13ecc","group":"d786d8f6.a8b768","order":0,"width":0,"height":0,"name":"","label":"Unit Ready","format":"{{msg.payload}}","layout":"row-spread","x":1002,"y":304,"wires":[]},{"id":"11ab9675.17166a","type":"change","z":"54aea192.13ecc","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"Ready","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"Not Ready","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":775,"y":304,"wires":[["d49be377.fe361"]]},{"id":"ff3ae484.1c9338","type":"function","z":"54aea192.13ecc","name":"","func":"msg.payload = msg.payload[0];\nreturn msg;","outputs":1,"noerr":0,"x":587,"y":300,"wires":[["11ab9675.17166a"]]},{"id":"9e2faf9d.81a7f","type":"function","z":"54aea192.13ecc","name":"","func":"msg.payload = msg.payload[0];\nreturn msg;","outputs":1,"noerr":0,"x":592,"y":245,"wires":[["8935861d.54c008"]]},{"id":"8935861d.54c008","type":"change","z":"54aea192.13ecc","name":"","rules":[{"t":"change","p":"payload","pt":"msg","from":"true","fromt":"bool","to":"Ready","tot":"str"},{"t":"change","p":"payload","pt":"msg","from":"false","fromt":"bool","to":"Not Ready","tot":"str"}],"action":"","property":"","from":"","to":"","reg":false,"x":774,"y":258,"wires":[["18a25460.525c5c"]]},{"id":"18a25460.525c5c","type":"ui_text","z":"54aea192.13ecc","group":"d786d8f6.a8b768","order":0,"width":0,"height":0,"name":"","label":"Control Ready","format":"{{msg.payload}}","layout":"row-spread","x":1003,"y":257,"wires":[]},{"id":"40e5a558.14557c","type":"ui_switch","z":"54aea192.13ecc","name":"","label":"Ramp Start / Off","group":"acac51cc.816d","order":2,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":91,"y":581,"wires":[["8b13130f.3c6d2"]]},{"id":"9d3ee2a7.4cda8","type":"ui_switch","z":"54aea192.13ecc","name":"","label":"Freeze Output","group":"acac51cc.816d","order":3,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"false","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"true","offvalueType":"bool","officon":"","offcolor":"","x":89,"y":455,"wires":[["8905f79d.42f978"]]},{"id":"4ecd84f.6ec877c","type":"ui_button","z":"54aea192.13ecc","name":"","group":"acac51cc.816d","order":7,"width":0,"height":0,"passthru":false,"label":"Reset","color":"","bgcolor":"","icon":"","payload":"true","payloadType":"bool","topic":"","x":84,"y":730,"wires":[["4ee06d74.c84c84"]]},{"id":"feebaa1d.619cf8","type":"ui_switch","z":"54aea192.13ecc","name":"","label":"Quick Stop / Start","group":"acac51cc.816d","order":4,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":99,"y":329,"wires":[["9ca05957.4ccd68"]]},{"id":"c28e9ac5.970a98","type":"ui_switch","z":"54aea192.13ecc","name":"","label":"Coasting Stop / Start","group":"acac51cc.816d","order":5,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":113,"y":204,"wires":[["8140be56.89a9e"]]},{"id":"97984ae.4177cb8","type":"ui_switch","z":"54aea192.13ecc","name":"","label":"DC Brake Stop / Start","group":"acac51cc.816d","order":6,"width":0,"height":0,"passthru":true,"decouple":"false","topic":"","style":"","onvalue":"true","onvalueType":"bool","onicon":"","oncolor":"","offvalue":"false","offvalueType":"bool","officon":"","offcolor":"","x":115,"y":69,"wires":[["1ddae5c8.55267a"]]},{"id":"f7e412b1.2e026","type":"modbus-read","z":"54aea192.13ecc","name":"Status Word","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"HoldingRegister","adr":"16029","quantity":"1","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9978294f.243928","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":800,"y":161,"wires":[[],["74e6c4de.36148c"]]},{"id":"74e6c4de.36148c","type":"modbus-response","z":"54aea192.13ecc","name":"","registerShowMax":20,"x":1014,"y":157,"wires":[]},{"id":"f1938ee4.b928b","type":"modbus-read","z":"54aea192.13ecc","name":"Control Word","topic":"","showStatusActivities":false,"showErrors":false,"unitid":"","dataType":"HoldingRegister","adr":"15999","quantity":"1","rate":"2","rateUnit":"s","delayOnStart":false,"startDelayTime":"","server":"9978294f.243928","useIOFile":false,"ioFile":"","useIOForPayload":false,"x":783,"y":207,"wires":[[],["a153fd25.59b11"]]},{"id":"a153fd25.59b11","type":"modbus-response","z":"54aea192.13ecc","name":"","registerShowMax":20,"x":1022,"y":210,"wires":[]},{"id":"9978294f.243928","type":"modbus-client","z":"","name":"","clienttype":"serial","bufferCommands":true,"stateLogEnabled":false,"tcpHost":"127.0.0.1","tcpPort":"502","tcpType":"DEFAULT","serialPort":"/dev/ttyUSB0","serialType":"RTU","serialBaudrate":"9600","serialDatabits":"8","serialStopbits":"1","serialParity":"even","serialConnectionDelay":"100","unit_id":"2","commandDelay":"1","clientTimeout":"1000","reconnectTimeout":"2000"},{"id":"acac51cc.816d","type":"ui_group","z":"","name":"Drive Control","tab":"8f02dc16.bed06","disp":true,"width":"6","collapse":false},{"id":"d786d8f6.a8b768","type":"ui_group","z":"","name":"Drive Status","tab":"8f02dc16.bed06","disp":true,"width":"6","collapse":false},{"id":"8f02dc16.bed06","type":"ui_tab","z":"","name":"Home","icon":"dashboard"}]
mtoko

Flow Info

created 1 week, 2 days ago

Node Types

Core
  • change (x5)
  • function (x6)
  • inject (x16)
  • range (x1)
Other

Tags

  • Modbus
  • Danfoss
  • Inverter
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option