I would like to learn NODE RED... where do I begin?

So I understand JavaScript and I have been working in Node for a few projects. I am NOT a programmer but my background is related to industrial machines.

I came across Node RED and seems to be a nice tool to monitor machine cycles remotely, and I would like to add machine monitoring to my services.

Questions:

Where can I learn Node RED?

Also... spending $400 a month on FlowFuse would kill a service that I haven't even learned how to do.... any ideas of a more feasible way to start?

thanks..

Welcome to the forum @Elindo586.

Node-red is free and open source.
Flowfuse are the principal maintainers and have a commercial product which extends Node-red but you certainly don't need to use the Flowfuse product.

A more feasible way to start...
IMHO the simplest is to use a Debian based Linux machine and the "official" installer script.
If you want a dedicated computer, the cheapest to comfortably run Node-red is the Raspberry Pi 2 Zero.
You don't need the full desktop OS, the lite version is fine, and you can access it over ssh from any computer so no need for a monitor and keyboard.

Installation instructions are at Running on Raspberry Pi : Node-RED.

There are lots of posts here related to communicating with industrial machines over modbus or similar.
You might want to install the Mosquitto MQTT broker on your Node-red machine too.

There are a few videos on Youtube for beginners. Search for "Introduction to Node-red"

1 Like

Also I recommend watching this playlist: Node-RED Essentials. The videos are done by the developers of node-red. They're nice & short and to the point. You will understand a whole lot more in about 1 hour. A small investment for a lot of gain.

2 Likes

One of the first projects I did with Node-RED was to create a web page. This utilised the http-in nodes and template nodes, this gave me a small project with clear and testable results. I would suggest doing something similar to start out with.

Example:

[{"id":"a847d1de722d2231","type":"http in","z":"d5f86e14df7c5af4","name":"","url":"/hello/world","method":"get","upload":false,"swaggerDoc":"","x":350,"y":478,"wires":[["92d12c783dcb8784"]]},{"id":"8aa4d93b1737e03e","type":"http response","z":"d5f86e14df7c5af4","name":"","statusCode":"","headers":{},"x":621,"y":638,"wires":[]},{"id":"92d12c783dcb8784","type":"template","z":"d5f86e14df7c5af4","name":"","field":"payload","fieldType":"msg","format":"html","syntax":"mustache","template":"<html>\n    <head>\n        <title>Hello World</title>\n    </head>\n    <body>\n        Hello World\n    </body>\n</html>\n","output":"str","x":478,"y":563,"wires":[["8aa4d93b1737e03e"]]}]

From there, I created an JSON API endpoint and faced the problems around request routing. The end result was an entire blog related to Node-RED running on Node-RED.

Of course, I could also have achieved this using UIBUILDER but then I won't learn about how to use Node-RED.

Important is to pick something that is achievable in steps and that is relevant to you. Whatever that might be.

Also I would encourage using the docker images of Node-RED, then starting a first local instance of Node-RED becomes:

docker run -it -p 1880:1880 -v node_red_data:/data --name mynodered nodered/node-red

...missed Colin's post!!

THere is also node-red acadamy Courses
Currently free.

1 Like

Some great replies already.

My own view is start with something that you want your computer to do for you. Might be as simple as adding up some numbers and getting the output in the debug panel. Preferably, as Gregorius says, something relevant to you.

Then, as ideas spring to mind, try to work out how to do them - if you get stuck, ask here in the forum. You will rapidly build up an idea of how to use the core nodes. You may also work out where you need to learn something new.

I would steer clear of UI's until you have the basics going. Try doing some data queries before trying a UI. For example, get your local weather and dump it to the debug panel.

As you build confidence - and hopefully work through the courses people have listed - start to think about what a machine monitor actually is. Can your industrial devices send data? If so, how? Can Node-RED listen? How do they identify themselves? Do you need to normalize device ids? If they can't send, you might have to poll for data.

Next would be to start to think about how you want to VISUALISE the state of the devices. Starting simply, might just be "are they alive" or not? Personally, at this stage is where I think it starts to get harder. You can get going with visualisation REALLY quickly using the old Dashboard 1. But, you will hit a brick wall at some point. It can still be useful for quick and dirty prototypes though - as long as you remember, you WILL have to rebuild that part.

To go further with Node-RED based visualisations and UI's, you will need to make some choices:

  • http-in/-response node pairs give you flexible URL's to work with but nothing else. You are on you own! :slight_smile: And no realtime comms either.
  • Dashboard 2 is the replacement for D1 - Based around VueJS, and several other complex libraries. It is heavyweight and still fairly new. Like D1, you are often reliant on other people if you want to do something complex that isn't currently catered for unless you know the Vue framework and related tools (If you don't, you'll probably have to learn those as well as HTML and CSS). But, if you can stay - long-term - with existing D2 nodes and its layout and restrict yourself to a single web endpoint, Like D1, you can get going quickly. It only produces Single Page Apps (SPA's) at present though.
  • UIBUILDER melds Node-RED with vanilla HTML/CSS/JavaScript. It enhances those things. Unlike the http-in/-response nodes, you can have static resources which are scalable and performant. Unlike D2, you have no need of a framework - unless you choose to use one, UIBUILDER happily allows the use of any framework but never requires one. UIBUILDER also provides 2-way realtime comms between browser clients and Node-RED and a front-end library manager. It also has a number of helper nodes including ones that avoid writing HTML/JavaScript at all and it has a built-in (but optional) CSS stylesheet that is both light and dark aware. Oh, and it allows many instances to be created so that you can create any number of data-driven web apps and they can be either multi-page or single-page as desired.

You can compare UIBUILDER and D2 side-by-side in UIBUILDER's documentation here:

https://totallyinformation.github.io/node-red-contrib-uibuilder/#/using/compare-d2

2 Likes

All good hints so far. Let me throw in how I got into node-red.
My starting point was: how to measure things in my home, how to control the few things which are controllable in my home. I was interested in temperature and humidity, in the water level of the rain water tank, produced solar energy, power consumption, etc. At a later stage I added measurement points from the Internet,: solar forecast, moon phase, ...
I used node-red to fetch all that data and transform it into a standardised format.

As a message backbone I use MQTT, with topic trees for sensor-data, location, etc and I use node-red to fill in these data points into the MQTT tree. So in addition to node-red, and especially when you want to monitor machines, I suggest you have a look at MQTT.

Then I had the wish to store all that data. node-red as nothing built in, it relies on external services. If you monitor data regularly, then a time based database like influxdb seems a logic choice. I went for that.

There are nice built-in tools in node-red to visualise data. I'm personally not a fan, because it needs a steap learning curve for all that CSS/HTML stuff. Therefore I used grafana. It is very easy to build dashboards and fetch the data from influxdb.

For the combination MQTT -> influxdb -> grafana you'll find good tutorials.

1 Like

I don't think @Elindo586 is paying any attention to all the advice.

Do we care? :rofl: I don't think most of us can stop ourselves from chipping in info and recommendations. :smiley:

3 Likes