Search icon CANCEL
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Conferences
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Practical Node-RED Programming

You're reading from   Practical Node-RED Programming Learn powerful visual programming techniques and best practices for the web and IoT

Arrow left icon
Product type Paperback
Published in Mar 2021
Publisher Packt
ISBN-13 9781800201590
Length 326 pages
Edition 1st Edition
Languages
Arrow right icon
Author (1):
Arrow left icon
Taiji Hagino Taiji Hagino
Author Profile Icon Taiji Hagino
Taiji Hagino
Arrow right icon
View More author details
Toc

Table of Contents (19) Chapters Close

Preface 1. Section 1: Node-RED Basics
2. Chapter 1: Introducing Node-RED and Flow-Based Programming FREE CHAPTER 3. Chapter 2: Setting Up the Development Environment 4. Chapter 3: Understanding Node-RED Characteristics by Creating Basic Flows 5. Chapter 4: Learning the Major Nodes 6. Section 2: Mastering Node-RED
7. Chapter 5: Implementing Node-RED Locally 8. Chapter 6: Implementing Node-RED in the Cloud 9. Chapter 7: Calling a Web API from Node-RED 10. Chapter 8: Using the Project Feature with Git 11. Section 3: Practical Matters
12. Chapter 9: Creating a ToDo Application with Node-RED 13. Chapter 10: Handling Sensor Data on the Raspberry Pi 14. Chapter 11: Visualize Data by Creating a Server-Side Application in the IBM Cloud 15. Chapter 12: Developing a Chatbot Application Using Slack and IBM Watson 16. Chapter 13: Creating and Publishing Your Own Node on the Node-RED Library 17. Other Books You May Enjoy Appendix: Node-RED User Community

Node-RED and IoT

Again, Node-RED is a virtual environment that combines hardware devices, APIs, and online services in a revolutionary way on a browser. It provides the following features:

  • Browser-based UI.
  • Works with Node.js and is lightweight.
  • Encapsulates function and can be used as a node (meaning functions are locked in an abstract capsule) .
  • You can create and add your own nodes.
  • Easy access to IBM Cloud services.

In other words, it can be said that this tool is suitable for building IoT-related services, such as data control on devices, and linking edge devices and cloud services. Originally, the development concept of Node-RED was for IoT, so this makes sense.

Now, let's look at the basic structure of IoT so that those who are only vaguely aware of IoT can understand it. It can be said that IoT is basically composed of six layers, as shown in the following diagram:

Figure 1.6 – IoT six layers

Figure 1.6 – IoT six layers

Let's take a look at these in more detail.

Device

The device is a so-called edge device. IoT has various sensors and handles the data that's acquired from them. Since it doesn't make sense to have the data only on the edge device, we need to send that data through the gateway to the network.

Network

This is the network that's required to send the data that's been obtained from the device to a server on the internet. It usually refers to the internet. In addition to the internet, there is also a P2P connection via Bluetooth or serial.

Platform

The party that receives and uses the data is the platform. We may also have a database for activating and authenticating things, managing communications, and persisting received data.

Analytics

This is a layer that analyzes the received data. Broadly speaking, it may be classified as an application. This is the part that prepares the data so that it can be processed into a meaningful form.

Application

An application provides a specific service based on data analysis results. It can be a web or mobile application, or it can be a hardware-specific embedded application. It can be said to be the layer that's used by the end user of the IoT solution.

Now that we have an understanding of IoT, we will examine why Node-RED should be used for it.

Node-RED and IoT

While explaining IoT so far, we've made it clear why Node-RED is suitable for IoT. For example, you can understand why FBP tools that have been developed for IoT survive when used with Node-RED. In particular, the following three points should be taken into account:

  • Since it can be run on edge devices (pre-installed on specific versions of Raspberry Pi OS), it is ideal for data handling at the device layer.
  • Since it can be run on the cloud (provided as a default service in IBM Cloud), it is easy to link with storage and analysis middleware.
  • Since MQTT and HTTP protocols can be covered, it is very easy to exchange data between the edge device and the server processing cloud.

In this way, Node-RED, which largely covers the elements required for IoT, is now used for a wide range of applications, such as web services and chart display, as well as programming for IoT. Also, as of June 2020, if you look at Google Trends for Node-RED, you can see that the number of users is gradually increasing. As such, Node-RED is a very attractive FBP tool:

Figure 1.7 – Google Trends for "Node-RED"

Figure 1.7 – Google Trends for "Node-RED"

A typical edge device that can use Node-RED is Raspberry Pi. Of course, it is possible to use Node-RED on other platforms, but it goes well with Raspberry Pi, which also has a pre-installed version of the OS.

Raspberry Pi OS Supports Node-RED

Node-RED has also been packaged for the Raspberry Pi OS repositories and appears in their list of recommended software. This allows it to be installed using apt-get install Node-RED and includes the Raspberry Pi OS-packaged version of Node.js, but does not include npm. More information can be found at https://nodered.org/docs/getting-started/raspberrypi.

IBM Cloud is a typical cloud platform that can use Node-RED. Of course, you can use Node-RED on other clouds, but IBM Cloud provides a service that anyone can easily start.

Important Note

Node-RED is available on the IBM Cloud platform as one of its Starter Kits applications in their catalog. It is very easy to start using the flow editor as a web application on IBM Cloud (https://nodered.org/docs/getting-started/ibmcloud).

You have been reading a chapter from
Practical Node-RED Programming
Published in: Mar 2021
Publisher: Packt
ISBN-13: 9781800201590
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at €18.99/month. Cancel anytime