Practical Node-RED Programming
eBook - ePub

Practical Node-RED Programming

Learn powerful visual programming techniques and best practices for the web and IoT

Taiji Hagino

  1. 326 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Practical Node-RED Programming

Learn powerful visual programming techniques and best practices for the web and IoT

Taiji Hagino

Book details
Book preview
Table of contents
Citations

About This Book

Use a low-code programming approach to create event-driven applications from scratch by wiring together hardware devices, APIs, and online services

Key Features

  • Discover how you can automate the Internet of Things (IoT) without writing huge blocks of code
  • Learn how to wire together flows using a browser-based visual editor
  • Handle IoT data with little to no coding knowledge

Book Description

Node-RED is a free and open source flow-based programming tool used to handle IoT data that allows programmers of any level to interconnect physical I/O, cloud-based systems, databases, and APIs to build web applications without code.

Practical Node-RED Programming is a comprehensive introduction for anyone looking to get up to speed with the Node-RED ecosystem in no time. Complete with hands-on tutorials, projects, and self-assessment questions, this easy-to-follow guide will help you to become well versed in the foundations of Node-RED. You'll learn how to use Node-RED to handle IoT data and build web applications without having to write complex code. Once you've covered the basics, you'll explore various visual programming techniques and find out how to make sample flows as you cover web development, IoT development, and cloud service connections, and finally build useful real-world applications.

By the end of this book, you'll have learned how to use Node-RED to develop a real-world application from scratch, which can then be implemented in your business.

What you will learn

  • Understand the history of Node-RED and why you need to learn a flow-based programming tool
  • Use Node-RED to build Node.js-based applications
  • Handle data for IoT devices using Node-RED flows
  • Explore advanced Node-RED features such as connecting repositories and customizing the flow editor
  • Find out what the MQTT protocol is and how it relates to Node-RED
  • Create and publish your own nodes and flows using the Node-RED library

Who this book is for

This Node-RED book is for web developers and IoT engineers with some background in JavaScript and Node.js. Although not necessary, familiarity with the concepts of electronics will help you to make the most out of this book.

Frequently asked questions

How do I cancel my subscription?
Simply head over to the account section in settings and click on “Cancel Subscription” - it’s as simple as that. After you cancel, your membership will stay active for the remainder of the time you’ve paid for. Learn more here.
Can/how do I download books?
At the moment all of our mobile-responsive ePub books are available to download via the app. Most of our PDFs are also available to download and we're working on making the final remaining ones downloadable now. Learn more here.
What is the difference between the pricing plans?
Both plans give you full access to the library and all of Perlego’s features. The only differences are the price and subscription period: With the annual plan you’ll save around 30% compared to 12 months on the monthly plan.
What is Perlego?
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 1000+ topics, we’ve got you covered! Learn more here.
Do you support text-to-speech?
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more here.
Is Practical Node-RED Programming an online PDF/ePUB?
Yes, you can access Practical Node-RED Programming by Taiji Hagino in PDF and/or ePUB format, as well as other popular books in Computer Science & Computer Networking. We have over one million books available in our catalogue for you to explore.

Information

Year
2021
ISBN
9781800207660
Edition
1

Section 1: Node-RED Basics

In this section, readers will understand what a flow-based programming (FBP) tool is, including Node-RED, along with how to undertake IoT/web programming with it, and will learn how to use the Node-RED flow editor at a basic level.
In this section, we will cover the following chapters:
  • Chapter 1, Introducing Node-RED and Flow-Based Programming
  • Chapter 2, Setting Up the Development Environment
  • Chapter 3, Understanding Node-RED Characteristics by Creating Basic Flows
  • Chapter 4, Learning the Major Nodes

Chapter 1: Introducing Node-RED and Flow-Based Programming

This chapter will help you grow from being a reader to being a Node-RED user. First, you'll learn about the history of Flow-based programming (FBP) tools, not just Node-RED. You will then gain a broad understanding of the entirety of Node-RED as a useful tool for building web applications and the Internet of Things (IoT) data handling, before learning what IoT and Node.js are in terms of Node-RED.
Providing technical content will help accelerate your software application development, but if you take a look at the history of the Node-RED tool itself, it will help you better understand why you need a FBP tool such as Node-RED. That is what we will be doing in this chapter.
More specifically, we'll be covering the following topics:
  • What is FBP?
  • What is Node-RED?
  • Node-RED benefits
  • Node-RED and IoT
Let's get started!

What is FBP?

So, what is FBP in the first place? It's the workflows you use in your work that you can easily imagine. Let's recall those workflows.

Workflows

In a normal workflow, boxes and wires indicate the process flow. It may be just one business design. Boxes represent processes. Box processing is defined by who, when, where, what, and how much. Sometimes, it's like explicitly writing out the flow of processing, such as by using swim lanes or placing writing definitions inside boxes. In any case, looking at the box should reveal what will be done.
On the other hand, let's try to summarize this business process as a document. Don't you think it will be complicated? Who will do what as they read it, even if they use some paragraphs well to put it together? When will you do it? It could be confusing:
Figure 1.1 – Workflow example
Figure 1.1 – Workflow example
Now, let's get back to software programming. FBP is a kind of concept for software programming that defines an application with a data flow. Each part of the process is there as a black box. They communicate data between connected black boxes that have been predefined. FBP is said to be component-oriented because these black-box processes can be connected repeatedly to form several applications without needing to be modified internally. Let's explore FBP in more detail.

Flow-based programming (FBP)

I think FBP is a good blend of workflow and dataflow. FBP uses a data factory metaphor to define an application. It sees an application as a network of asynchronous processes that start at some point and do a single sequential process that does one operation at a time until it ends, rather than communicating by using a stream of structured chunks of data. This is called an information packet (IP). This view focuses on the data and its transformation process to produce the output that is needed. Networks are usually defined outside a process as a list of connections that is interpreted by a piece of software called a scheduler.
Processes communicate via fixed capacity connections. Connections are connected to processes using ports. The port has a specific name that is agreed on by the network definition and the process code. At this point, it is possible to execute the same code by using multiple processes. A particular IP is usually only owned by a single process or transferred between two processes. The port can be either a normal type or an array type.
FBP applications typically run faster than traditional programs, since FBP processes can continue to run as long as there is room to put in data and output to process. It does not require any special programming and makes optimal use of all the processors on the machine.
FBP has a high-level, functional style so that the behavior of the system can be easily defined; for example, in a distributed multi-party protocol such as a distributed data flow model, for accurately analyzing the criteria for determining whether a variable or statement behaves correctly:
Figure 1.2 – Simple FBP design example
Figure 1.2 – Simple FBP design example
Now that you have a solid understanding of FBP, let's learn how Node-RED can be implemented in this way.

What is Node-RED?

Node-RED is one of the FBP tools that we have described so far. Developed by IBM's Emerging Technology Services team, Node-RED is now under the OpenJS Foundation.

Overview

FBP was invented by J. Paul Morrison in the 1970s. As we mentioned earlier, FBP describes the behavior of the application as a black box network, which in Node-RED is described as a "node." Processing is defined in each node; data is given to it, processing is performed using that data, and that data is passed to the next node. The network plays the role of allowing data to flow between the nodes.
This kind of programming method is very easy to use to make a model visually and makes it easy to access for several layer users. Anybody can understand what the flow is doing if a problem is broken down into each step. That's why you don't need to the code inside the nodes:
Figure 1.3 – Node-RED Flow Editor as an FBP tool
Figure 1.3 – Node-RED Flow Editor as an FBP tool

Flow editor and runtime

Node-RED is not only a programming tool but also an execution platform that wraps up the Node.js runtime for applications that are built using Node-RED.
We need to use the flow editor to make Node-RED applications for IoT, web services, and more. The flow editor is also a Node.js web application. We will ...

Table of contents

Citation styles for Practical Node-RED Programming

APA 6 Citation

Hagino, T. (2021). Practical Node-RED Programming (1st ed.). Packt Publishing. Retrieved from https://www.perlego.com/book/2381904/practical-nodered-programming-learn-powerful-visual-programming-techniques-and-best-practices-for-the-web-and-iot-pdf (Original work published 2021)

Chicago Citation

Hagino, Taiji. (2021) 2021. Practical Node-RED Programming. 1st ed. Packt Publishing. https://www.perlego.com/book/2381904/practical-nodered-programming-learn-powerful-visual-programming-techniques-and-best-practices-for-the-web-and-iot-pdf.

Harvard Citation

Hagino, T. (2021) Practical Node-RED Programming. 1st edn. Packt Publishing. Available at: https://www.perlego.com/book/2381904/practical-nodered-programming-learn-powerful-visual-programming-techniques-and-best-practices-for-the-web-and-iot-pdf (Accessed: 15 October 2022).

MLA 7 Citation

Hagino, Taiji. Practical Node-RED Programming. 1st ed. Packt Publishing, 2021. Web. 15 Oct. 2022.