question

phomaniac avatar image
phomaniac asked

Help - Analog inputs blank RPI3+

Hello,

I am looking to get some help with tanks on my Rpi3+ installation I cannot get Analog inputs within I/O to display anything. the analog inputs simply displays a blank page. Currently on a fresh install of 2.66 its the same with 2.70

Steps I took so far

added the following line to /u-boot/config.txt

dtoverlay=mcp3208:spi0-0-present

added mcp3208-overlay.dtb file to /u-boot/overlays/

Ran the following

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
(added a folder called log and a file called run inside it) if missing?
chmod 755 /opt/victronenergy/dbus-adc/log/run
touch /var/log/dbus-adc         
ln -s /opt/victronenergy/dbus-adc/service /service/dbus-adc


The pi sees the MCP3208 as its outputting values

root@raspberrypi2:~# ls  /sys/bus/iio/devices/iio\:device0
dev                       in_voltage3-voltage2_raw  in_voltage7-voltage6_raw
in_voltage-voltage_scale  in_voltage3_raw           in_voltage7_raw
in_voltage0-voltage1_raw  in_voltage4-voltage5_raw  in_voltage_scale
in_voltage0_raw           in_voltage4_raw           name
in_voltage1-voltage0_raw  in_voltage5-voltage4_raw  of_node
in_voltage1_raw           in_voltage5_raw           power
in_voltage2-voltage3_raw  in_voltage6-voltage7_raw  subsystem
in_voltage2_raw           in_voltage6_raw           uevent


root@raspberrypi2:~# 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

ADC[0]: 24
ADC[1]: 25
ADC[2]: 26
ADC[3]: 0
ADC[4]: 0
ADC[5]: 14
ADC[6]: 3294


Venus GX - VGX
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
jeroen avatar image
jeroen answered ·

Completely untested, but you should do something like this:

Remove the /opt/victronenergy/dbus-adc and /var/log/dbus-adc you created. Instead run:

Edit: this can be skipped nowadays, since it always already installed, see https://github.com/victronenergy/meta-victronenergy/commit/6914554858b6e65ffc98d6fc2be9db9a67f19833

opkg update
opkg install dbus-adc


Edit /etc/venus/dbus-adc.conf, adjusted for your setup. The device is the name of the device in /dev.

device    adc/builtin0
vref 1.8
scale 4095

product 0xa161

label "Tank Level input 1"
tank 4

label "Tank Level input 2"
tank 6

label "Tank Level input 3"
tank 2

product 0xa162

label "Temperature input 1"
temp 5

label "Temperature input 2"
temp 3

You can reload the config file with

svc -t /service/dbus-adc
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.

phomaniac avatar image phomaniac commented ·

Thanks for your reply

I changed the device line to read "device iio:device0" and upgraded to 2.70

we have some success Analog Inputs are now visible

2021-07-15-02-23-48.png

Here is the dbus-adc.conf that works for me

device iio:device0
vref 1.8
scale 4095

product 0xa161
label "Tank Level input 1"
tank 7
label "Tank Level input 2"
tank 3
label "Tank Level input 3"
tank 5

product 0xa162
label "Temperature input 1"
temp 6
label "Temperature input 2"
temp 4



0 Likes 0 ·