Node-RED is developed by the larger IBM community and provides for a simplified method of wiring IoT components, web services, and APIs. There are many ways in which Node-RED can be useful when dealing with IoT applications on Alibaba Cloud.
To install Node-RED, we need to install Node.js first. It is very easy to install Node.js in Ubuntu 16.04 owing to its inclusion in the default repository. First, run the command below to clone Node-RED from GitHub:
Sudo git clone https://github.com/node-red/node-red.git
Next, run the Sudo cd node-red
command, the sudo apt install nodejs
command, and finally, run the sudo npm install
command below to install NPM.
Alright, all the dependencies are in place. You can run the command below to check what version we just installed in our system.
node -v
Note: The Node Package Manager (npm) is very crucial for this process because we shall use it in the installation and management of some of the software packages in use as well as installing Node-RED.
Run the command below to see if NPM was installed from the output information:
npm -v
The node package manager provides for a very effective method of installing Node-Red. We will use the method to add node-red
to the system path like so:
sudo npm install -g --unsafe-perm node-red
As a rule, avoid using npm 1.x
for the installation because it is not suitable for the process. To upgrade to version 2, run the command below:
sudo npm install -gnpm@2.x
If there are any errors encountered during the installation process, the node-gyp
command can list them for you. However, most errors encountered are not fatal and mostly due to dependencies issues for packages that have not been built and require a compiler. Nonetheless, Node-RED will still work with the dependencies though some extra modules may require such dependencies.
Once the process is complete, we can run the command below to test the installation.
sudo ufw allow 1880
The command opens the default port on our firewall. Next, run the command below:
node-red
On a terminal window, you should see a message 'Welcome to Node-RED.' Access the main admin interface by typing the following URL on your browser: http://node-red.URL.com:1880
.
Now that it works, shut it down using CTRL+C. And for how to set for the launch process, please go to Deploy IoT Applications with Node-RED on Alibaba.
This article introduces the development and realization of cloud-to-end Internet of Things (IoT) programs through Node.js.
The code in the article also uploads the simulated temperature and humidity data to the Alibaba Cloud IoT Platform. We still extend this code to connect the actual temperature and humidity sensors and upload the data to the cloud, while the cloud sends a control command to control the LED on and off. Building the relevant hardware platforms will not be covered here.
Currently, Node.js is used to directly operate GPIO. According to resources on the Internet, two common methods are available: use the rpio library (the latest version is rpio 2 0.4.1) or use quick2wire-gpio-admin. (If there are better solutions, I hope that netizens recommend them). Because I am most familiar with it, I chose rpio2 this time.
In this article, we will discuss about the MQTT protocol and show you how to establish MQTT connections to the Alibaba Cloud IoT Platform including the example of device code (Node.js) client.js.
Connect the temperature and humidity sensor to IoT Platform through MQTT. Configure the rules engine to send the temperature and humidity data to the pushData2DingTalk function in Function Compute. The function processes the data and posts the results to the Webhook address of the specified DingTalk chatbot. The DingTalk group can then receive the temperature and humidity data sent by this DingTalk chatbot.
Function Compute is an event-driven, fully managed computing service. Currently supported languages include Java, Node.js and Python.
Alibaba Cloud IoT Platform provides secure and reliable communication between devices and the IoT Platform which allows you to manage a large number of devices on a single IoT Platform. IoT Platform also supports different languages, such as C, Node.js, and Java, and provides the SDK porting guide to help you port the SDKs to different hardware platforms.
Function Compute is a fully hosted and serverless running environment that takes away the need to manage infrastructure such as servers and enables developers to focus on writing and uploading code. It supports multiple programming languages including Java, Python,PHP, and NodeJS.
AliSQL X-Cluster: An MySQL Database with Superior Performance and Strong Consistency
2,599 posts | 764 followers
FollowAlibaba Clouder - August 20, 2020
Alibaba Clouder - April 20, 2018
Alex - August 26, 2019
GXIC - January 7, 2019
Alibaba Clouder - May 6, 2019
GXIC - November 2, 2018
2,599 posts | 764 followers
FollowMore Posts by Alibaba Clouder