question

dunnp avatar image
dunnp asked

RPi GPIO digital inputs and relay outputs?

Hi

Does anyone know what GPIO ports are used for the digital inputs and for the relay outputs on a RPi to replicate the functionality of a real Venus?

I've trolled through all the sites I can think of and come up blank. Anyone cracked it?


Any guidance greatly appreciated.

Cheers

Phil

Venus OSRaspberry Pi
2 |3000

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

4 Answers
Michael Schmidt avatar image
Michael Schmidt answered ·

Same qestion to me.

is it even possible?

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 answered ·

Michael

Almost by accident I stumbled on a file in the VenusOS called /etc/venus/gpio_list last night. It suggests the ports are as follows:


Relay 1 - GPIO 21 Pin 40 (only one relay apparently)

Digital input 1 - GPIO 5 Pin 29

Digital input 2 - GPIO 6 Pin 31

Digital input 3 - GPIO 13 Pin 33

Digital input 4 - GPIO 19 Pin 35

Digital input 5 - GPIO 26 Pin 37


I haven't had a chance to test yet but looks promising.

Phil




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.

dunnp avatar image dunnp commented ·

Success!! 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).

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

Yes all confirmed being running for some time now all the analog and digital ports.

11 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 ·

Hi Rob

Have you cracked the analog inputs? I tried bread-boarding an MCP3008 ADC as per some stuff I found on the web but the 'Analog Inputs' on the console remained vacant,

Do you know if there any tricks to getting the ADC talking to VenusOS? I have a list of the analog input channels and think I have the SPI wiring to the Pi sorted but obviously I'm missing something.

Cheers

Phil

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

Hi again Rob

I did look at that file and tried the suggestion but on my system there is no /sys/bus/iio directory. I looked in most of the other directories but couldn't find anything that looked like analog voltage stuff.


I'm running v2.40-34 in my 'play' system but I looked in my v2.33 'live' system and couldn't find that /iio directory either.

How does that directory get created? Do I need to install something to create it?


Cheers

Phil

0 Likes 0 ·
Show more comments
dunnp avatar image
dunnp answered ·

Analog and digital I/O working!

Big thanks to Rob Duthie for helping me get the analog inputs showing on the Venus console.

I have a bit more work to do to get the correct sensors and proper values displayed - and most likely a few more questions for the experts out there.

But for now I'm happy to say that it is possible to utilise the five digital inputs, the relay output (only one) and have 5 analog inputs connected to the Venus-RPi system.


Cheers

Phil

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.

Rob Mitchell avatar image Rob Mitchell commented ·

Hi, is there any documentation on how you got this working? I want to connect digital tank senders to the RPi.

0 Likes 0 ·
dunnp avatar image dunnp Rob Mitchell commented ·

Hi Rob

I don't have much useful info; I just muddled through various posts and asked lots of questions to get mine working. But much of it is irrelevant now.

At the time it was a long convoluted process to get the analog inputs working - had to add a lot of dbus-adc stuff. But the latest Venus firmware (v2.53) has it all included and everything can be configured on the remote console without having to delve into command line stuff.

To be clear, the tank sender functions in Venus are analog and assume a resistive tank unit. Originally they had to be either US spec (240-33 ohm) or Euro spec (0-180 ohm) but now the resistance settings can be tweaked in the console to suit non-standard senders. Big improvement and big thanks to Victron for adding this.

The digital inputs are purely logic levels - on, off or pulse. I'm not sure what 'digital tank senders' you have but the digital inputs aren't the place to connect them if they are RS485, Canbus or similar.

Back to the analog inputs (for completeness), now that all the software side is included, the only remaining challenge is to add the MCP3208 ADC chip and the resistor networks on each input. Just a matter of following the wiring diagrams available on GitHub - can't recall where.

Cheers

Phil

0 Likes 0 ·
Rob Duthie avatar image Rob Duthie dunnp commented ·

Hi

As per my schematic, all works as per the Venus software and pin outs etc.

Just need to add a few files to Uboot in the root directory etc and you are done

Note: we have full update path that required no SSH commands to add files etc

There is script file written which takes care of this now, i have all the information required to do this automatically, email me for details.

Victron Raspi Hat.pdfVictron Raspi Stetson.pdf


Regards

Rob D

NZ

0 Likes 0 ·
yuwire avatar image yuwire Rob Duthie commented ·

@Rob Duthie are you making this HAT?

0 Likes 0 ·