question

Pete avatar image
Pete asked

Some help with VenusOS v2.58, dbus-adc in relation to Expander Pi and relays please...

Hi everyone,

Although new to all things RPi I've managed to get the VenusOS installed and various items working like the brightness and backlight off timer... but having trouble getting the dbus-adc and relays to work correctly?

Wondered if someone get give me afew pointers in laymens terms to help me along please?

  • dbus-adc

installed dbus-adc file into /opt/victronenergy/ (Used putty pscp (couldn't get bitvise to work)
chmod 755 /opt/victronenergy/dbus-adc/start-adc.sh
chmod 755 /opt/victronenergy/dbus-adc/dbus-adc
chmod 755 /opt/victronenergy/dbus-adc/service/run
chmod 755 /opt/victronenergy/dbus-adc/log/run (Added folder called log and a file called run inside it - then found it in the service directory?
touch /var/log/dbus-adc (sets time stamp of the file or created one)
ln -s /opt/victronenergy/dbus-adc/service /service/dbus-adc

I can't seem to getting working at all, even though I'm sure I've followed everything correctly?

  • Relays

I've got 4 relays showing but only Relay 1 and 2 are working through the gui?

Tested with - # dbus -y com.victronenergy.system /Relay/1/State GetValue

Switch off = 0

Switch on = 1


Think I've included all the details needed and I've added some Pics too...

Spent the last two days trying to figure it out...

Searched the net and on here but I must be missing something daft?

Thanks,

Pete.

101.jpg102.jpg103.jpg104.jpg130.jpg

Venus OSRelay
101.jpg (640.8 KiB)
102.jpg (707.5 KiB)
103.jpg (732.6 KiB)
104.jpg (624.2 KiB)
130.jpg (836.4 KiB)
18 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.

Pete avatar image Pete commented ·

ok lots of reading (grey matter to a hammering) maybe to much... because I forgot half of it and had to keep going back and forth and read it again and again...

But, I can now manually start dbus-adc with...

 /opt/victronenergy/dbus-adc/start-adc.sh &

It instantly updated the gui and displayed them in the device list...

Yes, Cracked it... So I...

chmod 755 start-adc.h

reboot, and... nope!?!

Would appreciate another pointer please... as I'm struggling to grasp it now!

I messed up, just not understanding how and where...

I haven't got my chmod / numerical permissions in a mucking fuddle have I?

Thanks,

Pete.

0 Likes 0 ·
122.jpg (636.3 KiB)
122.jpg (636.3 KiB)
122.jpg (636.3 KiB)
118.jpg (589.8 KiB)
120.jpg (535.3 KiB)
119.jpg (677.5 KiB)
117.jpg (892.5 KiB)
powerace avatar image powerace Pete commented ·

Hi Pete,

I just received my ADC board (Expander Pi) and i have to start preparing the software from the beginning. Is there a specific manual you followed? Or do we need to make a step by step manual ourselves just like i did for the relays?

0 Likes 0 ·
Pete avatar image Pete powerace commented ·
Hi,

I've actually lost track of what I've read, tried and followed over the last few days to be honest... But...

I found this one, easy to follow to get started... although outdated (sorry to the original author if you read this) So some parts are irrelevant but worth doing to make sure?

victronvenussupport/venus_rpi_enablement.md at master · aaronsb/victronvenussupport · GitHub

And then I took bits and pieces from all over the place while trying to troubleshoot the problem I'm having... 100% something I've messed up I'm sure!

Got the dbus-adc files from HERE

Got the mcp3208-overlay.dtb files from HERE

And refered back to various threads, posts etc many times from all over the place!

Hope this helps get you started...

Had to take a break, was time to walk away and breath... will have another go hopefully tomorrow afternoon if I can.


0 Likes 0 ·
powerace avatar image powerace Pete commented ·

Good evening Pete,

I think i've got it sorted. At least i managed to make it to the same stage as where you are now but in my case it starts all automatically (managed to write down all steps). One small note: i also have the Analog Inputs screen empty. But i'm not sure if we using an RPI should see something in there. The original software was of course written for Venus GX/Cerbo GX so i can imagine that their inputs will show up in the Analog Inputs screen. But i might be wrong at this point!

Unfortunately i don't have anything connected to the Expander Pi board so i can't test if it really works. I expect that all dashes (--) and "Unknown" values will disappear as soon as real values are coming in.

Also the Expander Pi board has 8 inputs, Venus OS now only shows 5 to us. I guess we have to tinker a little further to get them to work just as we did with the Relays.

I hope you can get it working now!

config.txtStep by step installation guide for Expander Pi.txtdbus-adc.zipmcp3208-overlay.zip



0 Likes 0 ·
Pete avatar image Pete powerace commented ·

Hi,

Seriously... Yours just started auto and is working fine!?!

lol... I have no idea how I messed up so badly then...

O.k, I've downloaded your instruction sheet and files, just like the relay one...

Which was perfect by the way! (Thumbs up)

lol... your turning into my personal tech support <--- Friendly banter, no offense meant or intended!!!!

Appreciate you taking the time doing the instruction sheets... will help everyone not just me.

Will have another ago later and report back!

Just to double check...

Your running Release v2.58

Also could you confirm the dbus-adc version your running - mine currently says dbus-adc 1.17 wondering if it's an older version, so not working with the newer firmware correctly?

Thanks again,

Pete.

0 Likes 0 ·
powerace avatar image powerace Pete commented ·

Hi,

Well as i said before we started our adventure parallel, so why not combine effort and also help other people at the same time?

FYI, i'm running Beta 2.60~41 the latest known test version. But i expect that it roughly works the same and that there are some minor differences like the relaystate.py that apparently changed quite a bit a while ago. We just have to find those differences and i think 2.60~xx and 2.58 aren't that far away from each other timewise.

W.r.t. the dbus-adc version i have no clue which version i'm using. The one i used came from the dropbox link you mentioned above. But i think there might be a newer version (1.27) 2 months old according to Github.

I just have no clue how to "make" that, too much of a programmer thing for me...

My next step will be to get the RTC working since my Venus OS won't be always connected to the internet.

The reason i'm carefully writing down all the steps i did is because a lot of those files we copy/use now will be overwritten during a firmware update. I've read about scripts for automatically restore all those files but i need some time to adjust them for my personal use.


0 Likes 0 ·
Pete avatar image Pete powerace commented ·
Well as i said before we started our adventure parallel, so why not combine effort and also help other people at the same time? 
 

I will help you at some point, hopefully... lol

Yes, absolutely... having most things detailed in one spot will help everyone!

Especially your step by step installation guides!!

FYI, i'm running Beta 2.60~41 the latest known test version. 

But i expect that it roughly works the same and that there are some minor differences like the relaystate.py that apparently changed quite a bit a while ago. 

We just have to find those differences and i think 2.60~xx and 2.58 aren't that far away from each other timewise. 

Yep, just a natural progression for victronenergy to improve and update the VenusOS for their products but that doesn't necessarily follow the uses everyone running VenusOS on RPi have.

Very grateful for the opensource and all the people involved with using and running it on a RPi!

I'll have a look at 2.60~41...

W.r.t. the dbus-adc version i have no clue which version i'm using. 
The one i used came from the dropbox link you mentioned above. But i 
think there might be a newer version (1.27) 2 months old according to Github.
I just have no clue how to "make" that, too much of a programmer thing for me...

I'll have a hunt around see what i can find out about v1.27

My next step will be to get the RTC working since my Venus OS won't be always connected to the internet.

Yep, one of the reasons I chose the Expander Pi

The reason i'm carefully writing down all the steps i did is because
a lot of those files we copy/use now will be overwritten during a 
firmware update. I've read about scripts for automatically restore  all those files but i need some time to adjust them for my personal use.

I've got the rc.local file... but all thats got in it right now is for the ds1307

I've started copying all the file changes etc to /data/restore/ that I made ready to start messing around with a script but thats as far as of got.

Right, off to see if I can get this dbus-adc fiasco to behave.

Will update later!

Thanks,

Pete.

0 Likes 0 ·
Pete avatar image Pete Pete commented ·

ok hit a problem...

ln -s /opt/victronenergy/dbus-adc/service /service/dbus-adc

produces...

ln: /service/dbus-adc: No such file or directory

It worked before so don't understand why it won't now...

Any ideas?

0 Likes 0 ·
powerace avatar image powerace Pete commented ·

Hi Pete,

This one i don't know, does your location /opt/victronenergy/dbus-adc/service really exist? Are all the permissions set okay? Something must have changed else it should work.

Else it might be a good idea to take a new sd-card and start all over again. Maybe so much has been messed up that more has been damaged then we think... repeating steps also gives you a bit more training in using linux like systems ;-)

I'm trying to get the i2c and rtc to work but that is also lots of reading, not really straight forward for now...

0 Likes 0 ·
Pete avatar image Pete powerace commented ·

Hi,

Think I figured it out, finally... but run out of time so will try later.

Will update progress...

Does this line in /u-boot/config.txt file not do what your after?

#dtoverlays - MCP3208 ADAC on spi-0-0, i2c rtc interface, and ds1307 rtc interface. (that lives on the i2c bus)

dtoverlay=mcp3208:spi0-0-present,i2c-rtc,ds1307-rtc

Hope that helps...

Pete.

0 Likes 0 ·
Pete avatar image Pete Pete commented ·

ok, figured it all out, well almost.

we now have auto start on dbus-adc...

Not completely sure why they are messed up on the device list, but its working...

oh and I finally realised/discovered you can have both candidate and release on the same rpi... so been messing about with that too!

Need to figure out why the order is messed up on the device list, can't live with it like that will drive me nutty!?!

Then onto the next bit... see how badly I mess that up. <--- oh yea, more questions being posted by me!

0 Likes 0 ·
119.jpg (574.2 KiB)
120.jpg (609.2 KiB)
121.jpg (582.7 KiB)
122.jpg (612.4 KiB)
123.jpg (514.8 KiB)
125.jpg (721.2 KiB)
126.jpg (805.2 KiB)
Pete avatar image Pete Pete commented ·

Changing the device list is way beyond me at the moment so onto the next step.

Anyone know if I've got this entered correctly in the config.txt file...

dtoverlay=mcp3208:spi0-0-present,i2c-rtc,ds1307-rtc

As it's a HAT I figured it was correct and it's in...

https://github.com/aaronsb/victronvenussupport/blob/master/venus_rpi_enablement.md

But I've been reading up on it and the ds1307-rtc-overlay is no longer used apparently it's been replaced with i2c-rtc.

Name:   i2c-rtc
Info:   Adds support for a number of I2C Real Time Clock devices
Load:   dtoverlay=i2c-rtc,<param>=<val>
Params: ds1307                  Select the DS1307 device

        ds3231                  Select the DS3231 device

        mcp7941x                Select the MCP7941x device

        pcf2127                 Select the PCF2127 device

        pcf8523                 Select the PCF8523 device

        pcf8563                 Select the PCF8563 device

So that would make it...

dtoverlay=i2c-rtc,ds1307=?

Or am I just not understanding it correctly <--- more than likely!

Can I use...

i2cdetect

and

dtdebug

EDIT ~ Wait is it as simple as...

dtoverlay=i2c-rtc,ds1307-rtc


0 Likes 0 ·
powerace avatar image powerace Pete commented ·

Hej Pete,


I'm back i had a few days off. Looking at the pics above i see you got one step further with the analogue i/o ports. I see you have a list of analog inputs and i see readings of 0% for some tanks. Did you manage to extend the step-by-step document i made? If not can you point me out what i need to do to get the analog inputs to work so i can complete the step-by-step doc.

Thanks!

0 Likes 0 ·
Show more comments
laurenceh avatar image laurenceh commented ·

At the risk of just throwing more information on the heap.....

I wrote a script to automate the install of all the bits needed fro a Raspberry Pi it is all described in this article.

https://community.victronenergy.com/content/kbentry/43646/how-to-quickly-update-rpi-touch-screen-configurati.html

And there is a zip file URL included the article with all the resources you need.

You can just use the script file of have a read through it and find the command lines you need.

I have it running and use it regularly (though I may have a more up to date version if you find you need it) any problems do get back to me. I'm happy to do a compare between what you see on your screen and what I have running.

However this is about dbus-adc (and several other bits) I dont know anything am=bout the relays so I dont know how to get those running.

Regards Laurence


0 Likes 0 ·
5 Answers
powerace avatar image
powerace answered ·

Hi Pete,

I think we are more or less doing the same parallel. Although i don't have an ADC board yet it is on my to do list and in the meantime there is plenty to read about here in this forum.

So unfortunately i can't help you with the ADC story. But for the relays i have the same thing as you. Relay 1 & 2 can work directly from the GUI but 3 & 4 not. There is a small note from mr. Duthie about relaystate.py you have to use from firmware version 2.40.33. Simply overwriting your newer relaystate.py with this old version should do the job. See discussion here: https://community.victronenergy.com/comments/36387/view.html

I haven't had the time yet to download 2.40.33 and pull the file out of the image to see if it works.

Good luck, and let us know if this solution works.

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.

Pete avatar image Pete commented ·

Hi,

Appreciate the reply and the link, just searched for v2.40~33 but can't seem to find a download for it.

I've actually started to go through all the threads, posts and searches I did... retracing my steps to try and figure out what I have or more likely missed and haven't done!

I've modified the PageSettingsRelay.xml ...

Modded /etc/venus/gpio_list and /etc/venus/relays, but if I try and add more than Relay 1 and 2 it starts flashing between off and unkown on the pages and the relay section disappears completely!?!

Will keep trying to retrace my steps, if I don't figure it out... hopefully someone will be kind enough to give me a nudge/pointer in the right direction!

Thanks,

Pete.


0 Likes 0 ·
Pete avatar image Pete commented ·

Ok,.. I proper broke it now!?!


Adding/defining more relays
By default, our raspberrypi image defines one GPIO pin as a relay. You can add more. In the rootfs you'll have to modify /etc/venus/gpio_list.
To see what code handles that read here: https://github.com/victronenergy/meta-victronenergy/blob/master/meta-venus/recipes-bsp/gpio-export/files/gpio_pins.sh
That package populates, at each boot, the /dev/gpio/relay_* links. Which are in turn then consumed by systemcalc, here, which puts them on D-Bus.
And that (D-Bus) is how the gui and the other processes in Venus OS interface to the relays.

Double checked all that and it adds and populates a Relay_* directory perfectly...

Do we still need to add the /etc/venus/relays file?

I think it broke more after I was messing with relaystates.py or was it pagesettingsrelay.xml...

Anyone give us a clue before I lose even more hair and my mind...

0 Likes 0 ·
131.jpg (669.7 KiB)
3160.jpg (755.7 KiB)
powerace avatar image powerace Pete commented ·

OK Pete,

I can understand the frustration also the fact that the information is scattered all over the internet (wiki, google pages, this forum) doesn't really help. I had some time to spend on this subject today and managed to write down every single step i made.

The result is that i have all four relays operational now from the GUI.

There is one disadvantage however and that is that the states of the relays are all set back to off when you reboot the RPI. I think this has to do with the relaystates.py file i used from FW v2.33. I am not a programmer but i am capable of copy pasting code from one file to the other and test the results.

Below attached is the relaystate.txt (FW 2.33) file please rename it to relaystate.py and copy it to the correct location in your system.

I hope this will help you to get a little further.

relaystate.txtSteps for activating all 4 Relays.txt

0 Likes 0 ·
Pete avatar image Pete Pete commented ·

Hi,

I was gearing up to start again... Thank you!

Yep I broke it messing with the relaystate.py...

edited the file with the v2.33 version and back to normal on the display and with working relays once I'd edited gpio_list...

Tested with - # dbus -y com.victronenergy.system /Relay/3/State GetValue

Switch off = 0

Switch on = 1

So is etc/venus/relays actually redundant now?

---------------------------------------------------------------

Had another go with dbus-adc again and still no luck,

This is why it isn't working I think?

wonder if I should put this as a seperate question?

Appreciate you taking the time to help regard the relays!

0 Likes 0 ·
109.jpg (693.6 KiB)
110.jpg (573.0 KiB)
111.jpg (803.4 KiB)
112.jpg (814.4 KiB)
114.jpg (759.4 KiB)
111.jpg (803.4 KiB)
trygvelu avatar image
trygvelu answered ·

Hi,

I have played around a bit with dbus-adc. Did you copy the device overlay file into /u-boot and initialize it?

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

Pete avatar image Pete commented ·

Hi,

Do you mean

/u-boot/overlays/ .... 

then yes...

0 Likes 0 ·
2001.jpg (871.8 KiB)
jeroend avatar image jeroend Pete commented ·

Perhaps silly but what does the overlay file look like? (open it via nano /u-boot/overlays/mcp3208-overlay.dtb) The steps look ok, perhaps the file itself is not ok.

0 Likes 0 ·
Pete avatar image Pete jeroend commented ·

Hi,

Spot on... rookie mistake on my part, in my eagerness... instead of downloading the file I ended up downloading the page! <---- facepalm moment right there!?!

Just sorting some pics to do an update now.

0 Likes 0 ·
jeroend avatar image jeroend Pete commented ·

;-) Glad to be of help. I also have found a way to update the adc to version 1.27 automatically. That said I still have not found a way to configure the analog inputs. Means, I can see the sensors in the IO screen under analog inputs yet they will not show under devices...... will keep on looking/checking/testing though

0 Likes 0 ·
Pete avatar image Pete jeroend commented ·

Would like to know how to update to the latest v1.27...

No idea why they aren't showing in the device list... as soon as I turn mine on the device list updates and shows them.

Need to reboot when you turn them off so they disappear though.

you have dbus-adc.conf set up in... /etc/venus/dbus-adc.conf

device  iio:device0
vref    1.8
scale   4095
tank    4
tank    6
tank    2
temp    5
temp    3

oh and set up read_adc.sh

I have this saved in.... /data so it doesn't get wiped by an update.

#!/bin/sh

for i in 0 1 2 3 4 5 6; do
    echo -n "ADC[${i}]: "
    cat /sys/bus/iio/devices/iio\:device0/in_voltage${i}_raw

done


./read_adc.sh


hope the above helps in some way?

Pete.


0 Likes 0 ·
jeroend avatar image jeroend Pete commented ·

First make a backup of your SD card before you do below update so you can go back if needed as chances are you'll end up where I am stuck (!) Also, as v1.27 is not released yet, never use in a production environment but for testing (only).

One-by-one execute these commands:

cd /opt/victronenergy/swupdate-scripts/

./set-feed.sh candidate

opkg update

opkg install dbus-adc

./set-feed.sh release

Basically you are pointing opkg to the release candidates instead of released packages, then run the install from there and at the end set it back to the (normal) release versions. (but you'll have the adc package in the higher version by then.

0 Likes 0 ·
dunnp avatar image dunnp Pete commented ·

Just a little trap with the config that tricked me for a while- make sure the file ends with a line-feed (/n).

Phil

0 Likes 0 ·
Pete avatar image Pete dunnp commented ·

As I've only just got this working I think I'll pass at the moment...

Knowing my luck I'd mess it all up again!

I'm running v1.23 so that will do for now.

Appreciate the info JereonD and Phil ... maybe someone else with more knowledge/experience will decide to give it ago.

Pete.

0 Likes 0 ·
jeroend avatar image jeroend Pete commented ·

Yes, at last I have it working too. Not sure why actually will redo tomorrow from scratch on both the latest release candidate as well as latest release as I want to figure this one out. I did now change the vref to 4.096 (matching the vref on the expander pi hat) in de dbus-adc.conf file hoping I will not need to make modifications to the expander pi itself. Thanks for the help Pete and Phil.

0 Likes 0 ·
Pete avatar image Pete jeroend commented ·

Thats great, not sure how I helped... but it works!

0 Likes 0 ·
Rob Duthie avatar image
Rob Duthie answered ·

Re for 6x relays if required, add this gpio to: gpio_list /etc/venus/gpio_list, and the qml file to /opt/victronenergy/gui/qml/PageSettingsRelay.qml.

Just rename then back remove .txt on both file names. Also rename the old file so you can back track in case of issues etc. Also i use WinSCP for editing though the ssh much easier than the command line terminal, copy past files etc.

gpio_list.txt

PageSettingsRelay.qml.txt

Attached also the schematics of the raspi HAT stetson project.

Also Ver>2.66 after, the ADC won't work any more, it won't show on the pages and screens, the data is there when you use the show ADC commands. Prior to 2.66 all worked OK. After Ver2.66. Due to the new versions of venus and the new kernals etc.

If some one wants to trouble shoot this let me know.

The canbus USB is Ok the normal canbus ports are, OK 6x relays work OK, VE direct USB is OK The VE direct serial port not working yet, the ananlog ports not working yet. rest all OK.

Victron Raspi Stetson.pdf


Victron Raspi Hat.pdf


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.

jeroend avatar image jeroend commented ·

Not sure what you mean exactly Rob, I am on 2.72 and ADC temp sensors (I have no tank sensors installed at this moment) are visible on both VRM as well as via remote control (web page) of my rpi 4. Did you perhaps loose the line feed at the end of the dbus_adc.conf file?

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

No since the new version of software after >2.66 for the raspi 3B+ the analog side has not worked due to the changes in platforms etc.

The raspi4 i have is ver 1.4 and won't boot anyway this is a known issue to date.

The raw data is there when you shh into the raspi unit, it is not being published to the D.Bus network.

Rgerads

Rob D

NZ

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

I have all the analog sensor back again using the latest ver 2.80.17

In fact the adc install was very simple to make it all work again, as there was conflicts in the SPI ports etc.

Regards

Rob D

NZ

0 Likes 0 ·
Rob Duthie avatar image
Rob Duthie answered ·

Update: Raspi Venus Ver 2.80.19

We have now 4x tanks and 4x temps analog inputs all working now, and also the 6x relays outputs.

With Help from Kevin Windrem

dbus-adc.conf.txt.txt

screenshot-75.png

venustanks.pngvenus-relays.png

Regards

Rob D

NZ


screenshot-75.png (303.8 KiB)
venus-relays.png (112.5 KiB)
venustanks.png (113.7 KiB)
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.

jens-due avatar image jens-due commented ·

Hi Rob

Is there a download link for this version and are the 6 relays there by default?

Regards Jens

0 Likes 0 ·
Rob Duthie avatar image Rob Duthie jens-due commented ·

Hi Jens

No, if you install Setup helper and GuiMods from Kevin Windrem this will all show up automaticly for you.

https://github.com/kwindrem

Regards

Rob D

NZ

0 Likes 0 ·
Rob Duthie avatar image
Rob Duthie answered ·

In the new version >2.85.1 ADC wont show up as the folder iio is missing from the sys/bus/ folder.

Regards

Rob D

NZ

2 |3000

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

Related Resources

Victron Venus OS Open Source intro page

Venus OS GitHub (please do not post to this)

Additional resources still need to be added for this topic