Using Node-RED for Simple Edge Control Logic and Prototyping
|
|
Time to read 5 min
|
|
Time to read 5 min
This guide demonstrates how to use Node-RED for simple edge control logic and rapid prototyping on an industrial gateway. We'll explain how this powerful, low-code visual programming tool empowers OT engineers—not just professional developers—to build their own "sense-decide-act" loops. By following a simple tutorial, you'll learn how to create a real-world edge control application using a drag-and-drop interface, dramatically accelerating the journey from idea to working prototype.
Node-RED is a visual, flow-based programming tool that allows you to build applications by wiring together pre-built nodes, like digital LEGO® bricks.
It is the perfect tool for OT professionals to build simple edge control logic and prototypes without writing a single line of traditional code.
This tutorial will show you how to build a complete "sense-decide-act" loop: reading a physical input on an EG5120 and using it to trigger a physical output.
Running Node-RED on a reliable, open platform like the EG5120 provides the industrial-grade hardware foundation needed to move your prototype from the lab to the factory floor.
I've had this conversation with so many brilliant OT engineers. They know their machinery and processes inside and out. They have a clear goal: "I just want to read the status of this safety gate, and if it opens, I need to turn on a warning light immediately." The problem? They're not a Python programmer. The thought of writing, compiling, and deploying code is a major barrier.
What if you could draw that logic instead of writing it? What if you could build that entire application in five minutes using a drag-and-drop interface?
Let's be clear: you can. The tool that makes this possible is called Node-RED, and it's the ultimate "superpower" for enabling OT experts to implement their own edge control ideas.

At its heart, Node-RED is a free, open-source, flow-based programming tool that runs in your web browser. Instead of writing lines of code, you build your application visually:
The real 'aha!' moment is when you realize it's a visual way of thinking that is incredibly intuitive for anyone who understands process logic.
Let's build a real edge control application: if a machine's safety gate opens (detected by a sensor on a Digital Input), we will turn on a red warning light (connected to a Digital Output). We'll build this on an EG5120.
First, we need to read the state of the safety gate sensor, which is wired to Digital Input 0 (DI0) on the EG5120.
Exec node onto the workspace. This node can run any underlying Linux command.cat /sys/class/gpio/gpio460/value to read the state of DI0.Now, we need to check the value we just read.
Switch node onto the workspace and connect it to the output of the Exec node.Switch node to check the message payload. Create two rules:== "1" (the gate is open), send the message to output 1.== "0" (the gate is closed), send the message to output 2.Finally, we need to control the warning light connected to Digital Output 0 (DO0).
Exec nodes onto the workspace.echo 1 > /sys/class/gpio/gpio464/value (Turn DO0 ON). Connect this to the first output of your Switch node.echo 0 > /sys/class/gpio/gpio464/value (Turn DO0 OFF). Connect this to the second output of your Switch node.Click "Deploy." Your low-code edge control application is now live. When the safety gate opens, the warning light will instantly turn on. When it closes, the light will turn off.

Edge control is not just for professional software developers. With intuitive, low-code tools like Node-RED running on an open and reliable hardware platform like the Robustel EG5120, the power to automate and innovate is placed directly into the hands of the people who know the industrial process best: the OT engineers and technicians on the factory floor. This is how you bridge the skills gap and dramatically accelerate your journey toward a smarter, more responsive operation.
Further Reading:
What is Edge Control? The Future of Real-Time Industrial AutomationDeveloping an Edge Control Application with Docker on the EG5120Edge Control vs. PLC: A Guide to Modern Automation Architecture
A1: For many simple-to-medium complexity tasks, absolutely. Node-RED is excellent for data routing, protocol conversion, creating alerts, and executing conditional logic like in our tutorial. For high-speed, safety-critical, or computationally massive tasks, a "pro-code" application written in Python or C++ might be more appropriate.
A2: PLC programming (like ladder logic) is a specialized skill and is designed for highly deterministic, microsecond-level machine execution. Node-RED is a higher-level tool that is much more flexible and easier to learn. It excels at integrating different systems (e.g., reading a PLC with Modbus, calling a weather API, and sending an email), which would be very difficult to do in a PLC.
A3: Yes. This is one of its most powerful features. By installing the Modbus or S7 nodes, your Node-RED flow running on the EG5120 can directly read and write data to your PLCs, allowing you to use Node-RED as a simple, visual SCADA or control logic supervisor for your existing automation.