question

bo0om avatar image
bo0om asked

How to access GPIO Pins in Node Red on Venus Raspi 3

Hello

i have installed the large image of venus with Node Red included. everything works as it should.


i have 5 relays i want to control, but i do not want to do it on the Venus UI, instead i want to listen on the local MQTT Server and if the value true comes in i want to turn the relay on.


My Relais are on the PINS (7,11,13,19,26)


Does anybody knows how to access them in node red?

The standard Raspberry Pi Nodes arent working


dashboard.jpg


screenshot1.jpg

Venus OSNode-RED
dashboard.jpg (211.9 KiB)
screenshot1.jpg (156.7 KiB)
1 comment
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

joerichardsmith avatar image joerichardsmith commented ·

Hi @bo0om,

i solved the problem and testet with RasPI 3 and 4.

With the following it should work:

wget https://updates.victronenergy.com/feeds/venus/testing/packages/dunfell/cortexa7hf-neon-vfpv4/python3-dev_3.8.11-r0_cortexa7hf-neon-vfpv4.ipk

opkg install python3-dev_3.8.11-r0_cortexa7hf-neon-vfpv4.ipk

wget https://updates.victronenergy.com/feeds/venus/testing/packages/dunfell/cortexa7hf-neon-vfpv4/python3-xmlrpc_3.8.11-r0_cortexa7hf-neon-vfpv4.ipk

opkg install python3-xmlrpc_3.8.11-r0_cortexa7hf-neon-vfpv4.ipk

wget https://updates.victronenergy.com/feeds/venus/testing/packages/dunfell/cortexa7hf-neon-vfpv4/python3-pip_20.0.2-r0_cortexa7hf-neon-vfpv4.ipk

opkg install python3-pip_20.0.2-r0_cortexa7hf-neon-vfpv4.ipk

python3 -m pip install RPi.GPIO

reboot
1 Like 1 ·
4 Answers
mtnscott avatar image
mtnscott answered ·

Have you tried logging the inputs to see what messages are being sent to your rpi gpio out node?

Have you tried to connect the GPIO pins to LEDs instead of the relay to eliminate any driving issues on the relays?


2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

bo0om avatar image
bo0om answered ·

thanky you, i have to try it

2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

stijnl avatar image
stijnl answered ·

Hello,

I have been running into the same issue as @bo0om, and i also tried the commands from above, right now copying those commands doesn't work because the source has new versions for Python3-dev & python3-xmlrpc. So i used the following:

opkg update 
opkg install python3-dev
opkg install python3-xmlrpc
opkg install python3-pip
python3 -m pip install rpi.gpio
reboot

unfortunately when trying in Node Red, i was getting the error 'Command not running' in de debug field and also it said 'Stopped' underneath the output fields of the GPIO nodes.

In the description of the GPIO-node package node-red-node-pi-gpio (https://flows.nodered.org/node/node-red-node-pi-gpio) i could find some information that for distro's other than Rasbian you need to 'open up' the gpio pins with a list of commands.

The commands listed there don't work because they are not supported by Venus OS.

since i am not familiar with linux command line, this was a trial & error process, but in the end i could find the following command that work:

groupadd gpio
chown root:gpio /dev/gpiomem
usermod -a root -G gpio
usermod -a nodered -G gpio
echo 'KERNEL=="gpiomem", NAME="%k", GROUP="gpio", MODE="0660"' | tee /etc/udev/rules.d/45-gpio.rules
udevadm control --reload-rules && udevadm trigger
reboot

So i made a new group called gpio and added user root & nodered to this group. to check if the users are actually included in this group you can use this command:

groupmems -g gpio -l

I don't know if the nodered user has to be included for this to work since i only tested this once. after the reboot i got the GPIO pins to work!

I am using the Venus OS large image v2.90, running on a Raspberry Pi 3 Rev. B.




2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

mcbain avatar image
mcbain answered ·

Hello and thanks for this guide.

I have VenusOS 2.90-10 large on a RaspberryPi 3B+.

I did all the steps as described.

Debug from node red reports: "nrgpio python command not running"

rpi-gpio out says : stopped

I've been trying for hours, help would be great. Regards

4 comments
2 |3000

Up to 8 attachments (including images) can be used with a maximum of 190.8 MiB each and 286.6 MiB total.

stijnl avatar image stijnl commented ·
Hello mcbain,


it turns out i am also experiencing problems with the inputs, i never tested it because i only needed to use outputs at that time.

Are you able to get the outputs to work then?

at first my inputs were also giving 'stopped', then i updated the library and it was saying 'OK', after that it does not give me a state so something is still wrong.

Greetings

0 Likes 0 ·
mcbain avatar image mcbain stijnl commented ·

Hello stijnl,

inputs and outputs don't work for me.

22.jpg


If I get it to work I'll let you know.


Regards

0 Likes 0 ·
22.jpg (44.0 KiB)
mopatops avatar image mopatops mcbain commented ·

Hi mcbain

By following the above post by stijnl exactly, the GPIO outputs do work on a freshly installed V2.91 VenusOS on my Raspberry Pi 3B+. I've had to include the groupadd part as well because it didn't work with just the installs.

I've had no luck with the inputs either.

Steve


0 Likes 0 ·
mcbain avatar image mcbain mopatops commented ·

Hello stijnl, steve.

i did a fresh install with 2.92. Now the Outputs works like a charm ;-) thank you.

Unfortunately, inputs do not work. I Try many GPIOS,

Only via the node digital input from the victron library it was possible for me to process a digital input in node red.


Regards

0 Likes 0 ·