question

micha854 avatar image
micha854 asked

gpio cannot be switched !!

Hello guys, I have the venus image on my raspi and if the internet connection is lost I want to switch a relay via gpio to restart the router.

I can control the gpio21 (pin40) with "dbus -y com.victronenergy.system/Relay/0/State SetValue% 0 or 1" but it is not switched on the raspi. What am I doing wrong?

Venus OS
2 |3000

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

5 Answers
Kevin Windrem avatar image
Kevin Windrem answered ·

add a space after "system" and move the % to just before the value:

dbus -y com.victronenergy.system /Relay/0/State SetValue %1
dbus -y com.victronenergy.system /Relay/0/State SetValue %0


2 |3000

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

micha854 avatar image
micha854 answered ·

yes I did exactly that. in the remote control I see on / off but the gpio from the raspi are not controlled

2 |3000

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

Kevin Windrem avatar image
Kevin Windrem answered ·

It may be that the GPIO pins are not being setup.

/etc/venus/gpio_list needs to contain the mapping between the physical pin and the relay:

# relays are active HIGH

# Relay 1 Pin 40 / GPIO 21

21 out relay_1

# Relay 2 Pin 11 / GPIO 17

17 out relay_2



I have a script that will set this all up for you:

https://github.com/kwindrem/RpiGpioSetup

It is possible to activate additional relay outputs however there are changes needed in relaystate.py, AND to add GUI control of them. My script does NOT activate these additional relay outputs.

This script also installs a device tree overlay that changes all digital input GPIO pins to have pull ups on all pins. The default is for the first 8 GPIO pins to have pull ups and the remainder to have pull DOWNs, so when used as Venus digital inputs, the pins behave differently unless this overlay is installed.

2 |3000

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

micha854 avatar image
micha854 answered ·

Hello,


Thank you for the info. I tried to install your script. but get the following output


./setup: line 41: /data/SetupHelper/CommonResources: No such file or directory
./setup: line 68: [: ==: unary operator expected
./setup: line 79: [: ==: unary operator expected
./setup: line 102: [: ==: unary operator expected
./setup: line 122: endScript: command not found

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.

Kevin Windrem avatar image Kevin Windrem commented ·
As indicated in the ReadMe, you must also install SetupHelper.
0 Likes 0 ·
micha854 avatar image
micha854 answered ·

but it doesn't say how that works. how do i install setup helper?

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

micha854 avatar image micha854 Kevin Windrem commented ·

thank you i didn't see that. it works. Thanks very much

0 Likes 0 ·

Related Resources