Touch OSC – Node-red – Jinx

Posted on Updated on

This time, I am going to use my ipad to control Jinx (Matrix Led Controller) with the tools I have available.

No idea yet if it is the best solution!

The full idea: Ipad with touch OSC sends message to raspberry pi / node-red sends artnet control to Jinx running on an Intel Z3736F Win10 box.

  1. Raspberry
    1. Use latest Raspbian-Jessie
    2. install npm
      sudo apt-get install npm
    3. update npm
      sudo npm i -g npm@2.x
    4. install node-red-contrib-osc
      cd $HOME/.node-red
      npm install node-red-contrib-osc
  2. Copy the following flow to get started with Node-Red


[{"id":"53e93d80.8fa17c","type":"osc in","z":"a896c6ba.33dbc","name":"OSC Remote","addr":"127.0.0.1","port":"8888","x":99.5,"y":122.5,"wires":[["2e5a1f18.0780d"]]},{"id":"f004a737.24a56","type":"udp out","z":"a896c6ba.33dbc","name":"","addr":"192.168.1.115","iface":"","port":"6454","ipv":"udp4","outport":"","base64":false,"multicast":"false","x":1046.5,"y":473,"wires":[]},{"id":"433f44a5.73f2fc","type":"function","z":"a896c6ba.33dbc","name":"Set Master","func":"flow.set('master',Number((msg.payload).toFixed(0)));\nreturn msg;","outputs":1,"noerr":0,"x":555.5,"y":116.5,"wires":[["61ebd424.dcfb84"]]},{"id":"2e5a1f18.0780d","type":"switch","z":"a896c6ba.33dbc","name":"Route OSC Message","property":"topic","propertyType":"msg","rules":[{"t":"cont","v":"Master","vt":"str"},{"t":"cont","v":"Scene Left","vt":"str"},{"t":"cont","v":"Scene Right","vt":"str"}],"checkall":"true","outputs":3,"x":308.5,"y":131.5,"wires":[["433f44a5.73f2fc"],["36341715.745cc8"],["50eae3a9.f8f4f4"]]},{"id":"36341715.745cc8","type":"function","z":"a896c6ba.33dbc","name":"Set Scene Left","func":"msg.topic = msg.topic.replace(\"/1/Scene Left/\",\"\");\nmsg.payload = msg.topic;\nreturn msg;","outputs":1,"noerr":0,"x":545.5,"y":188.5,"wires":[["f1053883.2d8508"]]},{"id":"cb95dbe.5976228","type":"function","z":"a896c6ba.33dbc","name":"","func":"flow.set('scenel',(msg.payload.Row - 1) * 5 + msg.payload.Column);\n//msg.payload = (msg.payload.Row - 1) * 5 + msg.payload.Column;\nmsg.scene = flow.get('scenel');\nreturn msg;","outputs":1,"noerr":0,"x":888.5,"y":187.5,"wires":[["857d701.f184e9"]]},{"id":"4c3cd0aa.c150d8","type":"inject","z":"a896c6ba.33dbc","name":"reset","topic":"","payload":"Reset","payloadType":"str","repeat":"","crontab":"","once":true,"x":107.5,"y":49.5,"wires":[["3f12f8ae.c301f"]]},{"id":"4eee2b21.e740ec","type":"debug","z":"a896c6ba.33dbc","name":"Debug","active":true,"console":"false","complete":"payload","x":543.5,"y":47,"wires":[]},{"id":"3f12f8ae.c301f","type":"function","z":"a896c6ba.33dbc","name":"Rest General Variable","func":"// initialise data\nflow.set('scener',0);\nflow.set('scenel',0);\nflow.set('chase',1);\nflow.set('mode',1);\nflow.set('cross',1);\nflow.set('stobe',0);\nflow.set('master',0);\nreturn msg;\n","outputs":1,"noerr":0,"x":311,"y":48,"wires":[["4eee2b21.e740ec"]]},{"id":"61ebd424.dcfb84","type":"function","z":"a896c6ba.33dbc","name":"","func":"msg.payload = new Buffer([65, 114, 116, 45, 78, 101, 116, 0, 0, 80, 0, 14, 1, 0, 0, 0, 7,0,\nflow.get('scenel'), //scene left\nflow.get('scener'), //scene right\nflow.get('chase'), //chase select\nflow.get('mode'), //crossfade mode\nflow.get('cross'), //crossfade\nflow.get('strobe'), //strobe\nflow.get('master')]); //master\nreturn msg;","outputs":1,"noerr":0,"x":892,"y":115,"wires":[["dd06deed.949b98"]]},{"id":"f1053883.2d8508","type":"csv","z":"a896c6ba.33dbc","name":"","sep":"/","hdrin":"","hdrout":true,"multi":"one","ret":"\\n","temp":"Row,Column","x":733.5,"y":190.5,"wires":[["cb95dbe.5976228"]]},{"id":"50eae3a9.f8f4f4","type":"function","z":"a896c6ba.33dbc","name":"Set Scene Right","func":"msg.topic = msg.topic.replace(\"/1/Scene Right/\",\"\");\nmsg.payload = msg.topic;\nreturn msg;","outputs":1,"noerr":0,"x":544,"y":242,"wires":[["fce93063.7fdf9"]]},{"id":"fce93063.7fdf9","type":"csv","z":"a896c6ba.33dbc","name":"","sep":"/","hdrin":"","hdrout":true,"multi":"one","ret":"\\n","temp":"Row,Column","x":734,"y":243,"wires":[["e042d2ed.0a25f"]]},{"id":"e042d2ed.0a25f","type":"function","z":"a896c6ba.33dbc","name":"","func":"flow.set('scener',(msg.payload.Row - 1) * 5 + msg.payload.Column);\n//msg.payload = (msg.payload.Row - 1) * 5 + msg.payload.Column;\nmsg.scene = flow.get('scener');\nreturn msg;","outputs":1,"noerr":0,"x":891,"y":240,"wires":[["857d701.f184e9"]]},{"id":"f06b7e55.e9286","type":"function","z":"a896c6ba.33dbc","name":"","func":"msg.payload = new Buffer([65, 114, 116, 45, 78, 101, 116, 0, 0, 80, 0, 14, 1, 0, 0, 0, 7,0,\nflow.get('scenel'), //scene left\nflow.get('scener'), //scene right\nflow.get('chase'), //chase select\nflow.get('mode'), //crossfade mode\nflow.get('cross'), //crossfade\nflow.get('strobe'), //strobe\nflow.get('master')]); //master\nreturn msg;","outputs":1,"noerr":0,"x":1019,"y":379,"wires":[["f004a737.24a56"]]},{"id":"dd06deed.949b98","type":"delay","z":"a896c6ba.33dbc","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":true,"x":1070.5,"y":114.5,"wires":[["f06b7e55.e9286"]]},{"id":"857d701.f184e9","type":"delay","z":"a896c6ba.33dbc","name":"","pauseType":"queue","timeout":"5","timeoutUnits":"seconds","rate":"1","rateUnits":"second","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":1077.5,"y":204.5,"wires":[["f06b7e55.e9286"]]}]

  1. Jinx setting
    1. enable remote control in Setup/Remote Control
    2. set to Art-Net
    3. Don’t change the default addressing
  2. Touch OSC interface design
    1. Download Jinx_remote
    2. Rename the downlaoaded file to jinx_remote.touchosc (got problem to uplaod the file)

Test

 

It is basically working except a bug sometime when sending too many command. I added some delay in the flow in order to limit them.
If anyone has any idea or better solution please let me know.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s