Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Deploying Node-RED apps to devices using Resin.io

Deploying Node-RED apps to devices using Resin.io

Presented at Node+JS Interactive 2018: https://www.youtube.com/watch?v=jo6MFQIaDLA

Node-RED is an open-source visual tool for wiring the Internet of Things. Built on top of Node.js, it provides a light-weight, browser-based editor that makes it easy to integrate different streams of both physical and digital events.

It is ideal to run at the edge of the network, such as on a Raspberry Pi, but also within the cloud. It provides a framework for adding new nodes to its palette, extending its capabilities. Originally developed by IBM team, it is now a project of the JS Foundation.

The project has recently introduced version control directly within the editor allowing it to integrate closely with a developer's regular workflow.

This talk will introduce Node-RED and show how it can become an invaluable tool for creating IoT solutions. The talk will demonstrate a complete developer workflow from development to production with an application that deploys across devices.

Nick O'Leary

October 11, 2018
Tweet

More Decks by Nick O'Leary

Other Decks in Technology

Transcript

  1. 3 Node-RED Flow-based programming for the Internet of Things •

    Browser-based editor • Node.js runtime • Extendable palette
  2. 4 4 67 releases 84 contributors 3,840+ commits 1,600+ nodes

    published to the community 1,000+ example flows shared 2013: Created by IBM Emerging Technology Services and open- sourced later that year. 2015: Added to the default Raspberry Pi image. 2016: Became a founding project of the JS Foundation. 2018: Hit 1,000,000 installs 02-2018 10-2016 09-2013 1,000,000 installs 10-2015
  3. 5 • Invented by J. Paul Morrison at IBM in

    the early 1970’s • A network of asynchronous processes communicating by means of streams of structured data chunks • Each process is a black box – it doesn’t know what has come before it, or what comes after it; it just acts on the data it receives and passes the result on Flow-based Programming
  4. 7

  5. 8

  6. 14

  7. 15 From the edge to the cloud Easily-installed on the

    default Raspberry Pi image, Node-RED can be used out of the box to begin creating IoT applications. Available in the IBM Cloud catalog as a Quick Start application, it takes moments to create cloud applications that combine services from across the platform. Easily installed on other cloud platforms.
  8. 18

  9. 19 • Bluetooth Low Energy • Espruino JavaScript interpreter pre-

    installed • nRF52832 SoC - 64MHz ARM Cortex M4, 64kB RAM, 512kB Flash • 8 x 0.1" GPIO • 9 x SMD GPIO • Silicone cover with tactile button • MAG3110 Magnetometer • IR Transmitter • Built in thermometer, light and battery level sensors • Red, Green and Blue LEDs • NFC tag programmable from JavaScript • Pin capable of capacitive sensing Puck.js • 8×8 RGB LED matrix • Five-button joystick • Gyroscope • Accelerometer • Magnetometer • Temperature • Barometric pressure • Humidity Raspberry Pi + SenseHAT
  10. 20 At this point of the talk, I switch to

    a demo. The demo walks through the basics of Node-RED using a Pi and SenseHAT. It shows how the sensor data from the SenseHAT can be used to control the display on the SenseHAT. It also shows connecting to the device to the IBM Watson IoT Platform to share its data.
  11. 21 • A project is a set of files that

    represent a complete, redistributable Node-RED application. • The Runtime runs a single project at any one time, but the Editor provides an easy way to switch between projects. • A project exists locally on disk, but can be linked to a remote git repository Node-RED Projects Feature .node-red/ ├── node_modules ├── package.json ├── projects │ └── my-project │ ├── .git │ ├── flow.json │ ├── flow_cred.json │ ├── package.json │ └── README.md └── settings.js
  12. 22

  13. 23 • Espruino JavaScript interpreter • Bluetooth Low Energy •

    nRF52832 SoC - 64MHz ARM Cortex M4, 64kB RAM, 512kB Flash • 8 x 0.1" GPIO • Silicone cover with tactile button • MAG3110 Magnetometer • IR Transmitter • Built in thermometer, light and battery level sensors • Red, Green and Blue LEDs • NFC tag programmable from JavaScript • Pin capable of capacitive sensing Puck.js
  14. 24

  15. 25

  16. 26 At this point of the talk, I switch to

    the next demo. I cloned the existing Node-RED project from my GitHub repo. This included setting up the Puck.js BLE device and the code on the Pi to detect when the Puck’s button was pressed. The flow then controlled the colour of the SenseHAT to match the colour of the Puck passed on the number of clicks.
  17. 30 IBM Cloud { temperature: 30, humidity: 61, pressure: 1010

    } { temperature: 30, humidity: 61, pressure: 1010 } { temperature: 30, humidity: 61, pressure: 1010 } git push resin master
  18. 31

  19. 32 The last part of the demo was showing how

    pushing the changes to a git repo on Resin.io would then push the app out to the other Raspberry Pis on stage.
  20. 33

  21. 34

  22. 35

  23. 36

  24. 37

  25. 38

  26. 39 0.18 0.19 1.0 Features: - Projects - Version control

    January 2018 Features: - Persistable context August 2018 Features: - Split editor/runtime packaging Target: 4Q18 0.20 This timeline proposes how the features will be staged across releases. The precise timings of these releases is not yet known. The 0.21 release may split into 2 or more sub releases prior to 1.0 Features: - Subflow Instance properties - Node Messaging API - Pluggable routing - Library redesign 0.21 0.22
  27. 40 • Split the packaging of node-red into multiple packages.

    • The existing node-red package will become a meta-package that pulls them together to deliver Node-RED as it is used today. • The internal modules will be published under the @node-red organization on npm Feature: Split Editor/Runtime Packaging node-red runtime editor HTTP Admin API @node-red/editor-api Client-side Editor @node-red/editor-client Flow Runtime @node-red/runtime Core Nodes @node-red/nodes Node Registry @node-red/registry Common Utils @node-red/util
  28. 41 § @node-red/editor-api - provides an Express application that can

    be used to serve the Node-RED editor § @node-red/editor-client - provides all of the client-side resources of the Node-RED editor application. § @node-red/nodes - provides all of the core Node-RED nodes. § @node-red/registry - provides the node registry, responsible for discovering and managing the node modules available to the Node-RED runtime. § @node-red/runtime - provides the core flow engine of Node- RED. It is the main entry point for the runtime. § @node-red/util - provides common utilities shared by the Node-RED components, including logging and i18n. § node-red - the existing package that pulls the above packages together and delivers exactly the same experience as it does today Feature: Split Editor/Runtime Packaging node-red runtime editor HTTP Admin API @node-red/editor-api Client-side Editor @node-red/editor-client Flow Runtime @node-red/runtime Core Nodes @node-red/nodes Node Registry @node-red/registry Common Utils @node-red/util