[Cont.] How do I use the digital inputs in cerbo gx

Hi,
I found this thread but seems like all the old conversations are closed and not imported which is really unfortunate (but at least archived).

https://communityarchive.victronenergy.com/questions/113996/how-do-i-use-the-digital-inputs-in-cerbo-gx.html

That’s not quite right. The opto-coupler output is an open-collector NPN transistor which functions as a SPST switch that passes current from the output pin to the ground pin (so acts like a diode and switch together). The VCC pin supplies 3.3v to the output pin through the resistor. Therefore when there’s no input (the +12 from the alternator), the opto coupler switch is open, and the output is at 3.3v. When the alternator supplies +12 to the input, the opto coupler output switches on, grounding the output pin. So the output is inverted from the input. Now since the Cerbo GX digital inputs already have a pull-up resistor, you don’t need to duplicate that with the opto coupler so you can omit the 3.3v connection to the opto coupler, simply wiring the output to the Cerbo GX digital input pin, and the opto coupler ground pin to the same ground as the Cerbo’s. The RPI GPIO pins have both pull up and pull down resistors but you need to enable the one you want (if any). For this case you’d enable the pull up. The major advantage of doing it this way is that you’re not connecting the Pi’s internal 3.3v to the outside world.

I used this one. While it’s no longer available, it’s essentially a 4 channel version of the one you’re using, wired the way I described: Level Conversion, 4 Channel NPN to PNP Conversion Level Converter, Wide Voltage 10 28V Level Converter, NPN to PNP Level Converter for Industrial: Amazon.com: Industrial & Scientific

I just can’t really understand how this works I guess. The inverted output is annoying but good that venus has inverted option. The confusion is how that pull-up resistor works here, but with my bench power supply I put a 5k resistor between the 3v3 supply to “out” and when supplying 12v to the other side it does in fact go to zero. Just seems like to me we are wasting energy through this pull-up and instead just wanted basic dry contact output? Or maybe to measure dry contact you have to have the internal pull-up??

Sorry maybe a bit too in the weeds, but confusing for a mechanical engineer. Thanks so much for posting here with your thoughts, I can now use this onboard :wink: