question

thomas-g avatar image
thomas-g asked

Add Relays - Does anyone have a an ‘idiots guide' on how to add more Relays to a VenusPi set up?

I’m only semi-computer literate - everything is trial and error and cut and paste and hours of google research… If the details include what software should be used and exactly what to type then I can usually muddle my way through. But when it comes to ‘just add a few lines of code in the xxx” I’m completely lost.


I have managed to burn an image to a sd card and install Venus Pi v2.60 large image on to a raspberryPi 3.


I have 1 Victron mppt 75/15 connected successfully to it vie ve-direct usb cable.


I have successfully got node-red running (and can even see it all via VRM Portal - including node-red which is amazing).


I’m still at beginnings of how node red works but can see its potential.


So far so good


But I’d really like to add more than 1 relay so I can control multiple external devices (like pumps, irrigation valves etc) and also control them through node red.


I’ve read the comments and half guides for adding extra relays - but they are incomplete or presume you know how to do certain un-explained steps. So I'm completely lost.


So - anyone have a step by step guide to add relays ? (and I’m on a Mac so Mac instructions would be great!)


Thanks in advance for all the amazing guides so far - and for the missing bits I hope someone will write soon…

Venus OSVenus GX - VGXNode-REDRaspberry PiRelay
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.

Justin Cook avatar image Justin Cook ♦♦ commented ·

Hi @thomas-g, I have moved this question to the "Modifications" space so that it has a better chance of being seen by those currently experimenting with these setups.

Cheers!

0 Likes 0 ·
Rob Duthie avatar image Rob Duthie commented ·

Hi

You can have up tp 6 relay now.

Victron Raspi Hat.pdf

0 Likes 0 ·
victron-raspi-hat.pdf (673.2 KiB)
4 Answers
powerace avatar image
powerace answered ·

Hi thomas-g,

Yes 4 relays can be done. However it is maybe not that straight forward. I made a kind of manual you are asking for but it assumes that the user has some basic knowledge of using SSH and basic Linux skills. I'm not an Apple user but i am confident there is a way to SSH into your Rpi3 using a Mac.

You can find all info here.

In case you need more help let us know.

2 |3000

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

thomas-g avatar image
thomas-g answered ·

@PowerAce Thanks. your guide was one that I’ve Bookmarked and read many times in the past - but can’t see where to start.

I can successfully ssh into the root of the VenusPi (using terminal in Mac) which i guess is the first step.

Your guide talks about adding or changing the relaystate.py and copying it to a folder in the system. That is the part i don’t understand. What is the correct place to copy it to? How do you copy it? In terminal, obviously you don’t get to see folders and files like normal.

I have looked at the SD card folders separately on the laptop but couldn’t see any of the folders others are talking about (so i presume you can only access their contents via Terminal).

If i can get this working I will happily write up a simple guide for others.

I have a ‘real’ Venus GX on my main system- but it only has 2 relays. And it’s an ‘old’ serial number model so it’s seems complicated to convert it to the large drive format that will accept node-red

The venus Pi is my space for experimenting.

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.

powerace avatar image powerace commented ·

Hi Thomas,


Yes i can understand that it is difficult to pickup where to start. There is another tool you can use to access your pi. When you use an FTP client (i don't know which one is easy to use in MacOs) you can easily browse the file structure and find the existing relaystate.py. The whole point is that the relaystate.py version of FW 2.33 works with multiple relays where the newer versions won't. The FTP client software can also be used to easily copy files from your Mac to the RPI. So i guess you can manage this one now.

Once you found the right files on the RPI as mentioned in the manual you can probably use the FTP client also to edit the files. I think this is the easiest way to get it done if you are not really familiar using linux cli.

0 Likes 0 ·
thomas-g avatar image
thomas-g answered ·

@PowerAce While i wait for a reply...

A few glasses of red wine and trying to learn Linux online ( not a good combination!!) i have gotten to the step of reaching the /etc/venus directory (see screen shot).

fe55bbcf-b3be-4342-88cc-b24ef709519b.png

Now - how to add this relaystate.py ??


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

powerace avatar image powerace commented ·

Hi Thomas,


Well done. Now you know how to navigate thru the directory structure. Did you try the way of using a FTP client to access the RPI? I think really is a lot easier for you to navigate thru the RPI directory structures, edit files, copy files and so on.

In case you are not familiar using FTP clients i can advise you to use Firezilla. I looked it up and it seems to work on a Mac.

In case you want to go the ssh/cli way it will be a very steep learning curve meaning you have to find out all types of commands and how to use them. And you will have to use a lot of commands...

But lets give it a try:

- ssh into your RPI again and navigate to the directory /opt/victronenergy/dbus-systemcalc-py/delegates. This is the location where the original relaystate.py is stored. (in case of Firezilla you could easily have used the search function to locate this file, or use the equivalent cli method)

- rename the original file to create a backup.

- execute the following command: wget https://community.victronenergy.com/storage/attachments/12578-relaystate.txt

This copies the file from this forum directly into your directory. You just have to rename file 12578-relaystate.txt to relaystate.py

I hope this will help you a little further although i skipped all commands for renaming and changing directories and so on. You will get there in the end ;-)

0 Likes 0 ·
thomas-g avatar image thomas-g powerace commented ·

Hello @PowerAce. Well, a few small steps thanks to your advice... I managed to copy the 12578-relaystate.txt file to my laptop - and using Firezilla as you recommend and overwrite the exciting file in that directory.. Rebooted - but still only 1 relay...

Reboot again - still only 1 relay.

I opened the file later to see what it looked like and doesn't list one or even 4 relays (not that I really know what I'm looking at!) It was also a smaller file size than the original one I over wrote (2,931bytes vs 1,850).

What have I missed?

I didn't used the wget method - just dragged relaystate.py into directory (after renaming it) viaFirezilla and it asked if I wanted to overwrite. Went ahead on overwrote the original file.

In your "4 steps text" from your other discussion it mentions adding text in the gpio_list.

Are there more steps that I'm not doing ?

Thanks

Screens shots of what I'm seeing:screen-shot-2020-11-16-at-113115-pm.pngscreen-shot-2020-11-16-at-113045-pm.png

0 Likes 0 ·
powerace avatar image powerace thomas-g commented ·

@thomas-g,

That is correct the new file is smaller then the original. You have to understand it came from an older software version and was developed further by Victron. Just the 2.60 version doesn't support the 4 relays anymore for some - unknown - reason to me.

Now you can continue with the next step # 4 of my document, it describes short you have to add the relays #2 and #3 to the gpio_list file. Try to understand how the system works. In the original file you can see how relay #1 is configured. Just add a line using the same analogy as line number 1 using the parameters you need for your relay. (you are defining here which gpio pin to activate for using your relay). I've attached my gpio_list file as an example. But i don't know if it will work for you straight away, if you connected your relays to different gpio pins you have to change that in the file accordingly.

Once this gpio_list file is configured and system is rebooted relay #2 will appear in your software. To get relays #3 and #4 to work and appear in the relaymenu you have to continue with step 6. To make it easy for you i attached again my file so you can copy it directly to your system. -zipped the files because the website doesn't allow me to upload the files-

When you have both files unzipped and copied to their respective locations reboot your RPI one more time and all 4 relays should be available.

0 Likes 0 ·
victron.zip (1.4 KiB)
thomas-g avatar image thomas-g powerace commented ·

@PowerAce Sucess! i feel slightly smarter than i did last week. I just copied your two files and it worked.

I can’t physically test them as relays until i get back to my site and get some wire to attach to the pins. But on software side it looks great.

To complicate things (but simplify my needs) is it possible to set one relay to generator function, and another to pump function ( and then 3 and 4 as manual)? currently it’s only one or the other and only one relay. I’m guessing that if it did work it may disable node-red from using relays (as i believe you need to set them to manual) . Thought it was worth asking as you seem to have a good understanding of this.

Thanks again for being patient and getting me through it.

If anyone else comments that they would like a simple guide on how to do this i’ll be happy to write the whole procedure up (written from a simple persons brain!). 86138a33-5243-40a7-8ab1-b9cd6aed977b.png

0 Likes 0 ·
thomas-g avatar image thomas-g thomas-g commented ·

@PowerAce And to add: the relays are not showing up in node-red (see screen shot). Any ideas? seems the service, path and pathObj details are missing. Any idea where to start looking?

Thanks

0 Likes 0 ·
thomas-g avatar image thomas-g thomas-g commented ·

another view...ec9406f1-dc16-40a9-8fa3-becc7edab5ab.jpeg

0 Likes 0 ·
powerace avatar image powerace thomas-g commented ·

@thomas-g

Nice that you have the 4 relays working now! They will work fine, just remember to connect them to the pins you configured in the gpio_list file.

For the different functions to be assigned to various relays i think you have to send a feature request to Victron. The software was in the end developed for use on the GX devices which have only two relays. Reading the comments from Victron Staff Members here on the forum they are in short of programmers and have to prioritize their resources. Then it is very understandable that the support of more then 2 relays in their software is at the bottom of their priority list.

I'm not a programmer myself so i was - like you - already happy that i got the 4 relays working on the RPI. It was quite a hassle to sort out all the information on different places of the internet and here on this forum as well and i see a lot of other people are fighting this problem as well. Same applies when you want to add an AD board and get it to work in Venus OS. It is possible but you have to put in a lot of effort your self. Fair enough.

For your node-red adventure i can't help. My knowledge is that i know it exists but never used it. But i can imagine that relays 3 & 4 don't show up because they aren't officially supported by Victron. But again feel free to ask Victron for this to support or maybe somebody more skilled here on the forum can support you with this.

0 Likes 0 ·
incarpaul avatar image
incarpaul answered ·

Hi can anyone tell me how to change the names i.e Relay 3, Relay 4 to something more useable?
sure the last time I just edited the gpio.list and it worked. running ver venus pi 2.70

Thank

2 |3000

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