Node-RED Tutorial: How to use HTTP nodes with the industrial Raspberry PLC
Learn how to HTTP request for industrial and Raspberry Pi automation
22 September, 2021 by
Node-RED Tutorial: How to use HTTP nodes with the industrial Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez


HTTP stands for hypertext transfer protocol. It's a protocol that allows communication between different systems. Most commonly, it is used for transferring data from a web server to a browser to view web pages.

In this post, we are going to show you how to create an HTTP endpoint to be able to use it with HTTP client and HTTP server in the industrial automation area and with Raspberry Pi based PLC.

Related links

How to

Connect an open source Raspberry PLC to Wi-Fi


Raspberry PLC

Family products for industrial automation


How to

Program Raspberry PLC Interrupt inputs with Python


Basics about

Raspberry Pi industrial PLC Analog Outputs


Touchberry Pi

Family products for industrial control


How to

Find your perfect industrial PLC



  • Power Supply >>>

  • Either Ethernet cable or external monitor and keyboard to access the open source PLC Raspberry Pi.


According to MDN, HTTP is a protocol that allows the fetching of resources, such as HTML documents. It is the foundation of any data exchange on the Web and it is a client-server protocol, which means requests are initiated by the recipient, usually the Web browser. A complete document is reconstructed from the different sub-documents fetched, for instance, text, layout description, images, videos, scripts, and more.

Clients and servers communicate by exchanging individual messages (as opposed to a stream of data). The messages sent by the client, usually a Web browser, are called requests, and the messages sent by the server as an answer are called responses.


If this is your first time developing an application with Node-RED, take a look at the website of Node-RED to learn how to create your first flow. >>>


So, what we want to do is to create an HTTP endpoint that responds to GET requests with some static content, such as an HTML page or CSS stylesheet.


For this, we are going to use the HTTP In node to listen for requests, a Template node to include the static content, and an HTTP Response node to reply to the request.

HTTP Nodes

As we are going to create a very basic example, we are just going to add three nodes:

1. The first one, a HTTP IN node to create an HTTP endpoint. Set a GET method to your custom URL. In our case: /test

Odoo ‚ÄĘ Image and Text

2. The second one will be a function template node to set the property: msg.payload based on the provided template, where we will type our HTML entities.

Odoo ‚ÄĘ Image and Text

3. The third one will be the HTTP Response node in order to send responses back to requests received from the HTTP Input node.

This is how our flow will look like:

[{"id":"f2c95db5.ba59a","type":"tab","label":"Flow 1","disabled":false,"info":"Examples of how to scan for devices"},{"id":"59ff2a1.fa600d4","type":"http in","z":"f2c95db5.ba59a","name":"","url":"/test","method":"get","upload":false,"swaggerDoc":"","x":340,"y":100,"wires":[["54c1e70d.ab3e18"]]},{"id":"54c1e70d.ab3e18","type":"template","z":"f2c95db5.ba59a","name":"page","field":"payload","fieldType":"msg","format":"handlebars","syntax":"mustache","template":"<html>\n    <head></head>\n    <body>\n        <h1>Hi everyone from Industrial Shields!</h1>\n    </body>\n</html>","x":550,"y":100,"wires":[["266c286f.d993d8"]]},{"id":"266c286f.d993d8","type":"http response","z":"f2c95db5.ba59a","name":"","statusCode":"","headers":{},"x":770,"y":100,"wires":[]}]
Odoo ‚ÄĘ Image and Text

Finally, deploy your flow, and add the same URL as we set in the first node right after the localhost:1880 in our case /test. So, go to:

and check the HTTP message you just got!

HTTP Recipes

Want to know more? Take a look at the HTTP recipes >>> from Node-RED and learn how to serve JSON content, post raw data to a flow, or get a parsed JSON response, among others!

Node-RED Tutorial: How to use HTTP nodes with the industrial Raspberry PLC
Boot & Work Corp. S.L., Fernandez Queralt Martinez
22 September, 2021
Share this post

Looking for your ideal Programmable Logic Controller?

Take a look at this product comparison with other industrial controllers Arduino-based. 

We are comparing inputs, outputs, communications and other features with the ones of the relevant brands.

Industrial PLC comparison >>>

Do you want more information?

Just fill the form!

Tell me more!