Page 1 of 1

Connecting two GPIO pins together?

Posted: Sun Mar 24, 2013 11:48 pm
by realtek
Hi,

Is it possible to detect if two GPIO pins have been basically linked together or would this short something out?

I was hoping to work the opposite and have a relay that is switched externally and tell the PI it has been switched??

Thanks!

Re: Connecting two GPIO pins together?

Posted: Mon Mar 25, 2013 8:26 am
by techpaul
If your relay has two contacts use one for switching the load and one foir signalling the Pi.

Ebsure Pi input has a pullup, connect a Normally Open contact (NO) to Pi GND, Connect the associated Common to the Pi GPIO input.

Just like a switch. This assumes you have a Double Pole Relay and you only need one pole to switch your load.

Re: Connecting two GPIO pins together?

Posted: Mon Mar 25, 2013 8:57 am
by cae2100
another solution could be to do it in software instead just using one pin for output, then switch it to input and read the state, then set it back as output again. when you switch it to input, it stays at whatever state it was at before switching.

Re: Connecting two GPIO pins together?

Posted: Sun Mar 31, 2013 12:30 pm
by tophat
Following on from this : I have GPIO2 configured as an input port to count relay closures on a flowmeter.
To test this I want to use GPIO1 as an output port.
Do i need to connect GPIO1 to a transistor and relay circuit (control side of relay) then I would to simulate the flowmeter and connect GPIO2 to the power side (say a Normally open contact) of the same relay ?
Or is there an easier way ?

Re: Connecting two GPIO pins together?

Posted: Sun Mar 31, 2013 5:21 pm
by techpaul
Not sure what exactly you are trying to achieve, see if you post a diagran of how you were thinking of wiring and what the function of each GPIO is for now and in final installation.

Re: Connecting two GPIO pins together?

Posted: Sun Mar 31, 2013 6:16 pm
by aTao
If you want to use a GPIO in to monitor another GPIO out then just connect the 2 with a resistor, 1k0 will do just fine.
Its slightly better to use a resistor instead of a wire for those "Dohh!" moments when you realise they are both outputs and have different output levels. sure the RPi current limits its outs but if you make a habit of it then you start asking a lot from the power supply.

*Edit:

The outputs are not current limited, the current setting on an output determines the maximum current you can draw while still getting a valid output.