question

godnesshimself avatar image
godnesshimself asked

relay overview Venus OS

hey,
how can I control the relays via Venus OS?bildschirmfoto-2022-01-19-um-215004.png

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

Rob Duthie avatar image Rob Duthie commented ·

There is some people making and using this deisgn i did some time back.


Victron Raspi Hat.pdf

Victron Raspi Stetson.pdf

Regards

Rob D

NZ

0 Likes 0 ·
9 Answers
Kevin Windrem avatar image
Kevin Windrem answered ·

If you are asking where this overview page comes from, it's part of my GuiMods package:

https://github.com/kwindrem/GuiMods


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

godnesshimself avatar image godnesshimself commented ·
no. I ask how I can control these switches?

What do you need for that?

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem godnesshimself commented ·
That menu provides on/off control of the relays only, or in some cases control of the function assigned to the relay (e.g., generator start/stop). Because you are showing 6 relays, you must be on a Raspberry PI. The relay outputs appear on the 40-pin header as 0/3.3 volt logic and each will need to feed a driver and a relay to control other devices. There are also relay "hat" boards that may work. Rob Duthie is working on "Stetson", an expansion board for Venus OS on Raspberry PI that among other things provides the 6 relay outputs.


Besides manual control, Relay 1 can be set to be controlled by conditions within Venus such as generator start/stop, tank pump or alarms. As of Venus v2.80~36 the relays can also be controlled by temperature sensors. All these setups are from the standard Venus menus, starting with the Relay menu to select the function for each relay. Then, additional setup may be needed in the menu for that functionality (e.g., the Tank Pump menu allows selection of which tank and the start/stop levels, or the Temperature Sensor menu inside the Relay menu).

0 Likes 0 ·
godnesshimself avatar image godnesshimself Kevin Windrem commented ·
0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem godnesshimself commented ·
I'm not sure which ones will work with Venus OS. If they require a driver written for Raspberry PI OS may be not.

I know some relay hats use active low which creates issues with Venus OS since there is no way to change the polarity.

Search around on the forum for more help or relays for Venus. Sorry, it's just an area I've never looked into.

0 Likes 0 ·
pulith avatar image pulith Kevin Windrem commented ·
Is there a way to reduce the relays to 4 from your list so that we can use the canbus dual.
0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem pulith commented ·
Yes you can. Some discussion exists in VeCanSetup and RpiGpopSetup ReadMe files. RpiGpioSetup provides an alternate gpio_list that avoids GPIOs used my some dual channel CANbus hats and you can use a manually edited custom one as well.

Note that you must remove relay and digital input definitions such that they are consecutive beginning at 1. That is removing relay 3 won't work.

GPIO usage is not easy to manage and it takes a lot of research before selecting hat devices. It is easier to use USB based devices CANbus adapters and now with RemoteGPIO, relays and digital inputs than to use Raspberry PI hat modules.

1 Like 1 ·
pulith avatar image pulith Kevin Windrem commented ·
During the installation process itself can't we get an option to select how many relays so that when there is a firmware update yet the settings stay the same.
0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem pulith commented ·

OK, I'll look at enhancing the RpiGpioSetup script to provide more options. Note that this will only partially address GPIO conflicts but should help with CANbus hats supported by VeCanSetup.

Consider an alternative to using GPIO pins for GX device ins and outs.:

https://www.aliexpress.us/item/2255800812755068.html?gatewayAdapt=fra2usa4itemAdapt

along with RemoteGPIO:

https://github.com/Lucifer06/RemoteGPIO

It's inexpensive and provides 8 relays and 8 digital inputs, has it's own relays and digital input isolation so it's a better solution and more out of the box than finding relay modules that work with the active high GPIO pins. It connects to any GX device (not just Raspberry PI) via USB or ethernet. Remote GPIO supports two such modules for 16 relays and 9 digital inputs. This frees up all GPIO pins for other hat uses as well

0 Likes 0 ·
rock2ya avatar image rock2ya commented ·
Hi, can you tell me whether it is possible to show the switches of one or two relais on the main Dashboard?
0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem rock2ya commented ·
Space on the flow overview is all reserved for something. No room for anything else.

With QML coding experience you could customize the overview exactly how you want it.

0 Likes 0 ·
rock2ya avatar image rock2ya Kevin Windrem commented ·
thank you
0 Likes 0 ·
itsme avatar image
itsme answered ·

I use this one with my Pi 3+: https://www.amazon.com/gp/product/B072XGF4Z3 and it works well. The only thing I had to do is modifying the "etc/venus/gpio_list"


#### modified for use by the RpiGpio package on Raspberry PI platforms ONLY

# This is a list of gpio pins, set by the script /etc/rcS.d/S90gpio_pins.sh
# They are documented at: https://github.com/victronenergy/venus/wiki/bbb-gpio
# Format: <pin_number> <direction: in/out> <name>
#
# The <name> part is used to create an symlink in /dev/gpio.

# relays are active HIGH

# Relay 1   Pin 40 / GPIO 21 CHANGES FOR RELAY HAT: -> GPIO 4
4  out relay_1

# Relay 2 Pin 11 / GPIO 17 CHANGES FOR RELAY HAT: -> GPIO 22
22  out relay_2

# Relay 3 Pin 13 / GPIO 27 CHANGES FOR RELAY HAT: -> GPIO 6
6  out relay_3

# Relay 4 Pin 15 / GPIO 22 CHANGES FOR RELAY HAT: -> GPIO 26
26  out relay_4


# Relay 5 Pin 16 / GPIO 23
23  out relay_5

# Relay 6 Pin 18 / GPIO 24
24  out relay_6



# these have pull UPs
# Digital input 1   Pin 29 / GPIO 05
5   in digital_input_1
# Digital input 2   Pin 31 / GPIO 06 CHANGES FOR RELAY HAT: -> GPIO 17
17   in digital_input_2


# in stock code these have pull DOWNs
#### modified to pull UPs by the GPIO overlay that is installed as part of this package

# Digital input 3   Pin 33 / GPIO 13
13  in digital_input_3
# Digital input 4   Pin 35 / GPIO 19
19  in digital_input_4
# Digital input 5   Pin 37 / GPIO 26 CHANGES FOR RELAY HAT: -> GPIO 27
27  in digital_input_5

#### Gracefull shutdown input
#### Note this input is NOT added to the available I/O used by Venus OS !!!!
# Pin 36 / GPIO 16
16  in digital_input_6
3 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.

godnesshimself avatar image godnesshimself commented ·
Sounds great. I will try it. thanks it advance :)
0 Likes 0 ·
godnesshimself avatar image godnesshimself commented ·

Hello,

that works. thanks for that.

can it be that from time to time it adjust again or when something is updated?
can you save the setting permanently?

0 Likes 0 ·
godnesshimself avatar image godnesshimself commented ·

Do you have a case for the PI + HAT?

0 Likes 0 ·
Kevin Windrem avatar image
Kevin Windrem answered ·

A venus firmware update will overwrite the changes to the gpio_list file. Consider using my RpiGpioSetup package along with SetupHelper to keep the changes. RpiGpioSetup now supports a custom gpio_list file.

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.

itsme avatar image itsme commented ·
great, Kevin! Thank you...
0 Likes 0 ·
godnesshimself avatar image godnesshimself commented ·

After the update to 2.80 the relay overview area is empty.
Under settings I can't find the item relay anymore

what happened? :(

0 Likes 0 ·
Kevin Windrem avatar image Kevin Windrem godnesshimself commented ·

Is RpiGpioSetup shown as installed in PackageManager?


Are you running the large version of Venus OS. If so, there's an update to SetupHelper that fixes an install bug for all packages.

Otherwise, hard to say without logs.

0 Likes 0 ·
itsme avatar image itsme commented ·

Hi Kevin,

can you please give me a little information how the gpio_list file in the RPIGGpioSetup should look like or how it can be setup? There is a section in "/data/setupOptions/RpiGpioSetup" called "optionSet". I'm a little bit confused how to handle it to keep the settings.

Thanks!

0 Likes 0 ·
Kevin Windrem avatar image
Kevin Windrem answered ·

The RpiGpioSetup package contains a default gpio_list file. That file should work when using the GPIOs on the 40-pin header, but if you are using a relay HAT, etc, they may not be correct.

You can copy that gpio_list file to /data/setupOptions/RpiGpioSetup then edit it to change the assignments. The package will look for /data/setupOptions/RpiGpioSetup/gpio_list first before installing the default one.

The assignments you make in this file will depend on the harware you are trying to use for Venus digital inputs or relay outputs.

The custom gpio_list file is independent of the optionsSet flag file.


"optionsSet" is a file that tells the setup script that the options have been set by the user. Once they have been set, they persist in the setupOptions directory and survive a Venus firmware update. If the options have been set, the setup script will be run on the first boot following a Venus firmware update. If the package requires options to run the setup script without user interaction, as happens during during a reboot following a Venus firmware update, the setup script will not reinstall the packages. if the optionsSet flag file is not present. Most of my packages don't require any setup options, so the setup script will skip the optionsSet check. At this point I think only package that requires command line options is VeCanSetup.

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.

itsme avatar image itsme commented ·
Thanks for the detailed description. Now it's clear for me!
0 Likes 0 ·
diromobil avatar image
diromobil answered ·

The plug-on relay board described by "itsme" has 4 relays. Installation is easy and works great so far.

My Pi 3b+ my venusOS v2.86 with SetupHelper + RpiGpioSetup.


"Call the gpio_list file for the relays in e.g. putty:


nano /etc/venus/gpio_list


and delete the list.

Copy the new modified list from "itsme" and paste it in place


Ctrl X to confirm

Ctrl Y for Yes

Then confirm the query with Enter"


Finished.

picture-relais.jpg

The relays become noticeably warm during continuous operation. You now have to prove yourself in practice.

bild1.jpg

Thanks go to "itsme" for his excellent work.

And that he modified the "gpio_list" and made it available here tailored to the relays.


picture-relais.jpg (121.4 KiB)
bild1.jpg (43.5 KiB)
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 ·

Thank you for all the answers. Very helpfull.

I need all the 6 Relays for Lights and a Waterpump. Can you tell me if they are also available in NodeRed? Because i want to build a additional Dashboard for it.

And Furthermore can i also control the relays with a Button?

2 |3000

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

antonioz avatar image
antonioz answered ·

Many thanks to all the previous contributions. Really great.


Just want to add my experience with the keystudio ks0212 relays hat. Less than 7$ in aliexpress.


Done with the previous instructions and all perfect!




Cheers



2 |3000

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

cameron-bennier avatar image
cameron-bennier answered ·

working here too with the keyestudio 4 relay board

2 |3000

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

traian-nicolau avatar image
traian-nicolau answered ·

Is there an option to use all 4 relays with a temperature condition? I can only set conditions for Relay 1 & 2.


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.

derrick thomas avatar image derrick thomas commented ·
You can do just about anything you want with node red
0 Likes 0 ·

Related Resources

Additional resources still need to be added for this topic