Walabot 3D imaging flow

Flow that connects the Walabot 3D imaging sensor to Node-red using this python TCP connector. https://github.com/rondagdag/smart3DSensorForAlexa

Project documentation can be found here. https://www.hackster.io/dfw-hackster/alexa-are-the-kids-up-0f0852

[{"id":"8fea91b1.216db8","type":"tab","label":"Flow 11","disabled":false,"info":""},{"id":"ecb32bcb.54f25","type":"tcp in","z":"8fea91b1.216db8","name":"","server":"client","host":"localhost","port":"1891","datamode":"stream","datatype":"buffer","newline":"","topic":"","base64":false,"x":124.26666259765625,"y":124.26667022705078,"wires":[["c8818ed0.a7b09"]]},{"id":"c8818ed0.a7b09","type":"function","z":"8fea91b1.216db8","name":"Convert to json array","func":"raw = msg.payload.toString('UTF-8')\nj = JSON.parse(raw);\nvar msg1 = { payload: raw };\nvar msg2 = { payload: j };\n\n\nif (raw.length > 20)\n{\n    X = msg2.payload.targets[0].x;\n    Y = msg2.payload.targets[0].y;\n    Z = msg2.payload.targets[0].z;\n    global.set(\"X\", X);\n    global.set(\"Y\", Y);\n    global.set(\"Z\", Z);\n    \n    var msg3 = { payload: X };\n    var msg4 = { payload: Y };\n    var msg5 = { payload: Z };   \n  \n    \n    //construct and format a date timestamp from now()\n    d = new Date(),\n    dformat = [d.getMonth()+1,\n    d.getDate(),\n    d.getFullYear()].join('/')+' '+\n    [d.getHours(),\n    d.getMinutes(),\n    d.getSeconds()].join(':');\n    \n    global.set(\"LastUpdate\", dformat)\n    var msg6 = { payload: 1 }; \n}\n\nreturn [  msg1, msg2, msg3, msg4, msg5, msg6];  \n\n","outputs":"6","noerr":0,"x":356.26666259765625,"y":124.26666259765625,"wires":[["857cfa69.a777c"],["e56d08c0.ce3ec"],["9e92be0d.f23c68"],["edcf019e.0e1bf"],["686cb61e.27443"],["373f1ba9.a7d9bc"]]},{"id":"857cfa69.a777c","type":"debug","z":"8fea91b1.216db8","name":"Raw String","active":false,"console":"false","complete":"payload","x":605.2666625976562,"y":44.26667022705078,"wires":[]},{"id":"686cb61e.27443","type":"debug","z":"8fea91b1.216db8","name":"Z","active":false,"console":"false","complete":"payload","x":621.2666625976562,"y":191.26667022705078,"wires":[]},{"id":"edcf019e.0e1bf","type":"debug","z":"8fea91b1.216db8","name":"Y","active":false,"console":"false","complete":"payload","x":621.2666625976562,"y":156.26667022705078,"wires":[]},{"id":"9e92be0d.f23c68","type":"debug","z":"8fea91b1.216db8","name":"X","active":false,"console":"false","complete":"payload","x":621.2666625976562,"y":120.26667022705078,"wires":[]},{"id":"e56d08c0.ce3ec","type":"debug","z":"8fea91b1.216db8","name":"JSON Array","active":false,"console":"false","complete":"payload","x":602.2666625976562,"y":83.26667022705078,"wires":[]},{"id":"4157ae58.501218","type":"inject","z":"8fea91b1.216db8","name":"Print saved XYZ","topic":"","payload":"on","payloadType":"str","repeat":"","crontab":"","once":false,"x":166.26666259765625,"y":206.2666778564453,"wires":[["fabc32bf.e5502"]]},{"id":"fabc32bf.e5502","type":"function","z":"8fea91b1.216db8","name":"","func":"var X = global.get(\"X\");\nvar Y = global.get(\"Y\");\nvar Z = global.get(\"Z\");\n\nstr = \"X=\" + X + \"  Y=\" + Y + \"  Z=\" + Z\nmsg.payload = str\nreturn msg;  \n\n","outputs":1,"noerr":0,"x":318.26666259765625,"y":204.2666778564453,"wires":[["83db8b16.1daa88"]]},{"id":"83db8b16.1daa88","type":"debug","z":"8fea91b1.216db8","name":"","active":true,"console":"false","complete":"false","x":466.26666259765625,"y":204.2666778564453,"wires":[]},{"id":"e90ea080.fdd2a8","type":"comment","z":"8fea91b1.216db8","name":"Get and save Walabot object data","info":"","x":174.26666259765625,"y":64.26667022705078,"wires":[]},{"id":"a2068196.f4ebe8","type":"mqtt in","z":"8fea91b1.216db8","name":"Adafruit","topic":"fileark/f/watsoncmd","qos":"0","broker":"babd9a3a.c99d78","x":141.26666259765625,"y":333.6666259765625,"wires":[["4360a6b3.5e8d58","5d4aae72.ab77a8"]]},{"id":"5d4aae72.ab77a8","type":"debug","z":"8fea91b1.216db8","name":"Debug","active":true,"console":"false","complete":"payload","x":516.2666625976562,"y":333.6666259765625,"wires":[]},{"id":"e9ec5314.3dce78","type":"mqtt out","z":"8fea91b1.216db8","name":"LocalHiveMQ","topic":"","qos":"0","retain":"false","broker":"36d4fded.c62852","x":561.3566284179688,"y":416.046630859375,"wires":[]},{"id":"4360a6b3.5e8d58","type":"function","z":"8fea91b1.216db8","name":"Forward Messages","func":"if (msg.payload == 1)  {\n   return {topic:'ArduinoIn/',payload:'Alarm'}; } \n ","outputs":1,"noerr":0,"x":338.26666259765625,"y":367.6666564941406,"wires":[["5d4aae72.ab77a8","e9ec5314.3dce78"]]},{"id":"e50b66e3.45f608","type":"mqtt out","z":"8fea91b1.216db8","name":"","topic":"fileark/f/watsonlink","qos":"","retain":"","broker":"babd9a3a.c99d78","x":580.5,"y":261.7333679199219,"wires":[]},{"id":"373f1ba9.a7d9bc","type":"delay","z":"8fea91b1.216db8","name":"","pauseType":"rate","timeout":"5","timeoutUnits":"seconds","rate":"1","nbRateUnits":"1","rateUnits":"minute","randomFirst":"1","randomLast":"5","randomUnits":"seconds","drop":false,"x":356.5,"y":262.566650390625,"wires":[["e50b66e3.45f608"]]},{"id":"daa0c567.b56c98","type":"inject","z":"8fea91b1.216db8","name":"Set date now","topic":"","payload":"1","payloadType":"num","repeat":"","crontab":"","once":false,"x":145.26666259765625,"y":260.6000061035156,"wires":[["e50b66e3.45f608"]]},{"id":"babd9a3a.c99d78","type":"mqtt-broker","z":"","broker":"io.adafruit.com","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"15","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""},{"id":"36d4fded.c62852","type":"mqtt-broker","z":"","broker":"10.100.100.180","port":"1883","clientid":"","usetls":false,"compatmode":true,"keepalive":"60","cleansession":true,"willTopic":"","willQos":"0","willPayload":"","birthTopic":"","birthQos":"0","birthPayload":""}]
ElectronHacks

Flow Info

created 10 months, 1 week ago

Node Types

Core
  • comment (x1)
  • debug (x7)
  • delay (x1)
  • function (x3)
  • inject (x2)
  • mqtt in (x1)
  • mqtt out (x2)
  • mqtt-broker (x2)
  • tcp in (x1)
Other
  • tab (x1)

Tags

  • Walabot
  • tutorial
  • 3d
  • imaging
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option