Pimoroni Blinkt Dashboard

Control a Pimoroni Blinkt via a browser based dashboard

Note this has only been tested on a Pi running the full Raspian OS. I will try it on a Pi ZeroW with minimal Raspian install soon.

Control individual LEDs and the Blinkt strip as a whole via a node-red web dashboard eg.

screenshot 1

Installation

This got me a couple of times so thought it woud be good to explain exactly what I did to get this working. There is a blinkt node for node-red but it's not available via the Manage Pallet option in node-red or indeed via the normal npm install process. The Blinkt node is part of a bundle of nodes made by Pimoroni and available on github. To avoid errors in node-red you have to install all the Phython libraries for all the Pimoroni devices in the bundle and then install the bundle.

Method 1

With Full Raspian OS

Install all the python libraries for the devices included in the Pimoroni node-red nodes bundle (Blinkt, ExplorerHat, Flotilla and UnicornHat)

This can be done individually or via the excellent installer that Pimoroni supplies (not sure if this will work on a minimal Raspbian install currently).

Using the installer

Install the installer

sudo apt-get install pimoroni

Then type pimoroni-dashboard at the command line and install

  • Blinkt
  • ExplorerHat
  • Flotilla
  • UnicornHat

Installing Individually

Install Blinkt Python library more info

curl https://get.pimoroni.com/blinkt | bash

Install UnicornHat Phython Library more info

\curl -sS https://get.pimoroni.com/unicornhat | bash

Install ExplorerHat Phython library more info

curl https://get.pimoroni.com/explorerhat | bash

Install Flotilla Python library more info

curl -sS https://get.pimoroni.com/flotilla | bash

Follow the instructions here to install the Pimoroni node-red nodes here

Start node-red and you should see a pimoroni section in the node menu

Pimoroni nodes

Now add the node-red-dashboard nodes via the Manage Pallet menu and import the flow below.

The dashboard is available at http://[yourIpAddress]:1880/ui

Method 2

With Minimal Raspian OS

Instuctions to follow

Screenshots

screenshot 1

screenshot 2

Flow

Coming soon... some fancy automated effects - and, as I work for IBM, some flows using IBM Watson APIs, and some twittery stuff probably!

[{"id":"201e3c32.d9504c","type":"tab","label":"Pimoroni Blinkt Dashboard"},{"id":"d4b6ca93.386808","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"Colour","group":"75f55a15.b3d9d4","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"colour","x":267.5,"y":346,"wires":[["78185c68.786f94"]]},{"id":"9a938401.d970b","type":"ui_slider","z":"201e3c32.d9504c","name":"","label":"Number of LEDs","group":"75f55a15.b3d9d4","order":0,"width":0,"height":0,"passthru":true,"topic":"numberOfLEDs","min":0,"max":"8","step":1,"x":237.5,"y":400,"wires":[["78185c68.786f94"]]},{"id":"78185c68.786f94","type":"function","z":"201e3c32.d9504c","name":"Process dashboard input","func":"//set the flow variables if colour or numberOfLEDs change\nif (msg.topic == \"numberOfLEDs\"){\n    flow.set(\"numberOfLEDs\", msg.payload);\n}\n\nif (msg.topic == \"colour\"){\n    var colour = msg.payload;\n    colour = colour.replace('rgb(', '');\n    colour = colour.replace(')', '');\n    flow.set(\"colour\", colour);\n}\n\n//set all LEDs to off just before we set them to what we have specified\nfor(var i = 0; i < 8; i++) {\n    msg.topic = \"pixel.\" + i;\n    msg.payload = \"0,0,0\";\n    node.send(msg);\n}\n    \n//set the LED colours \nfor(var i = 0; i < flow.get(\"numberOfLEDs\"); i++) {\n    msg.topic = \"pixel.\" + i;\n    msg.payload = flow.get(\"colour\");\n    node.send(msg);\n}\n\n\n\n\n\n\n","outputs":1,"noerr":0,"x":509.5,"y":369,"wires":[["ba9f491f.101b7","84528ac3.7d3cc8"]]},{"id":"ba9f491f.101b7","type":"debug","z":"201e3c32.d9504c","name":"Debug","active":true,"console":"false","complete":"true","x":797.5,"y":289,"wires":[]},{"id":"84528ac3.7d3cc8","type":"rpi-blinkt out","z":"201e3c32.d9504c","name":"","x":797.5,"y":369,"wires":[]},{"id":"4bba6a5c.d1488c","type":"function","z":"201e3c32.d9504c","name":"initiate flow variables","func":"flow.set(\"numberOfLEDs\", \"0\");\nflow.set(\"colour\", \"255,255,255\");\nreturn msg;","outputs":1,"noerr":0,"x":407.5,"y":215,"wires":[[]]},{"id":"c2b86ad9.ac646","type":"inject","z":"201e3c32.d9504c","name":"","topic":"","payload":"start","payloadType":"str","repeat":"","crontab":"","once":true,"x":194.5,"y":215,"wires":[["4bba6a5c.d1488c"]]},{"id":"f5fac3ab.3300e8","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"LED0","group":"34d3541f.fbe15c","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"pixel.0","x":268,"y":516,"wires":[["8dcbb20a.a6d348"]]},{"id":"8dcbb20a.a6d348","type":"function","z":"201e3c32.d9504c","name":"Process colour value","func":"var colour = msg.payload;\ncolour = colour.replace('rgb(', '');\ncolour = colour.replace(')', '');\nmsg.payload =  colour;\nreturn msg;\n\n\n\n\n","outputs":1,"noerr":0,"x":504,"y":517,"wires":[["84528ac3.7d3cc8"]]},{"id":"b07d455c.026448","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"LED1","group":"34d3541f.fbe15c","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"pixel.1","x":267,"y":560,"wires":[["8dcbb20a.a6d348"]]},{"id":"b4422ff9.1a29b8","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"LED2","group":"34d3541f.fbe15c","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"pixel.2","x":266,"y":605,"wires":[["8dcbb20a.a6d348"]]},{"id":"e91f886c.b0a268","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"LED3","group":"34d3541f.fbe15c","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"pixel.3","x":268,"y":651,"wires":[["8dcbb20a.a6d348"]]},{"id":"f55b044b.edadb8","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"LED4","group":"34d3541f.fbe15c","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"pixel.4","x":267,"y":695,"wires":[["8dcbb20a.a6d348"]]},{"id":"613b9a47.e319cc","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"LED5","group":"34d3541f.fbe15c","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"pixel.5","x":266,"y":740,"wires":[["8dcbb20a.a6d348"]]},{"id":"f373d48a.090b","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"LED6","group":"34d3541f.fbe15c","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"pixel.6","x":268,"y":784,"wires":[["8dcbb20a.a6d348"]]},{"id":"61664af4.f7c08c","type":"ui_colour_picker","z":"201e3c32.d9504c","name":"","label":"LED7","group":"34d3541f.fbe15c","format":"rgb","outformat":"string","showSwatch":false,"showPicker":true,"showValue":false,"showAlpha":false,"showLightness":false,"order":0,"width":0,"height":0,"passthru":true,"topic":"pixel.7","x":267,"y":829,"wires":[["8dcbb20a.a6d348"]]},{"id":"8229cf49.c2bbc8","type":"comment","z":"201e3c32.d9504c","name":"Individual LED Dashboard Page","info":"","x":189.5,"y":475,"wires":[]},{"id":"883e9dbe.cbd5","type":"comment","z":"201e3c32.d9504c","name":"Group LED Dashboard Page","info":"","x":197,"y":303,"wires":[]},{"id":"7453aa25.4c69ac","type":"random","z":"201e3c32.d9504c","name":"Random LED","low":"0","high":"7","inte":"true","x":357.2142868041992,"y":1088.4286050796509,"wires":[["c054f20a.3a3928"]]},{"id":"38cacb80.30738c","type":"random","z":"201e3c32.d9504c","name":"Random Red value","low":"1","high":"255","inte":"true","x":568.9285125732422,"y":1157.4286088943481,"wires":[["464fb961.8c7b"]]},{"id":"1e67e467.be457c","type":"random","z":"201e3c32.d9504c","name":"Random Green value","low":"1","high":"255","inte":"true","x":579.8571014404297,"y":1211.4285888671875,"wires":[["4c68bf6f.1053c8"]]},{"id":"8f437afb.54e8b8","type":"random","z":"201e3c32.d9504c","name":"Random Blue value","low":"1","high":"255","inte":"true","x":572.8571014404297,"y":1255.4285888671875,"wires":[["20947175.ea0dfe"]]},{"id":"3d1c8095.6ab7d8","type":"debug","z":"201e3c32.d9504c","name":"","active":true,"console":"false","complete":"true","x":922.2142524719238,"y":1301.0000476837158,"wires":[]},{"id":"c054f20a.3a3928","type":"function","z":"201e3c32.d9504c","name":"set topic","func":"msg.topic = \"pixel.\" + msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":351.3571014404297,"y":1158.4285888671875,"wires":[["38cacb80.30738c"]]},{"id":"464fb961.8c7b","type":"function","z":"201e3c32.d9504c","name":"set Red value","func":"msg.red = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":375.8571014404297,"y":1211.4285888671875,"wires":[["1e67e467.be457c"]]},{"id":"4c68bf6f.1053c8","type":"function","z":"201e3c32.d9504c","name":"set Green value","func":"msg.green = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":377.8571014404297,"y":1257.4285888671875,"wires":[["8f437afb.54e8b8"]]},{"id":"20947175.ea0dfe","type":"function","z":"201e3c32.d9504c","name":"set Blue value","func":"msg.blue = msg.payload;\nreturn msg;","outputs":1,"noerr":0,"x":378.8571014404297,"y":1302.4285888671875,"wires":[["6565c17c.958d"]]},{"id":"6565c17c.958d","type":"function","z":"201e3c32.d9504c","name":"Assemble Blink input","func":"msg.payload = msg.red + \",\" + msg.green + \",\" + msg.blue;\nreturn msg;","outputs":1,"noerr":0,"x":651.4999542236328,"y":1302.0001392364502,"wires":[["3d1c8095.6ab7d8","84528ac3.7d3cc8"]]},{"id":"b61597f7.57425","type":"ui_button","z":"201e3c32.d9504c","name":"","group":"75f55a15.b3d9d4","order":0,"width":0,"height":0,"passthru":false,"label":"Random Colours","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":305.00000762939453,"y":964.2857546806335,"wires":[["c8ea8b9d.d71088"]]},{"id":"c8ea8b9d.d71088","type":"looptimer","z":"201e3c32.d9504c","duration":"0.2","units":"Second","maxloops":"18000","maxtimeout":"1","maxtimeoutunits":"Hour","name":"","x":529.2857208251953,"y":978.571430683136,"wires":[["7453aa25.4c69ac"],[]]},{"id":"746de15.2cb342","type":"ui_button","z":"201e3c32.d9504c","name":"","group":"75f55a15.b3d9d4","order":0,"width":0,"height":0,"passthru":false,"label":"Stop Random Colours","color":"","bgcolor":"","icon":"","payload":"stop","payloadType":"str","topic":"","x":314.2857131958008,"y":1005.7143340110779,"wires":[["c8ea8b9d.d71088"]]},{"id":"89100bf8.14dee","type":"ui_button","z":"201e3c32.d9504c","name":"","group":"75f55a15.b3d9d4","order":0,"width":0,"height":0,"passthru":false,"label":"Clear","color":"","bgcolor":"","icon":"","payload":"1","payloadType":"num","topic":"","x":264.28570556640625,"y":911.4285888671875,"wires":[["ddff5b30.20cc18"]]},{"id":"ddff5b30.20cc18","type":"function","z":"201e3c32.d9504c","name":"set all to 0","func":"//set all LEDs to off\nfor(var i = 0; i < 8; i++) {\n    msg.topic = \"pixel.\" + i;\n    msg.payload = \"0,0,0\";\n    node.send(msg);\n}\n","outputs":1,"noerr":0,"x":494.99999999999994,"y":912.8571428571428,"wires":[["84528ac3.7d3cc8"]]},{"id":"75f55a15.b3d9d4","type":"ui_group","z":"","name":"Home","tab":"9e2b213.c2a65e","disp":false,"width":"6"},{"id":"34d3541f.fbe15c","type":"ui_group","z":"","name":"IndividualLEDs","tab":"1ab2d177.79c797","disp":false,"width":"6"},{"id":"9e2b213.c2a65e","type":"ui_tab","z":"","name":"Home","icon":"dashboard"},{"id":"1ab2d177.79c797","type":"ui_tab","z":"","name":"Individual LEDs","icon":"dashboard"}]
tim-minter

Flow Info

created 3 months ago

Node Types

Core
  • comment (x2)
  • debug (x2)
  • function (x9)
  • inject (x1)
Other
  • looptimer (x1)
  • random (x4)
  • rpi-blinkt out (x1)
  • tab (x1)
  • ui_button (x3)
  • ui_colour_picker (x9)
  • ui_group (x2)
  • ui_slider (x1)
  • ui_tab (x2)

Tags

  • pimoroni
  • blinkt
  • dashboard
  • led
Copy this flow JSON to your clipboard and then import into Node-RED using the Import From > Clipboard (Ctrl-I) menu option