Upload
others
View
2
Download
0
Embed Size (px)
Citation preview
What is Node-Red?(and why do we care?)
• 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
• 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
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
http://tech.Scargill.net
http://tech.Scargill.net
Typical nodes available in Node-Red
“grove”, “scheduler” and “duskdawn” created by Peter Scargill.
http://tech.Scargill.net
Typical starting point.
Visual screen ONLYRequired while editing.
Node-Red continues to run without visual editor.
http://tech.Scargill.net
Simple Example…
http://tech.Scargill.net
Drag and dropTimestamp and debug nodes to working area
http://tech.Scargill.net
Double-click Inject node and make a 5 second timestamp
http://tech.Scargill.net
Join together
Deploy
Voila
http://tech.Scargill.net
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
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
Node-red sends temperature/humidity values to GroveStreams
http://tech.Scargill.net
OR
Send temperature etc to local MYSQL
Then use, say PHP+Highchartslocally – for local only display
http://tech.Scargill.net
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
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
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/