question

dunnp avatar image
dunnp asked

Tank sensor calibration

There have been several questions over many months about setting up non-standard tank sensor resistance values in Venus devices on these pages - but no real answers!!

Like quite a few others, I have a couple of tank senders that don't conform to the 0-180 or 240-33 ohm settings available in Venus. Mine are roughly 8-110 ohms.

It would be nice if the OS/GUI gave the ability to 'calibrate' the readings like it does with temperature sensors - eg adjustable scale and offset on the remote console.

But failing that, could someone within Victron tell me (and this community) where/how these resistance values can be tweaked in code? They are obviously defined somewhere but endless searching hasn't located them. One post mentioned a couple of lines of code defining the max/min resistance and the 680ohm series resistor - but I'm unable to locate it in my device. Maybe that was in compiled code somewhere??

I know I could fiddle resistor values on the ADC input to fudge approximate readings but that is nor practical with a real GX device (I'm using a RPi but still rather not be soldering resistors). It would be so much nicer to make the adjustments in code.

If this can be solved - ie get reasonably accurate tank readings from different senders - it opens up some neat possibilities for me. Example - automating a transfer pump in my caravan. And maybe other cool stuff.

Any guidance appreciated.

Phil

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.

1 Answer
mvader (Victron Energy) avatar image
mvader (Victron Energy) answered ·

Hey @dunnp, good news, I think your request came in right at the good time and its being made now. If all goes well, you should see it in a v2.60 beta version soon enough.

Then next, we'll also be adding an option to calibrate for non linear tanks: https://github.com/victronenergy/venus/issues/604 .




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

dunnp avatar image dunnp commented ·

Great news - look forward to testing it.

Phil

0 Likes 0 ·
Mark avatar image Mark dunnp commented ·

Hi Phil

Have you tested yet?

I just installed the test V2.60~9 and noticed the custom setting for tank resistance. I appreciate its a test version so as feed back, although the custom is in the menu it wont let you select it? I also noticed that in the I/O menu Analog inputs sub menu is not populated?

I've added the Dbus-ADC files and the relay files in the delegates folder to active the 4 relays and the temp / tank inputs.


Thanks

Mark

0 Likes 0 ·
jeroen avatar image jeroen ♦ Mark commented ·

Which device are you testing? You should get this:



0 Likes 0 ·
1583610904683.png (23.8 KiB)
Mark avatar image Mark jeroen ♦ commented ·

Hi Jeroen


It’s on a rpi3. I’ve tried it with fresh water, live well and fuel. It’s in the menu to select but when I try to select it then (black dot) it just auto jumps back to original setting then goes back to previous menu page. I’ve not made any changes other than add the adc-dbus files and the relay files in dbus delegates folder and updated the gpio list to allow for 4 relays. I have managed to get the content/options back in the I/O analog inputs by removing the (2) after Function from the bind line in pagesettingsIO


Any ideas?


Thanks Mark



0 Likes 0 ·
firmware.jpg (291.2 KiB)
standard.jpg (329.5 KiB)
pagesettingsio.jpg (383.9 KiB)
Mark avatar image Mark jeroen ♦ commented ·

Just thought does it need to see the sensor/sender? As it’s not connected yet! With me testing on my desk

Thanks Mark

0 Likes 0 ·
Mark avatar image Mark jeroen ♦ commented ·

quick update, ive just tested with sender unit and still not letting me use the custom option?

If you would like to remote into it just let me know.

Thanks

Mark


0 Likes 0 ·
img-6149.jpg (2.6 MiB)
dunnp avatar image dunnp jeroen ♦ commented ·

Hi Jeroen

I just loaded v2.60~9 and cannot get to the custom resistance settings you show above. When selecting Custom, it just jumps back to the previous selection (US or EU).

Any clues on what is wrong?

Phil

0 Likes 0 ·
jeroen avatar image jeroen ♦ dunnp commented ·

Hello Mark, et al,

You should not copy back the old adc process of course (since it has no support for custom scales etc). In general, never copy things between venus versions, silly idea. I will have a look if the dbus can be added for the rpi build.

Regards,

Jeroen

0 Likes 0 ·
Mark avatar image Mark jeroen ♦ commented ·

Hi jeroen

Thank you, I’m not sure if you have read the rest of this post yet, but @nebulight has managed to get it working. I have copied what he did and it’s now working on mine also. I will be testing it on the van later and will report back.
thanks

Mark

0 Likes 0 ·
jeroen avatar image jeroen ♦ Mark commented ·

good, v2.60~11 will have the dbus-adc as optional package for the rpi, so it can be installed with opkg. You only need to adjust dbus-adc.conf then. But that will be available later. (first 2.52 will be released)

1 Like 1 ·
dunnp avatar image dunnp Mark commented ·

I’ll give this a try tomorrow. Thanks for the heads up on the test build. I didn’t think to check there.

Phil

0 Likes 0 ·
Mark avatar image Mark dunnp commented ·

No Problem

let me know if it works for you.

Thanks Mark

0 Likes 0 ·
dunnp avatar image dunnp Mark commented ·

Hi Mark

Report back:

I loaded v2.60~9 but am seeing some odd behaviour with the tank settings - and the other analog inputs in general now.

In the tank setup, the Custom option is there but can't be selected because either the US or European radio buttons stay checked and checking the Custom button won't over-ride them - ie not mutually exclusive. So the setting reverts to whatever was selected before and not Custom. It's hard to capture a screenshot because it jumps back quickly after clicking Custom but both European and Custom button will stay selected briefly.

So I don't get to the resistance setting page.


The other (possibly unrelated) issue with 2.60~9 is the analog devices can't be cleared from the device list with a reboot like before when they are switched off in the I/O Analog page. I copied all the (working) dbus-adc stuff from previous builds, so I'm wondering if I need to change something with the adc stuff for this build?

Phil

0 Likes 0 ·
1583707503690.png (46.0 KiB)
Mark avatar image Mark dunnp commented ·

Hi Phil

That’s exactly the same issues I’m having, thanks for trying it I thought it was just me. The adc files include using have worked ok in all previous versions I’ve used also. As for the device I had the same issues and in the I/O analog menu no devices listed/shown I did fix this by removing the (2) after function in the PageSettingsIO file.

I’m not sure if this stops anything else from working correctly but it did show the devices in the in I/O menu afterwards. But still not allowing me to choose the custom resistance.

Thanks

Mark

0 Likes 0 ·
nebulight avatar image nebulight Mark commented ·

We probably need a new ADC driver for the pi. I think the last time the ADC drive was online, it was taken from the Venus GX and modified to work. Since this functionality is probably in the driver as well as the base OS, I would assume we'll need a new dbus ADC driver, no?

0 Likes 0 ·
Mark avatar image Mark nebulight commented ·

Yes I think your on the right track mate. But where do we find the new adc drivers? Cheers mark

0 Likes 0 ·
nebulight avatar image nebulight Mark commented ·

I think last time they were pulled from the venus gx image. Take a look at Jing's post here:

https://groups.google.com/forum/?nomobile=true#!searchin/victron-dev-venus/adc%7Csort:date/victron-dev-venus/mejgJbMjU34/uCXB5GRsDQAJ

Looks like someone just needs to rip out the driver from the 2.60 ~9 image. Might want to wait for a final build though, but for testing this looks like what needs done.

Looks like it's on victron github, but not sure what to do with these files:

https://github.com/victronenergy/dbus-adc

0 Likes 0 ·
Mark avatar image Mark nebulight commented ·

Thats awesome thank you, i'll have a look and see if i can make anything of it. i'm no programmer but i like to try lol

Thanks Mark

0 Likes 0 ·
nebulight avatar image nebulight Mark commented ·

I was able to download the beaglebone image and extract the dbus-adc driver and it's 4KB larger than the one I'm currently using so this is probably what we are looking for. Since we already have the overlay, we should just be able to drop the new dbus-adc driver into opt\victronenergy and it should work. I can test when I get home tonight.

Here is the link to the extracted dbus-adc (if this is against the rules, please remove): https://drive.google.com/file/d/1OlZ8mZtZQVwcyRXCS4nPVvhQjaQBaDKk/view?usp=sharing

Also after reading the github article, I found that there is a dbus-adc.conf that you can specify the vref. Since most of us are using HATs with non 1.8 vref, we are having to modify the boards in order to properly work. If we adjust the vref in the config file we should be able to use the stock 5v vref that the common hats use with the ADC. I'll also play around with this as well as I have a mix of modified and non-modified HATs.

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


0 Likes 0 ·
Mark avatar image Mark nebulight commented ·

Your a winner!!! Thank you I’ll try it tomorrow

Cheers Mark

0 Likes 0 ·
Mark avatar image Mark nebulight commented ·

Quick update,

I,m afraid to say that it didnt work unless I did something wrong??

Cheers Mark

0 Likes 0 ·
Show more comments
dunnp avatar image dunnp nebulight commented ·

The stuff on GitHub looks promising and seems to have all the custom resistance stuff but I have no idea how to translate it into a working dbus-adc file. Beyond my limited abilities. Hopefully someone else will crack it!

I don't think the problem is limited to the dbus-adc file; there is a problem with the gui - ie the inability to select the Custom resistance mentioned previously. Perhaps there is a newer qml file for the tank sensors?? (Unless of course this is bundled into the dbus-adc stuff - wild guesses on my part!).

Phil


0 Likes 0 ·

Related Resources