I have just installed the repository https://github.com/balena-io-projects/balena-node-red suggested by @roman-mazur on my raspberry pi 3 and then I installed node-red-node-pi-gpio using node-red editor (via manage palette). I created a little flow and it seems to be working (no warnings/errors seen in log file).
FYI here the contents of my log file:
03.10.19 20:51:32 (+0200) node-red 3 Oct 18:51:32 - [info] Node-RED version: v1.0.0
03.10.19 20:51:32 (+0200) node-red 3 Oct 18:51:32 - [info] Node.js version: v12.7.0
03.10.19 20:51:32 (+0200) node-red 3 Oct 18:51:32 - [info] Linux 4.14.98 arm LE
03.10.19 20:51:33 (+0200) node-red 3 Oct 18:51:33 - [info] Loading palette nodes
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [warn] ------------------------------------------------------
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [warn] [node-red-contrib-balena/depDevices] Error: /usr/local/lib/node_modules/node-red-contrib-balena/depDevices/depDevices.html does not exist
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [warn] [node-red-contrib-balena/depApps] Error: /usr/local/lib/node_modules/node-red-contrib-balena/depApps/depApps.html does not exist
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [warn] ------------------------------------------------------
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [info] Settings file : /usr/src/app/settings.js
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [info] Context store : 'default' [module=memory]
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [info] User directory : /data/node-red/user/
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [warn] Projects disabled : set editorTheme.projects.enabled=true to enable
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [info] Flows file : /data/node-red/user/flows_803bf37.json
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [warn]
03.10.19 20:51:36 (+0200) node-red
03.10.19 20:51:36 (+0200) node-red ---------------------------------------------------------------------
03.10.19 20:51:36 (+0200) node-red Your flow credentials file is encrypted using a system-generated key.
03.10.19 20:51:36 (+0200) node-red
03.10.19 20:51:36 (+0200) node-red If the system-generated key is lost for any reason, your credentials
03.10.19 20:51:36 (+0200) node-red file will not be recoverable, you will have to delete it and re-enter
03.10.19 20:51:36 (+0200) node-red your credentials.
03.10.19 20:51:36 (+0200) node-red
03.10.19 20:51:36 (+0200) node-red You should set your own key using the 'credentialSecret' option in
03.10.19 20:51:36 (+0200) node-red your settings file. Node-RED will then re-encrypt your credentials
03.10.19 20:51:36 (+0200) node-red file using your chosen key the next time you deploy a change.
03.10.19 20:51:36 (+0200) node-red ---------------------------------------------------------------------
03.10.19 20:51:36 (+0200) node-red
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [info] Starting flows
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [info] Started flows
03.10.19 20:51:36 (+0200) node-red 3 Oct 18:51:36 - [info] Server now running at http://127.0.0.1:80/
03.10.19 20:52:14 (+0200) node-red 3 Oct 18:52:14 - [info] Stopping flows
03.10.19 20:52:14 (+0200) node-red 3 Oct 18:52:14 - [info] Stopped flows
03.10.19 20:52:14 (+0200) node-red 3 Oct 18:52:14 - [info] Starting flows
03.10.19 20:52:14 (+0200) node-red 3 Oct 18:52:14 - [info] Started flows
So it would be good if you also try this on your raspberry pi 4.
I’m trying to clone and set up the example project to see if it will work for me. I’ve cloned the repo to a new node-red project and have created a simple flow to turn an LED on and off. I’ve committed this to my local git repo, and have set up the remote branch for my balena application. I then used balena push but got this error:
Just to keep this thread upto date, I’m trying to use this repo by @janvda to allow me to get something working, and then I’ll start adding my own dependencies etc in. The Issue I’ve got is that when my gpiod container starts I get this error:
Hi,
You have to set up the GPIO container with the correct labels to have the container engine set it up with the correct access rights to perform GPIO. There is more information about this here: https://www.balena.io/docs/learn/develop/multicontainer/#labels
Let us know how it goes.
Hi @robertgzr I’m having to base it on a raspberrypi3 image already as the rpi4 image wouldn’t build due to the lack of 64-bit packages for rpi.gpio and others.
Yeah looks like that pigpio has more issues with the rpi4 than just 64bit there is further advice on changing the dma channels used by it:
I am not sure if the DMA channels being used are safe. The Pi4B defaults are primary channel 7, secondary channel 6. If these channels do not work you will have to experiment. You can set the channels used by the pigpio daemon by invoking it with the -d and -e options, e.g. sudo pigpiod -d 5 -e 8 to specify primary 5, secondary 8.
Managed to get the daemon running by changing the version of the base image to latest. Appears to have sorted the issue on pigpiod container startup - next step is to try and create a node-red flow to control the pins. Will keep this thread updated
Just by chance I stumbled across this old thread - I solved the same problem you have been discussing, you can see my solution here in my GitHub repository balena-node-red-raspberry-pi-gpio. It was a real pain to get all the pieces in place.
Also, once you have the daemon running and Node Red then you must also remember to change the Host network in each Raspberry Pi node from localhost to 172.17.0.1 - this is a major gotcha.
The problem is that the latest version of node-red-contrib-modbus changed to version 5.43 and that version requires that node red have version 18 of node.js, how can I update the version of Node js because it does not allow the installation new version of Node-Red-contrib-modbus
I fixed it. I installed the version of node-red-contrib-modbus 5.20.0 that is compatible with node.js v16. I did it from the balena cloud console. and it installed perfectly
cd /data
npm install node-red-contrib-modbus@5.20.0