Raspi HAT ADC sources

Hi,

I’m trying to connect a tank sender to Raspberry PI running Venus OS. I found the thread on old forum about Raspi HAT.
https://communityarchive.victronenergy.com/articles/38710/victron-raspi-hat.html
The schematic works perfectly. I also downloaded the binaries from dropbox. I wonder if anyone knows whether the source code for these binaries is available from somewhere? The current version doesn’t work out of the box as the libevent version changed. I added symlinks to pretend the older version is present and it works, but I suspect it will break at some point. Having sources available would solve this issue.

Best Regards,
Milosz

Replying to myself - maybe someone can use it as well :slight_smile:

After some digging I decided to start from scratch. It turns out the dbus-adc is already running on venusos, so there is no need to add any software. There are only a few bits missing to get MCP3208 running.

I assume MCP3208 is connected to SPI0 (pins 19, 21, 23, 24) on RaspberryPi B+. I’m using RPi3 in this example.

Most of the details are described here: https://communityarchive.victronenergy.com/questions/270786/mcp3208-raspberry-pi.html

However this post asks to do a bit too much. From what I saw it is enough to do only the following:

  1. add anyspi overlay

cd /u-boot/overlays
wget https://github.com/raspberrypi/firmware/raw/master/boot/overlays/anyspi.dtbo

  1. update config.txt
    nano /u-boot/config.txt
    (Add this to the end of the file)
    dtoverlay=anyspi:spi0-0,dev=“microchip,mcp3208”

  2. edit /etc/venus/dbus-adc.conf
    In my case the config looks as follows

device iio:device0
vref 1.8
scale 4095
label “Tank 1”
tank 0

The inputs of MCP3208 are indexed from 0

  1. Reboot
  2. Setup from the UI
  • Go to Settings/IO/Analog inputs
  • Enable “Tank 1” (same label as in /etc/venus/dbus-adc.conf)
  • Go to top menu and configure new devices that was added there
  • Go to Settings/Display&Language and enable “Show tank overview”

Enjoy your new tank sender :slight_smile:

1 Like

More details about this config file can be found here: GitHub - victronenergy/dbus-adc: Bridge between Venus device onboard ADC and dbus

Tank overview looks as follows: