Since firmware 2023.0, Podman (https://podman.io/) has been installed on the PLCnext operating system. Podman fulfills the same function as Docker. This implementation guarantees a simpler Node-RED installation for the end user.
Important
Due to the changes that PLCnext undergoes with each firmware update, these procedures may stop working in the future. If this is the case, this document will be updated.
Description | Date |
---|---|
Created | 05-03-2024 |
Last modified | 12-03-2024 |
Description | Required |
---|---|
Controller | AXC F 1152 - AXC F 2152 - AXC F 3152 |
Storage | SD memory 2GB or higher for AXC F 1152 / 2152 |
Firmware | 2023.0 LTS or higher |
-
You must access using
Putty
or your favoriteSSH client
using the IP of your PLC. Remember that the default IP is192.168.1.10
. -
Log in with the username
admin
and the password of your PLCnext.
- Once you are logged in to the PLCnext, you need to access as a root user using the command
su
su
- If you haven't created a root password yet, create it with the command
sudo passwd root
sudo passwd root
Note
The admin
and root
users are different. Setting a different password for the root user will not affect the admin
user.
- Once you have logged in as the root user, you can install the official Node-RED image in its version 2.2.2 using the following command:
podman run -d -p 1880:1880 --name nodered --restart always docker.io/nodered/node-red:2.2.2
-
I have created Node-RED containers for the PLCnext AXC F 1152 / 2152 that include libraries to work with PLCnext. These containers also include examples of sending alarms, writing and reading using OPC UA. To install any of these examples, use the following commands:
-
To install the
Alarm Sending
example:
podman run -d -p 1880:1880 --name nodered --restart always docker.io/fellipem/noderedpxc:alarms
- To install the
Reading and writing OPC UA
example:
podman run -d -p 1880:1880 --name nodered --restart always docker.io/fellipem/noderedpxc:opcua
Note
For more information, please visit: https://hub.docker.com/r/fellipem/noderedpxc
- Once you have finished, you can start using Node-RED by entering
IP_PLC:1880
in your web browser. For example, if your PLC's IP address is 192.168.1.10, you would enter192.168.1.10:1880
.
Warning
Unlike Docker, Podman does not run as a service within PLCnext. Therefore, Node-RED will not start automatically when the PLC is turned on. To make Node-RED start with the PLC, follow these steps:
- Use the following command on your PLC to download this project:
git clone https://github.com/Fellipem1/PLCnext_Node-RED.git
- Move the
nodered.sh
file to the/etc/init.d/
path using the following command:
mv /opt/plcnext/PLCnext_Node-RED/nodered.sh /etc/init.d/
- Run the following command to change the permissions of the
nodered.sh
file:
chmod +x /etc/init.d/nodered.sh
- The method for adding the script to startup varies depending on the Linux distribution you are using. In the case of PLCnext, you should use the following command:
update-rc.d nodered.sh defaults
- By following the steps above, Node-RED will be ready to start automatically every time you turn off or restart the PLCnext.
Note
Remember to always perform these steps using the root user.
- Access as
root
user and type the following commands:
podman start nodered
podman exec -it nodered /bin/bash
cd /data
- Now you can install any library using
npm
commands, for example:
npm i [email protected]
- Once finished, type
Exit
and restart node-RED with the following commands:
podman stop nodered
podman start nodered
- The following error occurs because the
admin
user does not have enough privileges to install Node-RED. To solve the problem, you must log in as theroot
user.
- The following error occurs because the PLCnext has the wrong time and date configured. You can check the time and date with the
date
command.
date
- To change the time on the PLCnext, use the following command:
date -s “29 FEB 2024 11:25:39”
- Remember to modify the command with the current UTC time and date: https://time.is/es/UTC
- This error occurs because the PLCnext does not have internet access. You can check this with the
ping
command, for example:
ping google.cl
- If it says
bad address
, you must verify the IP, mask, and Gateway configuration of the PLCnext. You can do this from the web server, Network section.
Desde la versión de firmware 2023.0, Podman (https://podman.io/) viene instalado en el sistema operativo de PLCnext. Podman cumple la misma función que Docker. Esta implementación garantiza una instalación de Node-RED más sencilla para el usuario final.
Important
Debido a los cambios que sufre PLCnext con cada actualización de firmware, estos procedimientos pueden dejar de funcionar en el futuro. Si este es el caso, este documento se actualizará.
Descripción | Fecha |
---|---|
Creación | 05-03-2024 |
Ultima Modificación | 12-03-2024 |
Descripción | Requerido |
---|---|
Controlador | AXC F 1152 - AXC F 2152 - AXC F 3152 |
Almacenamiento | Memoria SD de 2GB o superior para AXC F 1152 / 2152 |
Firmware | 2023.0 LTS o superior |
-
Debe acceder usando
Putty
o sucliente SSH
favorito utilizando la IP de su PLC. Recuerde que la IP predeterminada del PLC es192.168.1.10
. -
Inicie sesión con el nombre de usuario
admin
y la contraseña de su PLCnext.
- Una vez que haya iniciado sesión en PLCnext, necesita acceder como usuario root usando el comando
su
su
- Si aún no ha creado una contraseña root, créela con el comando
sudo passwd root
sudo passwd root
Note
Los usuarios admin
y root
son diferentes. Establecer una contraseña diferente para el usuario root no afectará al usuario admin
.
- Una vez que haya iniciado sesión como usuario root, puede instalar la imagen oficial de Node-RED en su versión 2.2.2 usando el siguiente comando:
podman run -d -p 1880:1880 --name nodered --restart always docker.io/nodered/node-red:2.2.2
-
He creado contenedores de Node-RED para los PLCnext AXC F 1152 / 2152 que incluyen bibliotecas para trabajar con PLCnext. Estos contenedores también incluyen ejemplos de envío de alarmas, escritura y lectura usando OPC UA. Para instalar cualquiera de estos ejemplos, use los siguientes comandos:
-
Para instalar el ejemplo
Envío de alarmas
:
podman run -d -p 1880:1880 --name nodered --restart always docker.io/fellipem/noderedpxc:alarms
- Para instalar el ejemplo
Lectura y escritura OPC UA
:
podman run -d -p 1880:1880 --name nodered --restart always docker.io/fellipem/noderedpxc:opcua
Note
Para más información visite: https://hub.docker.com/r/fellipem/noderedpxc
- Una vez que haya terminado, puede comenzar a usar Node-RED ingresando
IP_PLC:1880
en su navegador web. Por ejemplo, si la dirección IP de su PLC es 192.168.1.10, ingresaría192.168.1.10:1880
.
Warning
A diferencia de Docker, Podman no se ejecuta como un servicio dentro de PLCnext. Por lo tanto, Node-RED no se iniciará automáticamente cuando se encienda el PLC. Para que Node-RED se inicie con el PLC, siga estos pasos:
- Use el siguiente comando en su PLC para descargar este proyecto:
git clone https://github.com/Fellipem1/PLCnext_Node-RED.git
- Mueva el archivo
nodered.sh
a la ruta/etc/init.d/
usando el siguiente comando:
mv /opt/plcnext/PLCnext_Node-RED/nodered.sh /etc/init.d/
- Ejecute el siguiente comando para cambiar los permisos del archivo
nodered.sh
:
chmod +x /etc/init.d/nodered.sh
- El método para agregar el script al inicio varía según la distribución de Linux que esté usando. En el caso de PLCnext, debe usar el siguiente comando:
update-rc.d nodered.sh defaults
- Siguiendo los pasos anteriores, Node-RED estará listo para iniciarse automáticamente cada vez que apague o reinicie el PLCnext.
Note
Recuerde realizar siempre estos pasos como usuario root.
- Acceda como usuario
root
y escriba los siguientes comandos:
podman start nodered
podman exec -it nodered /bin/bash
cd /data
- Ahora puede instalar cualquier librería usando comandos
npm
, por ejemplo:
npm i [email protected]
- Una vez finalizado, escriba
Exit
y reinicie Node-RED con los siguientes comandos:
podman stop nodered
podman start nodered
- El siguiente error ocurre porque el usuario
admin
no tiene suficientes privilegios para instalar Node-RED. Para solucionar el problema, debe iniciar sesión como usuarioroot
.
- El siguiente error ocurre porque el PLCnext tiene configurada la hora y la fecha incorrectas. Puede verificar la hora y la fecha con el comando
date
.
date
- Para cambiar la hora en el PLCnext, use el siguiente comando:
date -s “29 FEB 2024 11:25:39”
- Recuerde modificar el comando con la fecha y hora UTC actuales: https://time.is/es/UTC
- Este error ocurre porque el PLCnext no tiene acceso a internet. Puede verificar esto con el comando
ping
, por ejemplo:
ping google.cl
- Si dice
bad address
, debe verificar la configuración de IP, máscara y Gateway del PLCnext. Puedes hacerlo desde el servidor web, sección Network.