19
What is Node-Red? (and why do we care?)

What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

  • Upload
    others

  • View
    2

  • Download
    0

Embed Size (px)

Citation preview

Page 1: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

What is Node-Red?(and why do we care?)

Page 2: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

• A visual IOT tool for wiring together hardware devices, APIs and services

• Runs on Node.js

• Works closely with MQTT

• Free

http://tech.Scargill.net

Page 3: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

• A visual IOT tool for wiring together hardware devices, APIs and services

• Runs on Node.js

• Free

• Consists of modules visually wired together

• Many library nodes available – or write your own

http://tech.Scargill.net

Page 4: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Install Node-Red on:

• A linux PC or VM (Digital Ocean)• A Windows PC• Some NAS drives• A Raspberry Pi or Pi2• etc

http://tech.Scargill.net

Page 5: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

http://tech.Scargill.net

Page 6: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

http://tech.Scargill.net

Page 7: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Typical nodes available in Node-Red

“grove”, “scheduler” and “duskdawn” created by Peter Scargill.

http://tech.Scargill.net

Page 8: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Typical starting point.

Visual screen ONLYRequired while editing.

Node-Red continues to run without visual editor.

http://tech.Scargill.net

Page 9: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Simple Example…

http://tech.Scargill.net

Page 10: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Drag and dropTimestamp and debug nodes to working area

http://tech.Scargill.net

Page 11: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Double-click Inject node and make a 5 second timestamp

http://tech.Scargill.net

Page 12: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Join together

Deploy

Voila

http://tech.Scargill.net

Page 13: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

MQTT Example

Here a timestamp is sent to topic “thetime”

Separately, we are “subscribed” to “thetime” –and the result appears in the debug window

http://tech.Scargill.net

Page 14: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

My own (unfinished)setup

Multiple pages Database reading and writing

Web sockets

All on a Raspberry Pi 2

or Digital Ocean “Droplet”

http://tech.Scargill.net

Page 15: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Node-red sends temperature/humidity values to GroveStreams

http://tech.Scargill.net

Page 16: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

OR

Send temperature etc to local MYSQL

Then use, say PHP+Highchartslocally – for local only display

http://tech.Scargill.net

Page 17: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Back to our simpleMQTT demo – topic is “thetime”

Monitor with MQTT-SPY by Kamil Baczowicz

http://tech.Scargill.nethttps://github.com/kamilfb/mqtt-spy/releases/tag/mqtt-spy_v0.2.0

Page 18: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

Practicalities

We have a SCRIPT at tech.scargill.net to make setup easy. Can install MQTT + NODE-RED + MYSQL + PHP and lots more

Raspberry Pi (2) - great – but – will SD memory last years of writing?

Alternatively – a dedicated PC with Linux? Expensive to run?

Alternatively – a Digital Ocean Droplet $5 a month? (or free – see the blog)

http://tech.Scargill.net

Page 19: What is Node-Red? · ESP8266s can “subscribe” to multiple topics (I use only two –one for specific boards –and one for individual boards) The incoming message can then be

ESP8266s can “subscribe” to multiple topics (I use only two – one for specific boards – and one for individual boards)

The incoming message can then be processed in any way you wish – in C or other language… on boards using “unofficial dev Kit” or ESP-Arduino – or LUA? then send out a reply MQTT message – or just DO something.

Discussion – practical – fun.

If you want to follow up at home – source, code, ideas, boards, discussion on the blog

This presentation – links and much more all on the blog…

http://tech.scargill.net/home-control-2015/