element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Members
    Members
    • Benefits of Membership
    • Achievement Levels
    • Members Area
    • Personal Blogs
    • Feedback and Support
    • What's New on element14
  • Learn
    Learn
    • Learning Center
    • eBooks
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Dev Tools
    • Manufacturers
    • Raspberry Pi
    • RoadTests & Reviews
    • Avnet Boards Community
    • Product Groups
  • Store
    Store
    • Visit Your Store
    • Choose Another Store
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
Raspberry Pi Projects
  • Products
  • Raspberry Pi
  • Raspberry Pi Projects
  • More
  • Cancel
Raspberry Pi Projects
Blog Node Red with Raspberry Pi
  • Blog
  • Documents
  • Events
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Raspberry Pi Projects requires membership for participation - click to join
Blog Post Actions
  • Subscribe by email
  • More
  • Cancel
  • Share
  • Subscribe by email
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: pradeeplogu
  • Date Created: 12 Mar 2023 5:48 AM Date Created
  • Views 2947 views
  • Likes 8 likes
  • Comments 1 comment
  • node red
  • raspberrypi4
Related
Recommended

Node Red with Raspberry Pi

pradeeplogu
pradeeplogu
12 Mar 2023
Node Red with Raspberry Pi

Story

Node-RED is a powerful open-source visual programming tool for building Internet of Things (IoT) applications. In this tutorial, we’ll cover what Node-RED is, how to install it, and how to use the visual interface to create a simple flow.

What is Node-RED?

Node-RED is an effective open-source platform for developing Internet of Things (IoT) applications that aim to make the programming part simpler.

Node-RED is a web-based application that employs visual programming to let you link code fragments, or "nodes," together to carry out a task. When the nodes are connected, they form flows.

image
I got my PCBs manufactured from :
imageFor this project and my other projects for PCB manufacturing and assembly I take help from the above PCB Vendor, they are the best in this business, and I have been never let down by their quality.

Why Node-RED?

  • IBM created open-source Node-RED software.
  • The Raspberry Pi flawlessly runs Node-RED.
  • Because it is a visual programming tool, a wider spectrum of users can use it.
  • Node-RED allows you to spend less time writing code and more time creating exciting things.
  • For this project and my other projects for PCB manufacturing and assembly I take help from ***, they are the best in this business and I have been never let down by their quality.

Applications with Node-RED?

Node-RED forms it easy to:

  • access the GPIOs on your RPi;
  • connect to other devices via MQTT;
  • For your projects, develop a responsive graphical user interface;
  • Interact with outside services.
  • Get information from the internet, such as stock prices, emails, and weather forecasts;
  • Organize time-based events;
  • Keeping and getting information from a database.

Now that we are aware of Node-Red, okay. We need a physical medium to install Node-Red, and the Raspberry Pi will serve that purpose.

Let's Boot the Pi:

First, we need to boot our OS to Raspberry Pi, and we need a tool called Raspberry Pi Imager.

image

Once installed, the software opens the tool.

image

Next, choose the OS type.

image

Then select the drive. One of the great features of this tool is we can add the SSH and Wi-Fi credentials directly into the OS file, even without turning on the Raspberry Pi. For that, select the settings icon in the tool.

image

Next, start burning the OS into the SD card.

image

Once the writing is finished, insert the SD card into the Raspberry Pi.

image

Then power on the device. The first time it will take some to boot and connect to Wi-Fi, wait for 5–10 minutes and look at your router status, you can see there will be a new device connected to your router.

image

Next, copy the IP address and use serial terminal software to access the serial port.

image

Then try to connect to the SSH.

image

After that, we have to update the system, for that, we can use the following command sudo apt-get update

image

Next sudo apt-get upgrade.

image

That's all now are system is ready to install the node-red.

Node-Red Installation:

Type the following command in the Raspberry Pi SSH to install the Node-Red.

bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
image

You need to give some input to the system in order to install the Node-Red. Type Y to install the Node-Red.

image

The first time, it will automatically install Node.js and all the other necessary components. Once the installation is done, type the following command to start the node-red.

image

We can make the Node-Red auto start at boot using the following commands.

image

In the console, you can see the IP address.

image

Just type in the IP address in your browser, and it will open up the Node-Red dashboard.

image
image

First Flow with Node-Red:

To get you used to the Node-RED interface, let’s create a simple flow. The flow we’ll create, simply prints a message to the debug console, when triggered.

Drag an inject node and a debug node to your flow and wire them together.

image

Now, let’s edit the inject node. Double-click the node. In the figure below, you can see the different settings you can change.

image

In the msg. Payload field, select Boolean and true. Then, click Done. Next, click on the debug node, and select the content as a complete message object.

image

Then click on the Red deploy icon and it will start the flow,

image

Next, click the trigger node, it will print the boolean data into the debug console on the right-side panel.

image

Now we are done with the "Hello Word" section, let's try to control the GPIO using Node-Red.

GPIO Control with Node-Red:

In the Node's pallet, scroll down to the last section, and you can find an additional node specifically for Node-Red.

image

Then add some inject nodes, switch, and GPIO out nodes and connect them as follows.

image

Click on the switch node and enter the on signal as 0.

image

Repeat the same step with the signal as 1 in another node. Then click on the Raspberry Pi out node and select the pin. In my case, I'm using GPIO 19.

image

Here is the complete JSON of my flow I have added two led's on the Raspberry.

image

If you inject the true node both LEDs will turn on if you inject the false node both LEDs will turn off

image

Summary:

In this article, we see how we can install the Node-Red on Raspberry Pi and how we can actually control the GPIO using Node-Red. In upcoming tutorials will see how we can connect and communicate the sensors with Raspberry Pi via Node-Red.

  • Sign in to reply

Top Comments

  • dougw
    dougw 16 days ago +1
    Great article. You can learn the basics of Node Red and get something running in one session.
  • dougw
    dougw 16 days ago

    Great article. You can learn the basics of Node Red and get something running in one session.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2023 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • Facebook
  • Twitter
  • linkedin
  • YouTube