NODE-RED & RASPBERRY PI PICO W
This eBook and video course is a learning guide and a reference.
Use it to learn Node-RED, Raspberry Pi Pico W, and MicroPython, and add these state-of-the-art tools to your technology toolkit.
This course will also introduce you to virtual machines, Docker, and MySQL in support of IoT projects based on Node-RED and the Raspberry Pi Pico W.
Quick eBook facts
-
542 pages, in color.
- Printable PDF (Mobi and EPUB available when out of beta).
-
PDF is fully interactive with links, and comments (support depends on your PDF reader application).
Quick video course facts
- 15 hours on-demand high-res video.
- Over 130 lectures in 13 sections.
-
Quizzes to test your knowledge and comprehension.
Quick eBook & video course facts
- Project-based learning approach.
- Comprehensive guide assumes no prior knowledge of flow-based programming tools.
- Beginner-level knowledge of any microcontroller, programming is required.
- Learn to use important infrastructure tools in your projects, such as virtual machines, Docker, MySQL and useful web APIs such Google Sheet and OpenWeatherMap.
- Dozens of mini-projects supported by photographs, wiring schematics, and source code. Get these from the book GitHub repository.
-
Step-by-step instructions on everything.
- All experiments are based on the Raspberry Pi Pico W. A WiFi network is required for all projects.
-
Hardware (including the Raspberry Pi Pico W) is available as a kit which you can purchase separately from Sunfounder. Alternatively, all components are easy to find in the open market. See here for details.
What is this book course about?
This book and course combine several elements into a platform that powers the development of modern Internet of Things applications. These elements are a flow-based server, a WiFi-enabled microcontroller, a high-level programming language, and a deployment technology.
When you combine these elements, you have the tools you need to create automation systems at any scale. From home automation to industrial automation, this book will help you get started.
But what are these elements, specifically? Here they are:
Node-RED is an open-source flow-based development tool that makes it easy to wire together devices, APIs, and online services. Imagine being able to drag and drop blocks on a screen to create a flowchart that does something—like turning on your lights at sunset or sending you an email when a sensor detects movement. That's what Node-RED lets you do, all without requiring you to write extensive code.
Raspberry Pi Pico W is a version of the Raspberry Pi Pico with added 802.11n Wi-Fi capability. It was launched on June 30, 2022, and is priced at US$6. The Raspberry Pi Pico W is designed for physical computing tasks similar to Arduino boards, rather than serving as a general-purpose computer.
MicroPython is a lean and efficient implementation of Python 3. It's designed specifically for operation on microcontrollers and other constrained environments, but it doesn't cut corners when running Python code effectively.
Docker is an open-source platform that automates application deployment, scaling, and management. It uses containerisation technology to encapsulate an application and its dependencies into a self-sufficient unit known as a Docker container. This container can run uniformly and consistently on any infrastructure supporting Docker, irrespective of the underlying operating system.
Book organisation
I have organised this book into four parts so that you can use it both as a learning guide and as a resource.
Part 1 is dedicated to Node-RED for the absolute beginner. In Part 1, you will learn about Node-RED and event-driven systems, how to install an instance using the Docker option, the basics of nodes and flows, the dashboard and MQTT. If you are new to Node-RED, read the chapters in Part 1 carefully and complete the various projects.
Part 2 brings the Raspberry Pi Pico W into the mix. In the chapters of Part 2, you will learn how to use the Pico W as a Node-RED peripheral. You will learn to use MQTT to enable communications between the Pico and the Node-RED instance. You will also learn how to connect different hardware components to the Pico to implement simple circuits and use Node-RED (and its Dashboard) to control these components or view the data they produce. In Part 2, you will encounter motion, distance and water level sensors, motors, displays, relays, and joysticks, to mention a few. In all projects in Part 2, you will create Node-RED flows and write Raspberry Pi Pico W Micropython scripts that typically implement an event-driven system.
Part 3 provides a primer to MicroPython. MicroPython is a language specifically designed for embedded systems using Python 3 syntax. Python 3 is one of the most successful programming languages ever. Python's syntax is straightforward, making it easy for beginners to learn. This simplicity encourages good programming practices and allows for a focus on problem-solving rather than syntax issues. MicroPython brings those attributes to Microcontroller programming. If you are not familiar with Python or MicroPython, the chapters in Part 3 will help you learn everything you need to be able to confidently write MicroPython programs for the Raspberry Pi Pico (and Pico W), as well as any other of the many Microcontroller boards that support MicroPython.
Finally, Part 4 provides additional Node-RED resources. These resources consist of content on important Nodes (all explained with the help of mini-projects), control structures, and ways to integrate your Node-RED flows with external services and APIs. In Part 4, you will learn how to create power flows that can be used in more advanced automation settings.
Course organisation
I have organised this course into three parts.
Part 1 is dedicated to Node-RED for the absolute beginner. In Part 1, you will learn about Node-RED and event-driven systems, how to install an instance using the Docker option, the basics of nodes and flows, the dashboard and MQTT. If you are new to Node-RED, you should complete all lectures in Part 1 carefully, including the various projects.
Part 2 brings the Raspberry Pi Pico W into the mix. In the lectures of Part 2, you will learn how to use the Pico W as a Node-RED peripheral. You will learn to use MQTT to enable communications between the Pico and the Node-RED instance. You will also learn how to connect different hardware components to the Pico to implement simple circuits and use Node-RED (and its Dashboard) to control these components or view the data they produce. In Part 2, you will encounter motion, distance and water level sensors, motors, displays, relays, and joysticks, to mention a few.
Part 3 provides additional Node-RED resources. These resources consist of lectures on essential Nodes, control structures, and ways to integrate your Node-RED flows with external services and APIs. All of this is explained with the help of mini-projects. In Part 3, you will learn how to create flows that can be used in more advanced automation settings.
Hardware requirements
To complete this course you will need a few hardware components, like a Raspberry Pi Pico W microcontroller, a computer to serve as a host for a Node-RED instance, and various sensors and actuators.
You will find all of the required components in the Sunfounder Kepler Kit.
Software requirements
To complete this course you will need software, like the Thonny editor, Node-RED, the Mosquitto MQTT broker and Docker.
All of this software is open source and has zero monetary cost.
You will learn how to install and use them in the book.
Knowledge requirements
To complete this project you do need to be comfortable with a few technologies and skills. You do not need to be an expert in any of the technologies listed below. The book will help you with all preliminary setup tasks.
Here is a list:
Sample lectures
About this course
Code repository
Hardware
Software
Water level sensor
Joystick
Ready to learn?
You can enroll to our courses in one of two options: Solo and Community. For more information, please see this explainer page. (Mentor not available at this time)
ebook ONLY
SOLO
Once-off payment, best for self-sufficient learners on a budget.
Getting price...
Once-off.
COMMUNITY
Best for the social learner: become a member of the course community.
Getting price...
Once-off.
Course + eBook
Get the eBook and video course.
BUNDLE SOLO
Once-off payment, best for self-sufficient learners on a budget.
Getting price...
Once-off.
BUNDLE COMMUNITY
Best for the social learner: become a member of the course community.
Getting price...
Once-off.
video course ONLY
SOLO
Once-off payment, best for self-sufficient learners on a budget.
Getting price...
Once-off.
COMMUNITY
Best for the social learner: become a member of the course community.
Getting price...
Once-off.
Please see our refunds policy.
eBook table of contents
Part 1: Node-RED getting started 10
1. What is Node-RED? 11
2. Node-RED in IoT and event-driven systems 15
3. Communication in Node-RED: Protocols and Methods 18
4. Node-RED installation options 23
5. Setup Node-RED using Docker 29
5.1. Docker Containers: Hardware Options and Considerations 32
5.2. Create the Ubuntu 22.04 VM 34
5.3. Install Docker on the server 37
5.4. Install Node-RED using Docker 40
5.5. Testing your new Node-RED server 42
5.6. Setup auto-start with Docker Compose 44
5.7. Setup Node-RED for data persistence 48
5.8. Maintaining your instance of Node-RED 51
5.9. Security 55
6. Node-RED basics 63
6.1. Understanding the Node-RED editor 64
6.2. Nodes 72
6.3. Creating and deploying flows 76
6.4. Best Practices for Working with Flows 80
6.5. The "trigger" node 81
6.6. The "inject" node 85
6.7. The "debug" node 90
6.8. The "function" node 93
6.9. The "complete" node 96
6.10. The "delay" node 100
6.11. Node-RED settings and configuration 104
6.12. Node-RED documentation and resources 106
7. Node-RED dashboard 108
7.1. Text input and output 114
7.2. The button 122
7.3. The gauge and slider 128
7.4. The switch 133
7.5. The dropdown 136
7.6. The form 140
7.7. The UI template 145
8. Node-RED and MQTT 152
8.1. Installing MQTT Mosquitto on Ubuntu Server 22.04 155
8.2. Test the MQTT service on the command line 156
8.3. Using authenticated sub and pub 159
8.4. Test MQTT in Node-RED 161
8.5. MQTT with Raspberry Pi Pico 168
8.6. MQTT pub example 171
8.7. MQTT sub example 179
Part 2: Node-RED & RPi Pico Experiments 187
1. Frequently used patterns 188
1.1. WIFI 188
1.2. MQTT sub and pub 190
1.3. Node-RED 194
2. Warm up 199
2.1. Gauge and potentiometer 199
2.2. Button 208
2.3. Sample button with interrupts 214
2.4. LED control 217
2.5. LED control without polling 222
2.6. Combined 223
3. Inputs and outputs 232
3.1. Slide switch 232
3.2. Joystick 239
3.3. Relay 251
3.4. RFID 260
3.5. IR receiver and transmitter 271
4. Displays and LEDs 285
4.1. I2C LCD 285
4.2. Control 8 LEDs with the 74HC595N 299
4.3. WS2812 RGB LED strip 312
5. Motors 323
5.1. Servo motor 323
5.2. DC motor 334
6. Sensors 349
6.1. Temperature with DHT11 349
6.2. HC-SR04 ultrasosnic sensor 358
6.3. Motion sensor 364
6.4. Water level sensor 371
6.5. Thermistor 379
6.6. Analog light sensor 384
Part 3: Raspberry Pi Pico, a primer 388
1. Introduction to the Raspberry Pi Pico and Pico W 389
2. Getting Started with Raspberry Pi Pico and Thonny 394
3. MicroPython and Raspberry Pi Pico 405
4. Micropython, a primer 409
4.1. An introduction to MicroPython 411
4.2. MicroPython Language Constructs 414
4.3. MicroPython frequently used commands 420
4.4. MicroPython Modules 428
4.5. MicroPython Project Examples 432
4.6. Troubleshooting and Best Practices 435
4.7. Glossary of MicroPython Terms 441
4.8. References and Further Reading 443
5. Programming Raspberry Pi Pico with MicroPython 445
6. Serial communications with the Raspberry Pi Pico 449
7. SPI and I2C serial communications 452
8. Wifi and Bluetooth with the Raspberry Pi Pico 455
9. Interfacing with Sensors and Actuators 466
Part 4: More Node Red topics 469
1. Other useful nodes and features 470
1.1. The "catch" node 470
1.2. The "linkout" and "linkin" nodes 473
1.3. The "switch" node 477
1.4. The "range" node 481
1.5. The "RBE" (Report by Exception) node 484
1.6. The JSON node 488
1.7. Node groups 493
1.8. High-level review of other useful nodes by function 494
1.9. Credentials 496
1.10. Environment variables 499
2. Control Structures and Loops 504
2.1. Conditional nodes 504
2.2. Iteration nodes 506
2.3. Conditional and iteration nodes example flow 508
3. Integrating External Services and APIs 511
3.1. Node-RED with MySQL 511
MySQL for Node-RED on Ubuntu 514
A flow that uses MySQL 519
3.2. Using RESTful APIs and web services 528
3.3. Get weather information from OpenWeatherMap.org 536
3.4. Datalogging to a Google Sheet 540
3.5. Reading data from a Google Sheet 553
Course curriculum
Section 1: Introduction
01.010 - What is this course about?
01.015 - Course code repository
01.020 - Hardware
01.030 - Software
Section 2: Introduction to Node-RED
02.000 - Introduction to this section
02.010 - What is Node-RED?
Quiz 1: Test your knowledge: Node-RED
02.030 - Communication in Node-RED
Quiz 2: Test your knowledge on Node-RED communications
02.040 - Node-RED installation options
Quiz 3: Test your knowledge on Node-RED installation options
Section 3: Setup Node-RED with Docker
02.050 - Setup Node-RED using Docker
02.060 - Hardware Options and Considerations for Docker
02.070 - Create an Ubuntu virtual machine
02.080 - Install Docker on the server
02.090 - Install Node-RED using Docker
02.100 - Test your new Node-RED server
02.110 - Setup auto-start with Docker Compose
02.120 - Setup Node-RED for data persistence
02.130 - Node-RED maintenance
02.140 - Security: HTTPS
02.150 - Security: authentication
02.160 - Security: read-only users and default user
Section 4:Node-RED basics
02.170 - Introduction to this section
02.180 - The Node-RED editor
02.190 - Nodes
02.200 - Creating and deploying flows
02.210 - Best Practices for Working with Flows
02.220 - The "debug" node
02.230 - The "function" node
02.250 - The "complete" node
02.260 - The "delay" node
02.270 - The "trigger" node
02.280 - Node-RED settings and configuration
02.290 - Node-RED documentation and resources
Section 5: Node-RED dashboard
02.300 - Introduction to this section
02.310 - Text input and output
02.330 - The gauge and slider
02.340 - The switch
02.350 - The dropdown
02.360 - The form
02.370 - The UI template
Section 6: Node-RED and MQTT
02.380 - Introduction to this section
02.390 - Installing MQTT Mosquitto on Ubuntu Server
02.400 - Test the MQTT service on the command line
02.410 - Authenticated sub and pub
02.420 - Test MQTT in Node-RED
02.430 - MQTT with Raspberry Pi Pico W
02.440 - MQTT pub example
02.450 - MQTT sub example
02.460 - Node-RED with RPi Pico W MQTT tests
Section 7: Node-RED & Raspberry Pi Pico W - warming up experiments
03.010 - Introduction to this section
03.015 - Setup Thonny and Micropython for your Raspberry Pi Pico W
03.020 - Frequently used patterns
03.030 - Pattern 1: WiFi
03.040 - Pattern 2: MQTT sub and pub
03.050 - Pattern 3: Node-RED
03.070 - Gauge and potentiometer
03.080 - Button
03.090 - Sample button with interrupts
03.100 - LED control
03.110 - LED control without polling (uses interrupt)
03.120 - LED and button
Section 8: Inputs and outputs
03.130 - Section introduction
03.140 - Slide switch basics
03.141 - Slide switch with Node-RED
03.150 - Joystick basics
03.151 - Joystick with Node-RED
03.160 - Relay basics
03.161 - Relay control with Node-RED
03.170 - RFID basics
03.171 - RFID with Node-RED
03.180 - IR receiver and transmitter basics
03.181 - IR receiver and transmitter with Node-RED
Section 9: Displays and LEDs
03.190 - Introduction
03.200 - I2C LCD basics
03.201 - I2C LCD with Node-RED
03.210 - 595 shift register Basics
03.211 - 595 shift register Node-RED
03.220 - WS2812 Strip RGB LED strip basics
03.221 - WS2812 Strip RGB LED strip with Node-RED
Section 10: Motors
03.230 - Introduction
03.240 - Servo motor basics
03.241 - Servo motor with Node-RED
03.250 - DC motor basics
03.251 - DC motor with Node-RED
Section 11: Sensors
03.255 - Introduction
03.257 - Temperature with DHT11 basics
03.258 - Temperature with DHT11 with Node-RED
03.260 - HC-SR04 ultrasonic sensor basics
03.261 - HC-SR04 ultrasonic sensor with Node-RED
03.270 - Motion sensor basics
03.271 - Motion sensor with Node-RED
03.280 - Water level sensor basics
03.281 - Water level sensor with Node-RED
03.290 - Thermistor basics
03.300 - Analog light sensor basics
Section 12: More Node-RED nodes and features
04.020 - Section introduction
04.030 - The "catch" node
04.040 - The "link out" and "link in" nodes
04.050 - The "range" node
04.060 - Node groups
04.070 - The "switch" node
04.080 - The JSON node
04.090 - Credentials
04.100 - The "RBE" (Report by Exception) node
04.110 - Global environment variables
04.120 - Local (flow) environment variables
04.130 - Conditional and iteration nodes
Section 13: Node-RED integration with external services and APIs
04.140 - Section introduction
04.150 - Using RESTful APIs and web services
04.160 - Get weather information from OpenWeatherMap.org
04.170 - Datalogging to a Google Sheet
04.180 - Reading data from a Google Sheet
04.190a - Working with mySQL, introduction and demo
04.190b - Working with mySQL, how to remove mySQL
04.190c - Working with mySQL, setup mySQL on Ubuntu
04.190d - Working with mySQL and Node-RED
The course instructor
The course instructor is Peter Dalmaris, PhD.
Peter has created over 20 other courses on technology education.
He is the author of Maker Education Revolution, a book on how Making is changing the way we learn and teach.
He is also the host of Stemiverse, a podcast in which he discusses education and STEM with the shakers and movers of technology and science education from around the world.
Please download the sample PDF file of this eBook before proceeding with your purchase.
If you purchase this book but change your mind, you are entitled to a full refund as long as you have not yet downloaded the eBook file to your computer.
Please see our refunds policy to learn more.
Copyright 2024, Tech Explorations - Privacy