This site uses cookies for functional purposes. To continue please read and agree to our Data Privacy.

By closing this message, you consent to our use of cookies on this device.

PLCnext on Instagram  PLCnext on YouTube Github PLCnext CommunityStore PLCnext Community

 

 How to create a Blog Entry

Find user stories of interesting ideas and solutions in this blog. If you have any problems with editing or publishing please contact us at This email address is being protected from spambots. You need JavaScript enabled to view it..


 

Join the Community

Watch this short introduction video* and create your first Makers blog entry!

 

Content of this video:

  • Create your own Makers blog entry

You have questions...? No problem:

  • Ask your question in the Forum
  • or contact us by mail: This email address is being protected from spambots. You need JavaScript enabled to view it.

 

 

*we recommend Chrome for best experience

=== UPDATE ====

The recommended way to install node.js and npm on a PLCnext Control is now through the PLCnext Store.

The original article remains below.


If you want to run the popular Node.js framework on your PLCnext Control, you can download the binary for ARMv7 from the node website and install it manually on the PLC.

A previous blog entry described an easier way to install Node on an AXC F 2152 PLC using the ipkg package manager. However this installs a relatively old version of node, which might not be suitable for all applications.

Another way to install the latest version of node - or even multiple versions - is to use Node Version Manager. NVM can be installed and used by the PLC's admin user, without root privileges. Here's how:

Procedure

Log in to the PLC as admin and issue the following commands:

npm install -g pm2
pm2 start node-red
pm2 save
pm2 startup

Restart the PLC and check that Node-RED has started automatically.

Thank you to PLCnext Community member David Petter for these instructions.

More information on starting Node-RED using pm2 can be found here: https://nodered.org/docs/getting-started/running

More information on the IIoT OPC UA node package:

Command to install the IIoT OPC UA node package:

npm install -g node-red-contrib-iiot-opcua

Thank you to PLCnext Community members David Petter and Stefan Brinkmann, and to Klaus Landsdorf from Bianco Royal, for their valuable contributions.

Note: We show the engineering part in this video using a beta version of the upcoming PLCnext Engineer software by Phoenix Contact that will be available soon and for free. Until then, the procedure should work using the current PC Worx Engineer version as well. If you encounter any problems, please let us know.

The flow used in this example is represented by the following JSON (press "Read more" to see it). It can be imported straight into the editor by pasting the JSON into the Import dialog (Ctrl-I or via the dropdown menu).

=== UPDATE ====

The recommended way to install node.js and npm is now through the PLCnext Store.

After installing node.js from the Store, log in to the PLC as "admin" and proceed with node-red installation using npm.

Useful links:

Sample flow on the Node-RED website

Commands to install Node-RED:

ipkg install node (install node.js from the PLCnext Store)
npm install -g node-red

Note: The errors seen during Node-RED installation relate to the optional bcrypt package.
To avoid these errors, install gcc, make, and python 2, before installing Node-RED:

ipkg install gcc
ipkg install make
ipkg install python27
npm install -g node-red --python=python2 --unsafe-perm

All PLCnext Controls include an embedded OPC UA server. This server, like all OPC UA servers, includes the option to establish secure connections with clients using Public Key Cryptography.

This guide describes how to use your own security certificate (including your own private key) to set up a secure OPC UA connection with a PLCnext Control.

Mosquitto is an open source project to implement an MQTT client to your system. The MQTT (Message Queue Telemetry Transport) protocol is made for machine-to-machine (M2M) connectivity, basing on an extremely lightweight messaging using a publish/subscribe model. This makes it suitable for Internet of Things messaging such as with low power sensors or embedded computers.

The Mosquitto project also provides a C library for implementing MQTT clients, and the very popular mosquitto_pub and mosquitto_sub command line MQTT clients.

Let's see how to crosscompile it for PLCnext Controls.

libcurl - the multiprotocol file transfer library

libcurl is a free and easy-to-use client-side URL transfer library, supporting DICT, FILE, FTP, FTPS, Gopher, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, POP3, POP3S, RTMP, RTSP, SCP, SFTP, SMTP, SMTPS, Telnet and TFTP.

libcurl supports SSL certificates, HTTP POST, HTTP PUT, FTP uploading, HTTP form based upload, proxies, cookies, user + password authentication (Basic, Digest, NTLM, Negotiate, Kerberos), file transfer resume, http proxy tunneling and more!

Page 2 of 3

Most clicked articles in the makers blog