DMX

Node-REDからODE-MK2にsACNデータをおくりDMXのフェードインアウトをする

Node-REDからsACNで複数のODE-MK2に照明データをおくり、複数のDMX信号を送るフローを作成しました。

Node RED 2022 04 24 16 13 42

ODE-MK2の設定

ENTTEC ODE MK2 Web Control 2022 04 24 16 14 27

DHCPをdisableにして固定IP化。

Node=REDからはsACNで信号を送り、ODE-MK2からはDMXを送るという使い方です。

フェードの設定(ODE-MK2側)

ODE-MK2を使うと自由度は高いのですが、一般的なDMXコントローラーで簡単に使えるフェード機能は自分で実装する必要があります。

ENTTEC ODE MK2 Web Control 2022 04 24 16 16 45

ODE-MK2側で1秒間に何回のデータを送るのかのframerateは0〜44で設定できます。

今回は40に設定。

フェード・インの設定(Node-RED側)

Node RED 2022 04 24 16 18 38

Node-REDでのフェード機能は”Dim UP”というfunctionノードで作成しました。

Forループでデータを送っているのですが、この後のDelayノードに送るデータ msg.rateも設定しています。

Node RED 2022 04 24 16 20 11

というのも、sACNノードが即時にデータをおくってしまうので、Delayノードを使って流量制限をします。
その際、ms単位の流量制限は、msg.rateで送る必要があります。

フェード・アウト(Node-RED側)

Node RED 2022 04 24 16 22 40

フェード・インの後にフェード・アウトが実行されるよう、Delayノードを使っています。

Node RED 2022 04 24 16 23 35

Dim DOWNのfunctionノードはこのようにしました。

動作確認

複数の固定IPのODE-MK2に対し、フェード・インとフェード・アウトのDMX信号を送らせる実験は成功しました。

Node-REDのフロー

[{"id":"d3aa3a725d18cc90","type":"function","z":"33cec25c98c1517a","name":"Dim UP","func":"var frameRate = 40;\nvar fadeTime = 2;\nvar fadeStep = frameRate * fadeTime;\n\nvar dimLevel = 255;\nvar dmxValue;\n\n\nfor (let i = 1; i < fadeStep; i++) {\n  \n  dmxValue = parseInt(dimLevel/fadeStep*i);\n  \n  node.send({ \n      payload : [dmxValue,dmxValue, dmxValue],\n      rate : 25\n  })\n}\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":440,"y":120,"wires":[["aa497077c6ea94d3","19f3ba3b4e76cb93"]]},{"id":"e32e4ed9e12da195","type":"inject","z":"33cec25c98c1517a","name":"スタート","props":[{"p":"payload"},{"p":"topic","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"","payloadType":"date","x":160,"y":120,"wires":[["2048ad0b887ec3c4","d3aa3a725d18cc90"]]},{"id":"aa497077c6ea94d3","type":"debug","z":"33cec25c98c1517a","name":"","active":true,"tosidebar":true,"console":false,"tostatus":false,"complete":"false","statusVal":"","statusType":"auto","x":830,"y":80,"wires":[]},{"id":"5f79bcdfec058bfd","type":"inject","z":"33cec25c98c1517a","name":"","props":[{"p":"payload"},{"p":"rate","v":"10","vt":"num"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"200","payloadType":"num","x":170,"y":380,"wires":[["eb1cb008f3f3aef6"]]},{"id":"e3b011213ea85ae8","type":"sACN","z":"33cec25c98c1517a","server":"d6d1114f7179888f","universe":"1","channel":"","transition":"rate","transitionRate":"25","transitionTime":1000,"name":"Device1","x":800,"y":320,"wires":[]},{"id":"819e5ca6bae22815","type":"inject","z":"33cec25c98c1517a","name":"","props":[{"p":"payload"},{"p":"rate","v":"10","vt":"str"}],"repeat":"","crontab":"","once":false,"onceDelay":0.1,"topic":"","payload":"0","payloadType":"num","x":170,"y":420,"wires":[["9bd846a2a33c664f"]]},{"id":"eb1cb008f3f3aef6","type":"function","z":"33cec25c98c1517a","name":"","func":"var data = [200,200,200];\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":380,"wires":[["19f3ba3b4e76cb93"]]},{"id":"9bd846a2a33c664f","type":"function","z":"33cec25c98c1517a","name":"","func":"var data = [0,0,0];\n\nmsg.payload = data;\n\nreturn msg;","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":320,"y":420,"wires":[["19f3ba3b4e76cb93"]]},{"id":"21dd846971d23b02","type":"sACN","z":"33cec25c98c1517a","server":"c278eb7ccca240f2","universe":"1","channel":"","transition":"rate","transitionRate":"25","transitionTime":1000,"name":"Device2","x":800,"y":360,"wires":[]},{"id":"19f3ba3b4e76cb93","type":"delay","z":"33cec25c98c1517a","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"10","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":true,"outputs":1,"x":720,"y":200,"wires":[["e3b011213ea85ae8","21dd846971d23b02","55d351c8f83e69a9","1651ce489e68a369","9866a423ef83c524","10cccc3bcf25c95f"]]},{"id":"0d8dd7d0291052a9","type":"function","z":"33cec25c98c1517a","name":"Dim DOWN","func":"var frameRate = 40;\nvar fadeTime = 2;\nvar fadeStep = frameRate * fadeTime;\n\nvar dimLevel = 255;\nvar dmxValue;\n\nfor (let i = 1; i < fadeStep; i++) {\n  \n  dmxValue = parseInt(dimLevel/fadeStep*i);\n  dmxValue = dimLevel - dmxValue;\n  \n  if (i == fadeStep-1) \n    {\n        dmxValue =0; \n    }\n  node.send({ \n      payload : [dmxValue,dmxValue, dmxValue],\n      rate : 25\n  })\n}\n\n\n\n","outputs":1,"noerr":0,"initialize":"","finalize":"","libs":[],"x":450,"y":180,"wires":[["19f3ba3b4e76cb93","aa497077c6ea94d3"]]},{"id":"2048ad0b887ec3c4","type":"delay","z":"33cec25c98c1517a","name":"遅延スタート","pauseType":"delay","timeout":"3","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"allowrate":false,"outputs":1,"x":260,"y":180,"wires":[["0d8dd7d0291052a9"]]},{"id":"55d351c8f83e69a9","type":"sACN","z":"33cec25c98c1517a","server":"7c2a563f2fb3f834","universe":"1","channel":"","transition":"rate","transitionRate":"25","transitionTime":1000,"name":"Device3","x":800,"y":400,"wires":[]},{"id":"1651ce489e68a369","type":"sACN","z":"33cec25c98c1517a","server":"d4dabeb26947c89b","universe":"1","channel":"","transition":"rate","transitionRate":"25","transitionTime":1000,"name":"Device4","x":800,"y":440,"wires":[]},{"id":"9866a423ef83c524","type":"sACN","z":"33cec25c98c1517a","server":"77f0aa3517b3b196","universe":"1","channel":"","transition":"rate","transitionRate":"25","transitionTime":1000,"name":"Device5","x":800,"y":480,"wires":[]},{"id":"10cccc3bcf25c95f","type":"sACN","z":"33cec25c98c1517a","server":"d5660d3aee12d3fa","universe":"1","channel":"","transition":"rate","transitionRate":"25","transitionTime":1000,"name":"Device6","x":800,"y":520,"wires":[]},{"id":"a930cf4311e0f6c5","type":"comment","z":"33cec25c98c1517a","name":"TEST","info":"","x":150,"y":340,"wires":[]},{"id":"d6d1114f7179888f","type":"sacn-config","hostOrUniverse":"192.168.1.141","port":"5568"},{"id":"c278eb7ccca240f2","type":"sacn-config","hostOrUniverse":"192.168.1.142","port":"5568"},{"id":"7c2a563f2fb3f834","type":"sacn-config","hostOrUniverse":"192.168.1.143","port":"5568"},{"id":"d4dabeb26947c89b","type":"sacn-config","hostOrUniverse":"192.168.1.144","port":"5568"},{"id":"77f0aa3517b3b196","type":"sacn-config","hostOrUniverse":"192.168.1.145","port":"5568"},{"id":"d5660d3aee12d3fa","type":"sacn-config","hostOrUniverse":"192.168.1.146","port":"5568"}]
ABOUT ME
中畑 隆拓
スマートライト㈱ 代表取締役。IoTソリューションの開発、スマートホーム&オフィスのコンサルティング、DALI,KNX,EnOceanなどのインテグレーションを行っています。

COMMENT

メールアドレスが公開されることはありません。