Edge MC, the latest hardware device from Tulip, is a low-cost, low-profile device that enables wireless computing at the edge. With accessible USB connectivity and ethernet connectivity, Node-RED, and more, Edge MC expands the capability of guided workflows and machine monitoring on the shop floor.
With Edge MC, you can now leverage Node-RED, a free, open-source flow-based programming language, to connect to even more devices and sensors and build out powerful applications. Most notably, you can use Node-RED to convert protocols that Tulip does not currently support natively, such as MTConnect, MQTT, and Siemens. This allows you to monitor more machines and add new data sources into your analytics while keeping complexity low and avoiding expensive third-party software.
“From OPC-UA-ready CNC machines to serial screwdrivers, our many data sources are varied. With Node-RED embedded in Tulip’s hardware, Tulip offers the Swiss Army Knife our teams need.” – Youri Regnaud, Cartier
In this post, we are going to take a look at how you can use Node-RED with Tulip to build a simple incremental counter.
To read more about edge computing in manufacturing, read our comprehensive guide to edge computing!
Setting up Node-RED with Edge MC
After setting up your Edge MC, getting started with Node-RED requires a few simple steps to connect your Machine API and a Machine in your Tulip Instance with Node-RED locally on your Edge MC. Follow the links above to find support articles to guide you through this process.
Building a Counter in Node-RED
Once you’ve set up your Edge MC and Node-RED, it’s time to create. With Node-RED, you can download nodes for existing protocols, devices, and functions, or build your own for custom equipment. Here is an example of a basic counter, utilizing the Tulip nodes.
This counter is a simple Node-RED flow that connects to the Machine API in Tulip. The flow sets a Machine Attribute to 0 and begins increasing the count by 1 every 5 seconds.
The attribute can be used and called upon in Tulip apps. The platform will understand the count as coming from a machine, which in this case is the count function in Node-RED but could be connected data from any device or sensor.
Building the Flow
To build the flow, you simply drag a new node to Initialize Count. The node will be blank, and should only repeat once. This node sets the default state of the count, starting at 0.
Next, add a node that will define the count. This change node will be set to 1. After the node has been created, drag to connect the two and make a flow.
The next part of the flow requires four nodes as you can see below. One of the nodes is the tulip-machine-api node.
Once the nodes have been connected, the flow is finished! Clicking Deploy in the top right of the Node-RED interface will send the flow to the Edge MC.
Navigating back to Tulip, you can see the counter working on your Machines page. Select the Machine and the counter will be initialized, actively counting up by 1, every 5 seconds.
Node-RED with Edge MC is a powerful tool. For more on getting started and connecting Tulip with Node-RED, read this support article. Want more details on the counter we just built in this article? Read our support article that walks through the steps in detail.
Troubleshooting Node-RED? Node-RED has documentation and resources to help.
We are excited to see how Node-RED is used on the shop floor, and hope that you share your ideas on Tulip Community.