Blinkt and Node-Red


#1

Is there any chance of you providing a Node-Red interface for Blinkt?

I would like to be able to light up or flash individual Blinkt leds from Node-Red to indicate when MQTT messages are received.


#2

Probably not directly from us- since I’d have to spend some time learning about Node-Red, NodeJS, etc before even attempting such a feat -although we’d encourage any community effort to develop such an interface!

I shouldn’t imagine anyone experienced in Node will have a problem doing so, in Python the whole Blinkt library is 67 lines (relying upon RPi.GPIO for the GPIO back-end)- https://github.com/pimoroni/blinkt/blob/master/library/blinkt.py


#3

Couldn’t someone look at it whilst doing the Flotilla - Node Red work?


#4

Time spent learning node.js and node-red would not be wasted!

I bought this because you say"we developed these boards …to use as status indicators…
Each pixel is individually controllable"

I interpreted that as meaning I could use each pixel independently to indicate different events/statuses. Clearly the hardware is capable of that since I can make flashy rainbow effects with the example programs.

If I run two python scripts simultaneously addressing the Blinkt it does not work well. So I assume that what I need is a single controller program into which I can feed messages such as “LED#, r, g, b”.
That could be python, javascript, bash, whatever. But it’s beyond my programming skills.

If you don’t want to learn node.js, how about another python example to do this?
If the script accepted MQTT messages it would be trivial to send them from Node-red or many other devices.


#5

Node Red actually works admirably well with the Flotilla websocket daemon and a bit of glue code, so creating custom Node Red modules, despite being on the Flotilla Roadmap, is not too high on my list of priorities (it’s a long, long, long list!) . It would also result in less flexibility than just using the raw Flotilla protocol affords right now.

There’s some amount of friction in learning Node Red’s idiosyncrasies and how a system like Flotilla is best integrated, also, all in good time! This is the sort of thing I need to book a week under a waterfall in a dark cave to approach ;) Preferably in the company of a slightly inebriated and bearded Node Red guru, who periodically offers me cryptic tips.

It’s undoubtedly something I’ll get around to. In fact I’ve used Node before both on the BeagleBone Black and experimentally when I played around with websockets a few years ago now. It’s not entirely alien to me, but it’s come a long, long way. Also I use Javascript itself to build Rockpool so I’ve already opened that can of worms.

Anyway, the buck stops with me for this stuff, so your requests are at least being heard ;D


#6

What about my suggestion of another example python program?

If I run two python scripts simultaneously addressing the Blinkt it
does not work well. So I assume that what I need is a single controller
program into which I can feed messages such as “LED#, r, g, b”.
That could be python, javascript, bash, whatever. But it’s beyond my programming skills.

If you don’t want to learn node.js, how about another python example to do this?
If the script accepted MQTT messages it would be trivial to send them from Node-red or many other devices.


#7

I figure actions speak louder than words: https://github.com/pimoroni/blinkt/blob/master/examples/mqtt.py


#8

That’s perfect thanks.

Because I have Mosquitto set up to require username/password, I had to add a line immediately above client.connect():

client.username_pw_set(username=“pi”, password=“raspberry”)

Best regards,
jb


#9

I’ve been investigating Node-Red over the past few days, and getting to grips with how its guts work. Suffice to say I’m not the biggest fan of NodeJS but fortunately the precedent for using Python to make up for its shortcomings has been set for various existing Node-Red modules, including those for Pibrella, Sense HAT and generic RPi.GPIO.

It seems the done thing is to use a Python script to handle all the heavy lifting, then just run a single instance of it from within your Node.

Anyway, it’s a work in progress. If I can establish a working pattern then the groundwork should be laid for producing nodes for some of our other boards.


#10

Hey everybody,

its realy easy to use node red on the raspberry. Here is my example, I made a short video how to use it.

connect flotilla and rainbow, matrix and touch
start node red
when you have latest node red update you can install nodes by Manage palette
search for flotilla
import the code down here
deploy
use your browser from an other device to connect by ip and port to your pi.
Press the touch

It is easy to use the touch to put out some sentenses with speach.
I could use the matrix to display numbers

I just could not change the colors to blue or green or red. I used this

https://github.com/pimoroni/flotilla-python/blob/master/examples/colour.py
or that.
https://gadgetoid.gitbooks.io/flotilla-protocol/content/colour.html

anyone can help?

Example to import in node red on raspberry pi

[{“id”:“8c52de74.d5268”,“type”:“change”,“z”:“f8d3bd4e.01d01”,“name”:“to blue”,“rules”:[{“t”:“change”,“p”:“payload”,“pt”:“msg”,“from”:“true”,“fromt”:“bool”,“to”:“100,100,1,0”,“tot”:“str”}],“action”:"",“property”:"",“from”:"",“to”:"",“reg”:false,“x”:567,“y”:1616,“wires”:[[“733c8007.bf26f”,“91b4091.831c2f8”,“7fd3e3c5.2b40cc”]]}]