icon

Unlock the Power of Automation with Node-RED and LattePanda

Story:

 

In my LattePanda tutorial series, I have shown to use LattePanda's Arduino core with the Arduino IDE. But the manual controls are always an outdated tech, right? In this tutorial will see how do use the LattePanda 3 Delta with Node Red a block base program and automate tool.

 

 

As the world of technology advances, so do the options for the single board computer. The Lattepanda 3 Delta and Raspberry Pi 4 are two popular single board computers that are available in the market. Both of these single board computers offer a variety of features and capabilities, but which one is better for your needs?

 

The LattePanda 3 Delta is powered by a dedicated Intel Celeron N4100 processor and comes with 8GB of RAM, 128GB of storage, and an HDMI port. It also has an integrated Intel UHD Graphics 600 GPU and an accelerated onboard Intel Wi-Fi 6. The Raspberry Pi 4 is powered by a Broadcom BCM2711 quad-core processor, 1GB of RAM, and up to 8GB of RAM for more intensive tasks. It also has an integrated VideoCore VI GPU, dual-band 2.4GHz/5GHz wireless LAN, Bluetooth 5.0, and Gigabit Ethernet. In terms of performance, both systems are capable of running a wide variety of applications and tasks.

 

 

The LattePanda 3 Delta is a more powerful system, thanks to its Intel processor and higher RAM capacity. This makes it well-suited for more intensive tasks such as ML classification, Industry automation, video surveilling, video editing and photo editing.

 

The Raspberry Pi 4 is more suitable for basic tasks such as web browsing and streaming media. When it comes to connectivity, the Lattepanda 3 Delta has a variety of ports, including an HDMI port, two USB 3.0 ports, a microSD card slot, and an Ethernet port. The Raspberry Pi 4 has an HDMI port, two USB 2.0 ports, two micro-HDMI ports, a microSD card slot, and a Gigabit Ethernet port.

 

 

Both systems are capable of connecting to a variety of peripherals and accessories, such as keyboards, mice, and external storage solutions.

 

 

Overall, both the Lattepanda 3 Delta and Raspberry Pi 4 are powerful and capable single board computers that offer great performance and a variety of features. The Lattepanda 3 Delta is the more powerful system, with an Intel processor and larger RAM capacity, making it ideal for more intensive tasks. The Raspberry Pi 4 is the more affordable system and is better suited for basic tasks such as web browsing and streaming media.

 

 

So, my own suggestion LattePanda will be better for high insensitive and high-performance jobs.

 

 

Okay, now let's dive into the process.

 

Node Red Installation:

 

To install the Node Red, we need Node JS. Go to the official Node.js home page. It will offer you the best version for your system. Then install the package.

 

 

This page will give you the complete information about the Node Red on Windows platform.

 

 

Then we are ready to install the Node Red. Use this following command in the terminal. It will automatically install the Node Red. “npm install -g --unsafe-perm node-red”

 

That's all about the installation. Now let's move on to the deployment.

 

Running Node Red

 

To start the Node Red service on the windows, use this following command. “node-red”

It will show you this kind of message, Here I'm already having some stuffs inside my Node Red. So, you may not see some stuffs.

 

 

In that message you can see some IP address with the port number. In my case it is http://127.0.0.1:1880. Enter this local Ip address in the LattePanda's browser.

 

 

In the left side you can see the Nodes tab by using this node only we are going to create the flows and the middle portion is Workspace area in here only we are going to develop the flow. And the last section is the Debug Area by using this section we can debug and see the response of the flow.

 

But most of the we are using the LattePanda as a headless computer. So, I can easily work on it. For that usually we use SSH or VNC to do that. But in this case, we don't need those. Once you enabled Node Red, we can access the Node Red via local network.

Just use the IP address and add the :1880 in it. You can type this in another pc which is in the same network.

 

Hello Word with Node Red:

 

Now we are good to go. First let's start the "Hello World".

 

 

Add the Inject and Debug node to the workspace and just make simple connection between the nodes.

 

 

Next, double click the Inject node and it will show some properties of the node, we have to configure them according to our need.

 

In this, I'm adding a new JSON message with msg.topic = "hello world"

Next, double click the Debug node it will show the properties of that node.

 

You can see that msg.payload is in the output section.

 

 

Then if you want you can rename the node.

Next click the Deploy button the red one. And click on the debug the section.

 

 

Now click the inject node.

 

 

It will now show you the timestamp values. Again, double click the Debug node and change msg.payload to msg.topic then click deploy.

 

 

Then click the inject node and check back the debug console.

 

 

Now it will show you the “hello world.”

 

Led Control via Node Red:

 

As of now we know the basics of the Node Red let's try to control the hardware components via the Node Red. In LattePanda 3 Delt there is an inbuilt programmable LED available. We can now control that via the Node Red.

 

First, we have to install one new node. node-red-node-serialport type this in the node red pallet section and install that.

 

 

By this serial node only we are going to communicate with the Arduino core of the LattePanda 3 Delta. Once you have installed this serial node you can see 3 new nodes in the

 

 

We are going to use the Serial out node to control the LED. Add the inject and Serial out node then make a connection.

 

 

Then we have to add the properties of the serial out node. First select the correct com port and select the edit.

 

 

Next select the Baud rate then update.

 

 

Now go to the Inject the node and change the data to number 1.

 

 

Then copy the nodes change the number to 0.

 

 

That's all now we have to configure the Arduino core to accept the serial data and based on that it needs to respond.

 

Arduino Core Configuration:

 

Open the Arduino IDE in the LattePanda 3 Delta and create a new sketch with this following code.

 

 

Simply it will get a serial data from the COM4 and based on the data it will turn on and off the led.

 

Then select the correct COM port and upload the code.

 

 

Once you have uploaded the code open the serial monitor and try to send 0 and 1 and check the led status as well.

 

 

Dashboard Deployment:

 

Next move to the Node Red workspace and try to inject the data. Based on the inject node it will turn on and off the led. Now everything is set we can easily control the led via the workspace.

But if it's a UI means it will more good right? Next, we are going to add the UI into it. Go to the pallet option and search for dashboard node.node-red-dashboard

 

 

Once you installed the nodes, you can see some new dashboard nodes.

 

 

Next add the button node and edit the properties and insert the data as 0.

 

 

Copy the same node and change the data to 1 and connect to the Serial Out node.

 

 

Next deploy the nodes and navigate to the UI dashboard.

 

Just add /ui in the ip address.

 

Then you will see the dashboard, like this.

 

 

Now you can control the LED via dashboard.

 

Wrap-up:

 

Node Red one of the awesome platforms to build an industrial grade automation systems and control units. With the help of LattePanda 3 delta we can easily achieve the max power of the Node Red. In upcoming tutorials will see how we can deploy sensors and actuators with Node Red and LattePanda 3 Delta.

License
All Rights
Reserved
licensBg
0