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..

Note: The maker blog show applications and user stories of community members and are not tested or reviewed by Phoenix Contact.


 

=== UPDATE ====

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

It appears that the procedure described below may not work after installing node from the PLCnext Store. In this case, an alternative to pm2 may be needed to automatically start node-red. You can raise general issues related to pm2 on their Github page.

The original article remains below.


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

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!

The Libwebsockets API ("LWS") covers a lot of interesting features for people making embedded servers or clients:

  • HTTP(S) serving and client operation
  • HTTP/2 support for serving
  • WS(S) serving and client operation
  • HTTP(S) apis for file transfer and upload
  • HTTP 1 + 2 POST form handling (including multipart / file upload)
  • cookie-based sessions
  • account management (including registration, email verification, lost pw etc)
  • strong SSL / TLS PFS support (A+ on SSLlabs test)
  • ssh server integration
  • serving gzipped files directly from inside zip files, without conversion
  • support for linux, bsd, windows etc... and very small non-linux targets like ESP32

    Here's how to crosscompile it - first the easy way, and then for advanced users:

OpenCV (Open Source Computer Vision) is a cross-platform and free-for-use library for use in the emerging field of computer vision, a science on how computers extract information from digital images or videos. It's about acquiring and processing visual data, and making decisions and performing actions based on the analysis. OpenCV support deep learning frameworks and includes a statistical machine learning library, what makes it applicable for motion tracking, gesture and facial recognition, and object identification.

By using embedded systems (and a PLC is in fact nothing else) it is a vital requirement to analyze the timing behavior of the application (programs and tasks). This is not only useful to enhance the general performance of an application, but absolutely necessary to find seldom and sporadic issues.
We decided to use for that purpose the powerful Linux open source package LTTng (Linux Trace Toolkit Next Generation - http://lttng.org) and to give the application engineers the full insight into the system.

This manual should introduce the general usage of LTTng for the AXC F 2152 with the stand alone tool Trace Compass (http://tracecompass.org)

Page 4 of 5