ls -al /sys/bus/iio/devices/iio\:device0/ (to see loaded values) cat /sys/bus/iio/devices/iio\:device0/in_voltage4_raw ( to see only one channel loaded e.g voltage4) cat /sys/bus/iio/devices/iio\:device0/in_voltage[0-7]_raw (display all channels) root@RaspPi2:~# 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@RaspPi2:~# ./read_adc.sh (without ADC connected) This command might not work for our application use the one s at the top. ADC[0]: 0 ADC[1]: 0 ADC[2]: 0 ADC[3]: 0 ADC[4]: 0 ADC[5]: 0 ADC[6]: 0 root@RaspPi2:~# ./read_adc.sh (with ADC board connected) ADC[0]: 6 ADC[1]: 5 ADC[2]: 1999 (tank3) ADC[3]: 1999 (temp2) ADC[4]: 1997 (tank1) ADC[5]: 1998 (temp1) ADC[6]: 1996 (tank2) ADC[7]: 4 (does not exist on beaglebone) Pi Expander ADC ADC[1]: # N/A ADC[2]: # N/A ADC[3]: # Tank3 ADC[4]: # Temp2 ADC[5]: # Tank1 ADC[6]: # Temp1 ADC[7]: # Tank2 ADC[8]: # N/A Pin outs wiring on the Expander Pi Tested OK 16/06/2019 Rob D ADC 3 = on Tank3 Victron ADC 5 = on Tank1 Victron ADC 7 = on Tank2 Victron ADC 4 = on Temp2 Victron ADC 6 = on Temp1 Victron The line in config.txt should read "dtoverlay=mcp3208:spi0-0-present" I received my ADC board today, and connected it to the RaspberryPi. I'm using this board, https://www.abelectronics.co.uk/p/50/Expander-Pi mainly because it was the one I could get delivered the quickest :-) Any board with an MCP3208 shoud do. I had some problems to get the ADC to give me 12bits resolution, as it would only give me 10-bits, with a max value of 1023 I had to convert the mcp3008-overlay.dtb to a dts file, change all references to 3008 to 3208, and convert it back to a dtb file, to get it to give me 12-bits (4095). (I've enclosed the dtb file if anyone needs it). The line in config.txt should read "dtoverlay=mcp3208:spi0-0-present" I haven't changed the voltage reference to an 1.8V version yet, or wired up the required resistors from the Beaglebone cape, but just fed the ADC's about half the vref input voltage as a proof of concept. I downloaded the compiled image for the Venus GX, ripped out the /opt/victronenergy/dbus-adc directory from the image with 7-zip, copied the directory to the Raspberry Pi. I then created a symlink from /service/dbus-adc to /opt/victronenergy/dbus-adc/service to get the service running… I then grabbed the device overlay file for the MCP3208 from the latest Raspian image, (mcp3008.dtbo I think), renamed it to mcp3008-overlay.dtb and dumped it into /u-boot/overlays added the line “dtoverlay=mcp3008:spi0-0-present” to config.txt and rebooted. Tada! All the analog sensor options are present in the Rasperry Pi’s Venus interface. Since there is no actual hardware is present, all the values are reading “0” on the sysfs iio interface, and you’ll get “Short Circuit” and “Unknown” as statuses in the GUI. (2.0V/4.096V, should be equivalent to around 0.9V on the Beaglebone) ###### Expander Pi ADAC Board ###### #https://www.abelectronics.co.uk/p/50/Expander-Pi https://www.abelectronics.co.uk/p/50/Expander-Pi #copy dtb to /u-boot/overlays # add the dbus-adc file to the opt/victronenergy folder #excerpt from post: #I had to convert the mcp3008-overlay.dtb to a dts file, change all references to 3008 to 3208, and convert it back to a dtb file, to get it to give me 12-bits (4095). #(I've enclosed the dtb file if anyone needs it). The line in config.txt should read "dtoverlay=mcp3208:spi0-0-present" #https://groups.google.com/d/msg/victron-dev-venus/mejgJbMjU34/WglmnUPQAwAJ install dbus-adc file into /opt/victronenergy/ (not required installed with the packages Rocko) install via Bitvise the file ( dbus-adc ) 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 (need to add a folder called log and a file called run inside it) if missing? touch /var/log/dbus-adc (sets time stamp of the file or created one) ln -s /opt/victronenergy/dbus-adc/service /service/dbus-adc (symlink command to link the files together) #add to /u-boot/config.txt #you did this way at the top. ######################## Digital IO ######################## This is a trial code to make the Digital IO to work by Rob D (Still under testing) Note: this is linked to the dev/GPIO which has digital inputs 1_5 and relay_1 folder? chmod 755 /opt/victronenergy/dbus-digitalinputs/service/run OK? chmod 755 /opt/victronenergy/dbus-digitalinputs/dbus_digitalinputs.pyc OK? chmod 755 /opt/victronenergy/dbus-digitalinputs/service/run OK? chmod 755 /opt/victronenergy/dbus-digitalinputs/service/log/run OK? touch /var/log/dbus-digitalinputs OK? ln -s /opt/victronenergy/digitalinputs/service /service/digitalinputs (symlink command to link the files together) #####################Relay gpio ######################### 1. First off, pick a suitable GPIO. It seems to me the obvious choices would be something that is not multiplexed onto another function (some pins do double duty and can be configured to be something else), so the obvious choice to me seems to be GPIO21, which is on pin 40 on the header (right at the end). What's nice about this one, is it has a ground right next to it on pin 39. 2. Next you have configure this pin as a gpio. There is some functionality built into venus to do this, but not yet enabled on the Pi, so you will have to manually install this. First create /etc/venus/gpio_list by using the following command: echo "21 out relay_1" > /etc/venus/gpio_list 3. Install the setup script and make it executable, like so: wget -O /etc/init.d/gpio_pins.sh \ https://raw.githubusercontent.com/victronenergy/meta-victronenergy/master/meta-venus/recipes-bsp/gpio-export/files/gpio_pins.sh chmod +x /etc/init.d/gpio_pins.sh 4. Create a symlink to make gpio setup run at boot: cd /etc/rcS.d ln -s ../init.d/gpio_pins.sh /etc/rcS.d/S90gpio_pins.sh 5. Either reboot, or just run the script manually to set up the gpios at this time (you will reboot again later): /etc/init.d/gpio_pins.sh 6. You should now have a file /dev/gpio/relay_1 configured as an output. 7. Create /etc/venus/relays and add the relevant gpio echo /sys/class/gpio/gpio21 > /etc/venus/relays 8. Reboot. The relay should now show up in the list. ------------------------------------------------------------------------------------------------------------ Create a file /etc/venus/relays with the gpio controlling the relay, Confirmed and working OK Rob Duthie 18/06/2019 reboot and it should work (at least if I understand your question correctly). e.g. root@ccgx:~# cat /etc/venus/relays /sys/class/gpio/gpio182 Thanks to Izak I manage to make the relay work. Connect a 5v relay board to the GPIO, 5v and ground from the board and the signal from the 21 GPIO Now I find a problem. The relay is inverted by default. Izak told me that I could try to change from 0 to 1 into /dev/gpio/relay_1/active_low, and it works, but until i reboot the board. Then, something forces this to change from 1 to 0 when the board boots up. I don't know for sure (haven't tested it) but I think this should work for you: 1. Create a file called /data/rcS.local with the contents: echo 1 >/dev/gpio/relay_1/active_low 2. Make the file executable: chmod 755 /data/rcS.local 3. Test (ie. reboot) Relay out put and Digital input and output. Running in version 2.40.19 tested OK 24/8/2019 Rob D # This is a list of gpio pins, set by the script /etc/rcS.d/S90gpio_pins.sh # They are documented at: https://github.com/victronenergy/venus/wiki/bbb-gpio # Format: # # The part is used to create an symlink in /dev/gpio. # Relay 1 Pin 40 / GPIO 21 21 out relay_1 # Digital input 1 Pin 29 / GPIO 05 5 in digital_input_1 # Digital input 2 Pin 31 / GPIO 06 6 in digital_input_2 # Digital input 3 Pin 33 / GPIO 13 13 in digital_input_3 # Digital input 4 Pin 35 / GPIO 19 19 in digital_input_4 # Digital input 5 Pin 37 / GPIO 26 26 in digital_input_5 The digital inputs work as per the pin-outs.. I used a 10K pull-up resistor from the 3V3 supply then pull the pin to ground with a switch. The relay output also works. I drove a LED from pin 40 to ground via a 1K resistor (ie active high).